Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"@dashlane/pqc-kem-kyber512-browser": "^1.0.0",
"@headlessui/react": "^2.2.10",
"@iconscout/react-unicons": "^1.1.6",
"@internxt/css-config": "1.1.0",
"@internxt/css-config": "1.1.1",
"@internxt/lib": "1.4.1",
"@internxt/ui": "=0.1.22",
"@internxt/sdk": "=1.17.9",
"@internxt/ui": "=0.1.21",
"@phosphor-icons/react": "^2.1.7",
"@popperjs/core": "^2.11.6",
"@reduxjs/toolkit": "^1.6.0",
Expand Down
21 changes: 21 additions & 0 deletions src/app/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,27 @@
"title": "Cleaner freischalten",
"description": "Upgrade jetzt, um deine Dateien zu optimieren und Speicherplatz freizugeben."
}
},
"reachingUsageBanner": {
"lowWarning": {
"title": "Hol dir mehr Speicherplatz für deine Dateien",
"descriptionLabelLine1": "Schalte zusätzlichen Speicher mit einem exklusiven **Rabatt von 85 %** auf dein Upgrade frei",
"descriptionLabelLine2": "Greife auf erweiterte Funktionen wie Dateiversionsverlauf, Rclone, NAS-Unterstützung, Premium-Support und mehr zu"
},
"midWarning": {
"title": "Dein Speicher füllt sich",
"descriptionLabelLine1": "Führe heute ein Upgrade mit einem exklusiven **Rabatt von 85 %** durch und lade weiter ohne Unterbrechungen hoch",
"descriptionLabelLine2": "Erhalte mehr Speicher sowie erweiterte Funktionen wie Dateiversionsverlauf, NAS-Unterstützung, Rclone-Integration und Premium-Support",
"sidenavStorageText": "Mehr Speicher 85 % Rabatt"
},
"highWarning": {
"title": "Dein Speicher ist fast voll",
"descriptionLabelLine1": "Möglicherweise kannst du bald keine neuen Dateien mehr hochladen",
"descriptionLabelLine2": "Führe jetzt ein Upgrade mit einem exklusiven Rabatt von 85 % durch, um deine Dateien ohne Grenzen weiter zu speichern und zu synchronisieren",
"sidenavStorageText": "Speicher kaufen 85 % Rabatt"
},
"close": "Schließen",
"cta": "Angebot sichern"
}
},
"form": {
Expand Down
21 changes: 21 additions & 0 deletions src/app/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,27 @@
"title": "Unlock Cleaner",
"description": "Upgrade now to keep your files optimized and free up space."
}
},
"reachingUsageBanner": {
"lowWarning": {
"title": "Get more space for your files",
"descriptionLabelLine1": "Unlock additional storage with an exclusive **85% discount** on your upgrade",
"descriptionLabelLine2": "Access advanced features like file version history, Rclone, NAS support, premium support, and more"
},
"midWarning": {
"title": "Your storage is filling up",
"descriptionLabelLine1": "Upgrade today with an exclusive **85% discount** and keep uploading without interruptions",
"descriptionLabelLine2": "Get more storage plus advanced features like file version history, NAS support, Rclone integration, and premium support",
"sidenavStorageText": "More space 85% off"
},
"highWarning": {
"title": "Your storage is almost full",
"descriptionLabelLine1": "You may soon be unable to upload new files",
"descriptionLabelLine2": "Upgrade now with an exclusive 85% discount to continue storing and syncing your files without limits",
"sidenavStorageText": "Buy space 85% off"
},
"close": "Close",
"cta": "Get offer"
}
},
"form": {
Expand Down
21 changes: 21 additions & 0 deletions src/app/i18n/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,27 @@
"title": "Desbloquear Cleaner",
"description": "Mejora tu plan ahora para mantener tus archivos optimizados y liberar espacio."
}
},
"reachingUsageBanner": {
"lowWarning": {
"title": "Consigue más espacio para tus archivos",
"descriptionLabelLine1": "Desbloquea almacenamiento adicional con un **85% de descuento** exclusivo en tu mejora",
"descriptionLabelLine2": "Accede a funciones avanzadas como el historial de versiones de archivos, Rclone, compatibilidad con NAS, soporte premium y mucho más"
},
"midWarning": {
"title": "Tu almacenamiento se está llenando",
"descriptionLabelLine1": "Mejora hoy con un **85% de descuento** exclusivo y sigue subiendo archivos sin interrupciones",
"descriptionLabelLine2": "Consigue más almacenamiento además de funciones avanzadas como el historial de versiones de archivos, compatibilidad con NAS, integración con Rclone y soporte premium",
"sidenavStorageText": "Más espacio 85% dto."
},
"highWarning": {
"title": "Tu almacenamiento está casi lleno",
"descriptionLabelLine1": "Es posible que pronto no puedas subir nuevos archivos",
"descriptionLabelLine2": "Mejora ahora con un 85% de descuento exclusivo para seguir almacenando y sincronizando tus archivos sin límites",
"sidenavStorageText": "Compra espacio 85% dto."
},
"close": "Cerrar",
"cta": "Obtener oferta"
}
},
"form": {
Expand Down
21 changes: 21 additions & 0 deletions src/app/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,27 @@
"title": "Débloquer Cleaner",
"description": "Mettez à niveau pour optimiser vos fichiers et libérer de l’espace."
}
},
"reachingUsageBanner": {
"lowWarning": {
"title": "Obtenez plus d'espace pour vos fichiers",
"descriptionLabelLine1": "Débloquez un espace de stockage supplémentaire avec une **réduction exclusive de 85 %** sur votre mise à niveau",
"descriptionLabelLine2": "Accédez à des fonctionnalités avancées comme l'historique des versions de fichiers, Rclone, la prise en charge NAS, le support premium et bien plus encore"
},
"midWarning": {
"title": "Votre espace de stockage se remplit",
"descriptionLabelLine1": "Passez à la version supérieure dès aujourd'hui avec une **réduction exclusive de 85 %** et continuez à envoyer vos fichiers sans interruption",
"descriptionLabelLine2": "Obtenez plus de stockage ainsi que des fonctionnalités avancées comme l'historique des versions de fichiers, la prise en charge NAS, l'intégration Rclone et le support premium",
"sidenavStorageText": "Plus d'espace -85 %"
},
"highWarning": {
"title": "Votre espace de stockage est presque plein",
"descriptionLabelLine1": "Vous pourriez bientôt ne plus pouvoir envoyer de nouveaux fichiers",
"descriptionLabelLine2": "Passez à la version supérieure dès maintenant avec une réduction exclusive de 85 % pour continuer à stocker et synchroniser vos fichiers sans limites",
"sidenavStorageText": "Acheter de l'espace -85 %"
},
"close": "Fermer",
"cta": "Profiter de l'offre"
}
},
"form": {
Expand Down
21 changes: 21 additions & 0 deletions src/app/i18n/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,27 @@
"title": "Sblocca Cleaner",
"description": "Aggiorna ora per mantenere i tuoi file ottimizzati e liberare spazio."
}
},
"reachingUsageBanner": {
"lowWarning": {
"title": "Ottieni più spazio per i tuoi file",
"descriptionLabelLine1": "Sblocca spazio di archiviazione aggiuntivo con uno **sconto esclusivo dell'85%** sul tuo upgrade",
"descriptionLabelLine2": "Accedi a funzionalità avanzate come la cronologia delle versioni dei file, Rclone, il supporto NAS, il supporto premium e molto altro"
},
"midWarning": {
"title": "Il tuo spazio di archiviazione si sta riempiendo",
"descriptionLabelLine1": "Esegui l'upgrade oggi con uno **sconto esclusivo dell'85%** e continua a caricare senza interruzioni",
"descriptionLabelLine2": "Ottieni più spazio di archiviazione e funzionalità avanzate come la cronologia delle versioni dei file, il supporto NAS, l'integrazione con Rclone e il supporto premium",
"sidenavStorageText": "Più spazio -85%"
},
"highWarning": {
"title": "Il tuo spazio di archiviazione è quasi pieno",
"descriptionLabelLine1": "Presto potresti non essere più in grado di caricare nuovi file",
"descriptionLabelLine2": "Esegui subito l'upgrade con uno sconto esclusivo dell'85% per continuare ad archiviare e sincronizzare i tuoi file senza limiti",
"sidenavStorageText": "Acquista spazio -85%"
},
"close": "Chiudi",
"cta": "Ottieni l'offerta"
}
},
"form": {
Expand Down
21 changes: 21 additions & 0 deletions src/app/i18n/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,27 @@
"title": "Разблокировать Cleaner",
"description": "Обновите план, чтобы оптимизировать файлы и освободить место."
}
},
"reachingUsageBanner": {
"lowWarning": {
"title": "Получите больше места для ваших файлов",
"descriptionLabelLine1": "Откройте дополнительное хранилище с эксклюзивной **скидкой 85%** на повышение тарифа",
"descriptionLabelLine2": "Получите доступ к расширенным функциям, таким как история версий файлов, Rclone, поддержка NAS, премиум-поддержка и многое другое"
},
"midWarning": {
"title": "Ваше хранилище заполняется",
"descriptionLabelLine1": "Перейдите на улучшенный тариф сегодня с эксклюзивной **скидкой 85%** и продолжайте загружать файлы без перерывов",
"descriptionLabelLine2": "Получите больше места, а также расширенные функции, такие как история версий файлов, поддержка NAS, интеграция с Rclone и премиум-поддержка",
"sidenavStorageText": "Больше места -85%"
},
"highWarning": {
"title": "Ваше хранилище почти заполнено",
"descriptionLabelLine1": "Возможно, скоро вы не сможете загружать новые файлы",
"descriptionLabelLine2": "Перейдите на улучшенный тариф сейчас с эксклюзивной скидкой 85%, чтобы продолжать хранить и синхронизировать файлы без ограничений",
"sidenavStorageText": "Купить место -85%"
},
"close": "Закрыть",
"cta": "Получить предложение"
}
},
"form": {
Expand Down
21 changes: 21 additions & 0 deletions src/app/i18n/locales/tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,27 @@
"title": "解鎖 Cleaner",
"description": "升級以最佳化您的檔案並釋放空間。"
}
},
"reachingUsageBanner": {
"lowWarning": {
"title": "為你的檔案取得更多空間",
"descriptionLabelLine1": "升級時享有專屬 **85% 折扣**,解鎖額外儲存空間",
"descriptionLabelLine2": "使用進階功能,例如檔案版本記錄、Rclone、NAS 支援、優先客服等"
},
"midWarning": {
"title": "你的儲存空間即將用盡",
"descriptionLabelLine1": "今天就以專屬 **85% 折扣**升級,持續上傳不中斷",
"descriptionLabelLine2": "取得更多儲存空間,以及檔案版本記錄、NAS 支援、Rclone 整合和優先客服等進階功能",
"sidenavStorageText": "更多空間 85% 折扣"
},
"highWarning": {
"title": "你的儲存空間幾乎已滿",
"descriptionLabelLine1": "你可能很快將無法上傳新檔案",
"descriptionLabelLine2": "立即以專屬 85% 折扣升級,不受限制地繼續儲存與同步你的檔案",
"sidenavStorageText": "購買空間 85% 折扣"
},
"close": "關閉",
"cta": "取得優惠"
}
},
"form": {
Expand Down
21 changes: 21 additions & 0 deletions src/app/i18n/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -1136,6 +1136,27 @@
"title": "解锁 Cleaner",
"description": "升级以优化您的文件并释放存储空间。"
}
},
"reachingUsageBanner": {
"lowWarning": {
"title": "为你的文件获取更多空间",
"descriptionLabelLine1": "升级时享受专属 **85% 折扣**,解锁额外存储空间",
"descriptionLabelLine2": "使用高级功能,例如文件版本历史记录、Rclone、NAS 支持、优先客服等"
},
"midWarning": {
"title": "你的存储空间即将用满",
"descriptionLabelLine1": "今天就以专属 **85% 折扣**升级,持续上传不中断",
"descriptionLabelLine2": "获取更多存储空间,以及文件版本历史记录、NAS 支持、Rclone 集成和优先客服等高级功能",
"sidenavStorageText": "更多空间 85% 折扣"
},
"highWarning": {
"title": "你的存储空间几乎已满",
"descriptionLabelLine1": "你可能很快将无法上传新文件",
"descriptionLabelLine2": "立即以专属 85% 折扣升级,不受限制地继续存储和同步你的文件",
"sidenavStorageText": "购买空间 85% 折扣"
},
"close": "关闭",
"cta": "获取优惠"
}
},
"form": {
Expand Down
56 changes: 49 additions & 7 deletions src/components/SidenavWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/store/hooks';
import { planSelectors } from 'app/store/slices/plan';
import { sharedThunks } from 'app/store/slices/sharedLinks';
import { uiActions } from 'app/store/slices/ui';
import logo from 'assets/icons/small-logo.svg';
import { useSidenavCollapsed } from 'hooks/useSidenavCollapsed';
import { useSidenavNavigation } from 'hooks/useSidenavNavigation';
Expand All @@ -24,6 +23,35 @@ import { useReferralParamsChange } from 'views/Drive/hooks/useReferralParamsChan
import WorkspaceSelectorContainer from 'views/Home/components/WorkspaceSelectorContainer';
import WorkspaceSelectorSkeleton from 'views/Home/components/WorkspaceSelectorSkeleton';
import ReferralBanner from './ReferralBanner';
import { CloudWarning } from '@phosphor-icons/react';

type StorageWarning = 'lowWarning' | 'midWarning' | 'highWarning';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is duplicated.


interface StorageStageConfig {
key: StorageWarning;
threshold: number;
barClassName: string;
containerClassName?: string;
advertisementKey?: string;
}

const STORAGE_STAGES: StorageStageConfig[] = [
{ key: 'lowWarning', threshold: 60, barClassName: 'bg-yellow-60', containerClassName: 'pb-5' },
{
key: 'midWarning',
threshold: 80,
barClassName: 'bg-orange-60',
containerClassName: 'pb-5',
advertisementKey: 'modals.reachingUsageBanner.midWarning.sidenavStorageText',
},
{
key: 'highWarning',
threshold: 95,
barClassName: 'bg-danger',
containerClassName: 'pb rounded-lg bg-alert border border-alert-dark',
advertisementKey: 'modals.reachingUsageBanner.highWarning.sidenavStorageText',
},
];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it could be better to centralize this Stages with this one. Something like STORAGE_STAGES_CONFIG and export them whenever you need them and use it as you wish.


const SidenavPrimaryAction = ({
user,
Expand Down Expand Up @@ -69,6 +97,12 @@ const SidenavWrapper = () => {
const userUsage = planUsage > 0 ? bytesToString(planUsage) : '0GB';
const isReferralEligible = useAppSelector((state: RootState) => state.referrals.isEligible);

const isFreeUser = subscription?.type === 'free';
const usedPercentage = planLimit > 0 ? (planUsage / planLimit) * 100 : 0;
const reachedStorageStage = isFreeUser
? [...STORAGE_STAGES].reverse().find((stage) => usedPercentage >= stage.threshold)
: undefined;

useReferralParamsChange();

useEffect(() => {
Expand All @@ -91,14 +125,19 @@ const SidenavWrapper = () => {
};

const handleUpgradeClick = () => {
navigationService.openPreferencesDialog({
section: 'account',
subsection: 'plans',
workspaceUuid: selectedWorkspace?.workspaceUser.workspaceId,
});
dispatch(uiActions.setIsPreferencesDialogOpen(true));
window.open('https://internxt.com/specialoffer', '_blank', 'noopener,noreferrer');
};

const storageAdvertisement = reachedStorageStage?.advertisementKey ? (
<span className="flex flex-row gap-0.5 items-center">
<CloudWarning
className="size-5 text-yellow-60"
weight={reachedStorageStage.key === 'highWarning' ? 'fill' : 'regular'}
/>
<p className="text-sm font-semibold text-gray-80">{translate(reachedStorageStage.advertisementKey)} </p>
</span>
) : undefined;

const handleReferralClick = () => {
if (user) {
referralService.openPanel(
Expand Down Expand Up @@ -141,6 +180,9 @@ const SidenavWrapper = () => {
onUpgradeClick: handleUpgradeClick,
upgradeLabel: isUpgradeAvailable() ? translate('preferences.account.plans.upgrade') : undefined,
isLoading: isLoadingPlanUsage && isLoadingPlanLimit && isLoadingBusinessLimitAndUsage,
barClassName: reachedStorageStage?.barClassName,
containerClassName: reachedStorageStage?.containerClassName,
advertisement: storageAdvertisement,
}}
/>
{isReferralEligible && (
Expand Down
Loading
Loading