Skip to content

Commit

Permalink
chore: remove unused modal from app install
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinSchoeler committed Oct 10, 2024
1 parent bcdb415 commit fa5202b
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import { useTranslation } from '@rocket.chat/ui-contexts';
import React from 'react';

import MarkdownText from '../../../../components/MarkdownText';
import type { MarketplaceRouteContext } from '../../hooks/useAppsCountQuery';

type AppsInstallationModalProps = {
context: MarketplaceRouteContext;
enabled: number;
limit: number;
appName: string;
Expand All @@ -16,7 +14,6 @@ type AppsInstallationModalProps = {
};

const AppInstallationModal = ({
context,
enabled,
limit,
appName,
Expand All @@ -28,35 +25,34 @@ const AppInstallationModal = ({

const getTitle = () => {
if (enabled === limit) {
return context === 'private' ? t('Private_apps_limit_reached') : t('App_limit_reached');
return t('App_limit_reached');
}

if (enabled > limit) {
return context === 'private' ? t('Private_apps_limit_exceeded') : t('App_limit_exceeded');
return t('App_limit_exceeded');
}

return t('Apps_Currently_Enabled', { context: context === 'private' ? context : '', enabled, limit });
return t('Apps_Currently_Enabled', { context: '', enabled, limit });
};

const getContent = () => {
if (enabled === limit) {
return t('Enable_of_limit_apps_currently_enabled', { context: context === 'private' ? context : '', enabled, limit, appName });
return t('Enable_of_limit_apps_currently_enabled', { context: '', enabled, limit, appName });
}

if (enabled > limit) {
return t('Enable_of_limit_apps_currently_enabled_exceeded', {
...(context === 'private' && { context }),
enabled,
limit,
exceed: enabled - limit + 1,
appName,
});
}

return t('Workspaces_on_Community_edition_install_app', { context: context === 'private' ? context : '', enabled, limit });
return t('Workspaces_on_Community_edition_install_app', { context: '', enabled, limit });
};

const confirmButtonOverlimitLabel = context === 'private' ? t('Upload_anyway') : t('Install_anyway');
const confirmButtonOverLimitLabel = t('Install_anyway');

return (
<>
Expand All @@ -76,7 +72,7 @@ const AppInstallationModal = ({
<Modal.FooterControllers>
<Button onClick={handleEnableUnlimitedApps}>{t('Enable_unlimited_apps')}</Button>
<Button {...(enabled < limit && { primary: true })} onClick={handleConfirm}>
{enabled < limit ? t('Next') : confirmButtonOverlimitLabel}
{enabled < limit ? t('Next') : confirmButtonOverLimitLabel}
</Button>
</Modal.FooterControllers>
</Modal.Footer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ export function useAppInstallationHandler({

setModal(
<AppInstallModal
context={context}
enabled={appCountQuery.data.enabled}
limit={appCountQuery.data.limit}
appName={app.name}
Expand All @@ -143,17 +142,16 @@ export function useAppInstallationHandler({
);
}, [
app,
appsOrchestrator,
action,
appCountQuery.data,
setModal,
context,
closeModal,
acquireApp,
openIncompatibleModal,
dispatchToastMessage,
notifyAdmins,
success,
appsOrchestrator,
onDismiss,
openExternalLink,
manageSubscriptionUrl,
Expand Down
25 changes: 1 addition & 24 deletions apps/meteor/client/views/marketplace/hooks/useInstallApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,20 @@ import React, { useCallback, useState } from 'react';

import { AppClientOrchestratorInstance } from '../../../apps/orchestrator';
import { useAppsReload } from '../../../contexts/hooks/useAppsReload';
import { useExternalLink } from '../../../hooks/useExternalLink';
import { useCheckoutUrl } from '../../admin/subscription/hooks/useCheckoutUrl';
import AppPermissionsReviewModal from '../AppPermissionsReviewModal';
import AppUpdateModal from '../AppUpdateModal';
import AppInstallationModal from '../components/AppInstallModal/AppInstallModal';
import { handleAPIError } from '../helpers/handleAPIError';
import { handleInstallError } from '../helpers/handleInstallError';
import { getManifestFromZippedApp } from '../lib/getManifestFromZippedApp';
import { useAppsCountQuery } from './useAppsCountQuery';

export const useInstallApp = (file: File): { install: () => void; isInstalling: boolean } => {
const reloadAppsList = useAppsReload();
const openExternalLink = useExternalLink();
const setModal = useSetModal();

const router = useRouter();

const appCountQuery = useAppsCountQuery('private');
const manageSubscriptionUrl = useCheckoutUrl()({ target: 'marketplace-app-install', action: 'Enable_unlimited_apps' });

const uploadAppEndpoint = useUpload('/apps');
const uploadUpdateEndpoint = useUpload('/apps/update');
Expand Down Expand Up @@ -126,25 +121,7 @@ export const useInstallApp = (file: File): { install: () => void; isInstalling:
return cancelAction();
}

if (appCountQuery.data.hasUnlimitedApps) {
return uploadFile(appFile, manifest);
}

setModal(
<AppInstallationModal
context='private'
enabled={appCountQuery.data.enabled}
limit={appCountQuery.data.limit}
appName={manifest.name}
handleClose={cancelAction}
handleConfirm={() => uploadFile(appFile, manifest)}
handleEnableUnlimitedApps={() => {
openExternalLink(manageSubscriptionUrl);
setModal(null);
setInstalling(false);
}}
/>,
);
return uploadFile(appFile, manifest);
};

return { install, isInstalling };
Expand Down
2 changes: 0 additions & 2 deletions packages/i18n/src/locales/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -6343,8 +6343,6 @@
"Upload_anyway": "Upload anyway",
"App_limit_reached": "App limit reached",
"App_limit_exceeded": "App limit exceeded",
"Private_apps_limit_reached": "Private apps limit reached",
"Private_apps_limit_exceeded": "Private apps limit exceeded",
"Disable_at_least_more_apps": "You will need to disable at least {{numberOfExceededApps}} other apps or upgrade to a Premium plan to enable this app.",
"Community_Private_apps_limit_exceeded": "Community app limit has been exceeded.",
"Theme_match_system": "Match system",
Expand Down
3 changes: 0 additions & 3 deletions packages/i18n/src/locales/es.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -4920,8 +4920,6 @@
"Theme_dark": "Oscuro",
"Theme_dark_description": "Reduzca la fatiga ocular en condiciones de poca luz minimizando la cantidad de luz emitida por la pantalla.",
"Workspaces_on_Community_edition_install_app": "Los espacios de trabajo comunitarios pueden tener hasta {{limit}} {{context}} aplicaciones habilitadas. Actualiza a un plan Premium para habilitar un número ilimitado de aplicaciones.",
"Private_apps_limit_reached": "Límite de aplicaciones privadas alcanzado",
"Private_apps_limit_exceeded": "Límite de aplicaciones privadas superado",
"Disable_at_least_more_apps": "Tendrás que desactivar al menos {{numberOfExceededApps}} aplicaciones o actualizar a un plan Premium para activar esta aplicación.",
"Join_your_team": "Únete a tu equipo",
"Create_a_password": "Crear una contraseña",
Expand Down Expand Up @@ -5066,7 +5064,6 @@
"MAC_InfoText": "Contactos Activos Mensuales (MAC). El número de contactos únicos de Omnichannel con quienes se interactuó durante un mes de facturación",
"CountMAC_InfoText": "Contactos Activos Mensuales (MAC). El número de contactos únicos de Omnichannel con quienes se interactuó durante un mes calendario",
"ActiveSessions_InfoText": "Total de conexiones concurrentes. Un usuario puede estar conectado varias veces. El servicio de presencia de usuario se deshabilita cuando el total llega a 200 conexiones para prevenir problemas de rendimiento",
"Apps_InfoText": "Comunidad permite hasta {{privateAppsMaxCount}} aplicaciones privadas y {{marketplaceAppsMaxCount}} aplicaciones de la tienda ser habilitadas",
"Remove_RocketChat_Watermark_InfoText": "La marca de agua es removida automticamente cuando una licencia de paga es activada",
"Remove_RocketChat_Watermark": "Remover marca de agua de Rocket.Chat",
"High_scalabaility": "Alta escalabilidad",
Expand Down
2 changes: 0 additions & 2 deletions packages/i18n/src/locales/fi.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -5640,8 +5640,6 @@
"Upload_anyway": "Lataa silti",
"App_limit_reached": "Sovellusraja saavutettu",
"App_limit_exceeded": "Sovellusraja ylitetty",
"Private_apps_limit_reached": "Yksityisten sovellusten raja saavutettu",
"Private_apps_limit_exceeded": "Yksityisten sovellusten raja ylitetty",
"Disable_at_least_more_apps": "Poista käytöstä vähintään {{numberOfExceededApps}} muuta sovellusta tai päivitä yritysversioon, jotta voit ottaa tämän sovelluksen käyttöön.",
"Community_Private_apps_limit_exceeded": "Yhteisöversion sovellusraja on ylitetty.",
"Theme_match_system": "Järjestelmän mukaan",
Expand Down
3 changes: 0 additions & 3 deletions packages/i18n/src/locales/hi-IN.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -5930,8 +5930,6 @@
"Upload_anyway": "फिर भी अपलोड करें",
"App_limit_reached": "ऐप की सीमा पूरी हो गई",
"App_limit_exceeded": "ऐप की सीमा पार हो गई",
"Private_apps_limit_reached": "निजी ऐप्स की सीमा पूरी हो गई",
"Private_apps_limit_exceeded": "निजी ऐप्स की सीमा पार हो गई",
"Disable_at_least_more_apps": "इस ऐप को सक्षम करने के लिए आपको कम से कम {{numberOfExceededApps}} अन्य ऐप्स को अक्षम करना होगा या प्रीमियम प्लान में अपग्रेड करना होगा।",
"Community_Private_apps_limit_exceeded": "सामुदायिक ऐप की सीमा पार हो गई है.",
"Theme_match_system": "मिलान प्रणाली",
Expand Down Expand Up @@ -6107,7 +6105,6 @@
"MAC_InfoText": "(मैक) बिलिंग माह के दौरान जुड़े अद्वितीय सर्वचैनल संपर्कों की संख्या।",
"CountMAC_InfoText": "(मैक) कैलेंडर माह के दौरान जुड़े अद्वितीय ओमनीचैनल संपर्कों की संख्या।",
"ActiveSessions_InfoText": "कुल समवर्ती कनेक्शन. एक ही यूजर को कई बार कनेक्ट किया जा सकता है। प्रदर्शन समस्याओं को रोकने के लिए उपयोगकर्ता उपस्थिति सेवा 200 या उससे अधिक पर अक्षम है।",
"Apps_InfoText": "समुदाय {{privateAppsMaxCount}} निजी ऐप्स और {{marketplaceAppsMaxCount}} मार्केटप्लेस ऐप्स को सक्षम करने की अनुमति देता है",
"Remove_RocketChat_Watermark_InfoText": "सशुल्क लाइसेंस सक्रिय होने पर वॉटरमार्क स्वचालित रूप से हटा दिया जाता है।",
"Remove_RocketChat_Watermark": "रॉकेट.चैट वॉटरमार्क हटाएँ",
"High_scalabaility": "उच्च मापनीयता",
Expand Down
2 changes: 0 additions & 2 deletions packages/i18n/src/locales/it.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -3368,8 +3368,6 @@
"subscription.callout.privateApps": "applicazioni private installate",
"subscription.callout.marketplaceApps": "applicazioni del marketplace installate",
"subscription.callout.monthlyActiveContacts": "contatti attivi mensili",
"Private_apps_limit_reached": "Limite di app private raggiunto",
"Private_apps_limit_exceeded": "Limite di app private superato",
"Time": "Tempo",
"This_attachment_is_not_supported": "Formato dell'allegato non supportato",
"Send_transcript": "Invia la trascrizione",
Expand Down
2 changes: 0 additions & 2 deletions packages/i18n/src/locales/no.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -4523,8 +4523,6 @@
"Upload_anyway": "Last opp allikevel",
"App_limit_reached": "Appgrensen er nådd",
"App_limit_exceeded": "Appgrensen er overskredet",
"Private_apps_limit_reached": "Grensen for private apper er nådd",
"Private_apps_limit_exceeded": "Grensen for private apper er overskredet",
"Community_Private_apps_limit_exceeded": "Grensen for Community-apper er overskredet.",
"Theme_high_contrast": "Høy kontrast",
"Highlighted_chosen_word": "Uthevet valgt ord",
Expand Down
2 changes: 0 additions & 2 deletions packages/i18n/src/locales/sv.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -5647,8 +5647,6 @@
"Upload_anyway": "Ladda upp ändå",
"App_limit_reached": "App-gränsen har nåtts",
"App_limit_exceeded": "App-gränsen har överskridits",
"Private_apps_limit_reached": "Gränsen för privata appar har nåtts",
"Private_apps_limit_exceeded": "Gränsen för privata appar har överskridits",
"Disable_at_least_more_apps": "Du måste inaktivera minst {{numberOfExceededApps}} andra appar eller uppgradera till Enterprise för att aktivera den här appen.",
"Community_Private_apps_limit_exceeded": "Gränsen för appar i Community Edition har överskridits.",
"Theme_match_system": "Matchningssystem",
Expand Down

0 comments on commit fa5202b

Please sign in to comment.