From d1411ff2cc6c643b02840205174695eef405ac89 Mon Sep 17 00:00:00 2001 From: Prospector <6166773+Prospector@users.noreply.github.com> Date: Mon, 27 Jul 2026 13:16:47 -0700 Subject: [PATCH 1/6] cleaup app layout, add missing translations to it --- apps/app-frontend/src/App.vue | 278 ++++++------------ .../src/components/ui/SurveyPopup.vue | 233 +++++++++++++++ .../components/ui/world/RecentWorldsList.vue | 10 +- .../app-frontend/src/locales/ar-SA/index.json | 6 - .../app-frontend/src/locales/cs-CZ/index.json | 6 - .../app-frontend/src/locales/da-DK/index.json | 6 - .../app-frontend/src/locales/de-CH/index.json | 6 - .../app-frontend/src/locales/de-DE/index.json | 6 - .../app-frontend/src/locales/en-US/index.json | 57 +++- .../src/locales/es-419/index.json | 6 - .../app-frontend/src/locales/es-ES/index.json | 6 - .../app-frontend/src/locales/fi-FI/index.json | 6 - .../src/locales/fil-PH/index.json | 3 - .../app-frontend/src/locales/fr-FR/index.json | 6 - .../app-frontend/src/locales/he-IL/index.json | 3 - .../app-frontend/src/locales/hu-HU/index.json | 6 - .../app-frontend/src/locales/id-ID/index.json | 6 - .../app-frontend/src/locales/it-IT/index.json | 6 - .../app-frontend/src/locales/ja-JP/index.json | 6 - .../app-frontend/src/locales/ko-KR/index.json | 6 - .../app-frontend/src/locales/ms-MY/index.json | 6 - .../app-frontend/src/locales/nl-NL/index.json | 6 - .../app-frontend/src/locales/no-NO/index.json | 3 - .../app-frontend/src/locales/pl-PL/index.json | 6 - .../app-frontend/src/locales/pt-BR/index.json | 6 - .../app-frontend/src/locales/pt-PT/index.json | 3 - .../app-frontend/src/locales/ru-RU/index.json | 6 - .../app-frontend/src/locales/sr-CS/index.json | 6 - .../app-frontend/src/locales/sv-SE/index.json | 6 - .../app-frontend/src/locales/th-TH/index.json | 3 - .../app-frontend/src/locales/tr-TR/index.json | 6 - .../app-frontend/src/locales/uk-UA/index.json | 6 - .../app-frontend/src/locales/vi-VN/index.json | 6 - .../app-frontend/src/locales/zh-CN/index.json | 6 - .../app-frontend/src/locales/zh-TW/index.json | 6 - apps/app-frontend/src/pages/Browse.vue | 10 +- apps/app-frontend/src/pages/Skins.vue | 6 +- apps/app-frontend/src/pages/Worlds.vue | 4 - apps/app-frontend/src/pages/index.js | 3 +- apps/app-frontend/src/routes.js | 8 - apps/app-frontend/src/store/theme.ts | 1 - apps/frontend/src/layouts/default.vue | 6 +- apps/frontend/src/locales/cs-CZ/index.json | 3 - apps/frontend/src/locales/da-DK/index.json | 3 - apps/frontend/src/locales/de-CH/index.json | 3 - apps/frontend/src/locales/de-DE/index.json | 3 - apps/frontend/src/locales/en-US/index.json | 3 - apps/frontend/src/locales/es-419/index.json | 3 - apps/frontend/src/locales/es-ES/index.json | 3 - apps/frontend/src/locales/fil-PH/index.json | 3 - apps/frontend/src/locales/fr-FR/index.json | 3 - apps/frontend/src/locales/he-IL/index.json | 3 - apps/frontend/src/locales/hu-HU/index.json | 3 - apps/frontend/src/locales/id-ID/index.json | 3 - apps/frontend/src/locales/it-IT/index.json | 3 - apps/frontend/src/locales/ja-JP/index.json | 3 - apps/frontend/src/locales/ko-KR/index.json | 3 - apps/frontend/src/locales/ms-MY/index.json | 3 - apps/frontend/src/locales/nl-NL/index.json | 3 - apps/frontend/src/locales/no-NO/index.json | 3 - apps/frontend/src/locales/pl-PL/index.json | 3 - apps/frontend/src/locales/pt-BR/index.json | 3 - apps/frontend/src/locales/pt-PT/index.json | 3 - apps/frontend/src/locales/ro-RO/index.json | 3 - apps/frontend/src/locales/ru-RU/index.json | 3 - apps/frontend/src/locales/sv-SE/index.json | 3 - apps/frontend/src/locales/tr-TR/index.json | 3 - apps/frontend/src/locales/uk-UA/index.json | 3 - apps/frontend/src/locales/vi-VN/index.json | 3 - apps/frontend/src/locales/zh-CN/index.json | 3 - apps/frontend/src/locales/zh-TW/index.json | 3 - packages/ui/src/locales/en-US/index.json | 6 + packages/ui/src/utils/common-messages.ts | 8 + 73 files changed, 393 insertions(+), 495 deletions(-) create mode 100644 apps/app-frontend/src/components/ui/SurveyPopup.vue delete mode 100644 apps/app-frontend/src/pages/Worlds.vue diff --git a/apps/app-frontend/src/App.vue b/apps/app-frontend/src/App.vue index f7e78a4963..17fcc1a5ce 100644 --- a/apps/app-frontend/src/App.vue +++ b/apps/app-frontend/src/App.vue @@ -12,22 +12,18 @@ import { ArrowBigUpDashIcon, ChangeSkinIcon, CompassIcon, - ExternalIcon, HomeIcon, LeftArrowIcon, LibraryIcon, LogInIcon, LogOutIcon, NewspaperIcon, - NotepadTextIcon, PlusIcon, RefreshCwIcon, RightArrowIcon, ServerStackIcon, SettingsIcon, UserIcon, - WorldIcon, - XIcon, } from '@modrinth/assets' import { Admonition, @@ -39,6 +35,7 @@ import { CreationFlowModal, defineMessages, I18nDebugPanel, + IntlFormatted, LoadingBar, NewsArticleCard, NotificationPanel, @@ -63,7 +60,6 @@ import { fetch as tauriFetch } from '@tauri-apps/plugin-http' import { openUrl } from '@tauri-apps/plugin-opener' import { type } from '@tauri-apps/plugin-os' import { saveWindowState, StateFlags } from '@tauri-apps/plugin-window-state' -import { $fetch } from 'ofetch' import { computed, onMounted, onUnmounted, provide, ref, watch } from 'vue' import { RouterView, useRoute, useRouter } from 'vue-router' @@ -88,6 +84,7 @@ import PromotionWrapper from '@/components/ui/PromotionWrapper.vue' import QuickInstanceSwitcher from '@/components/ui/QuickInstanceSwitcher.vue' import SharedInstanceInviteHandler from '@/components/ui/shared-instances/shared-instance-invite-handler/index.vue' import SplashScreen from '@/components/ui/SplashScreen.vue' +import SurveyPopup from '@/components/ui/SurveyPopup.vue' import WindowControls from '@/components/ui/WindowControls.vue' import { useCheckDisableMouseover } from '@/composables/macCssFix.js' import { config } from '@/config' @@ -104,12 +101,7 @@ import { check_reachable } from '@/helpers/auth.js' import { get_user, get_version } from '@/helpers/cache.js' import { command_listener, notification_listener, warning_listener } from '@/helpers/events.js' import { install_create_modpack_instance, install_get_modpack_preview } from '@/helpers/install' -import { - can_current_user_use_shared_instances, - get as getInstance, - list, - run, -} from '@/helpers/instance' +import { can_current_user_use_shared_instances, get as getInstance, run } from '@/helpers/instance' import { get as getCreds, login, logout } from '@/helpers/mr_auth.ts' import { mergeUrlQuery, parseModrinthLink } from '@/helpers/project-links.ts' import { get as getSettings, set as setSettings } from '@/helpers/settings.ts' @@ -289,7 +281,6 @@ const { } = setupProviders(notificationManager, popupNotificationManager) const news = ref([]) -const availableSurvey = ref(false) const displayedServerInviteNotifications = new Set() const serverInvitePopupNotificationIds = new Set() let liveNotificationGeneration = 0 @@ -403,6 +394,54 @@ const messages = defineMessages({ id: 'app.ads-consent.accept', defaultMessage: 'Accept all', }, + home: { + id: 'app.nav.home', + defaultMessage: 'Home', + }, + library: { + id: 'app.nav.library', + defaultMessage: 'Library', + }, + modrinthHosting: { + id: 'app.nav.modrinth-hosting', + defaultMessage: 'Modrinth Hosting', + }, + createNewInstance: { + id: 'app.nav.create-new-instance', + defaultMessage: 'Create new instance', + }, + modrinthAccount: { + id: 'app.nav.modrinth-account', + defaultMessage: 'Modrinth account', + }, + signedInAs: { + id: 'app.nav.signed-in-as', + defaultMessage: 'Signed in as {username}', + }, + signInToModrinthAccount: { + id: 'app.nav.sign-in-to-modrinth-account', + defaultMessage: 'Sign in to a Modrinth account', + }, + restarting: { + id: 'app.restarting', + defaultMessage: 'Restarting...', + }, + upgradeToModrinthPlus: { + id: 'app.nav.upgrade-to-modrinth-plus', + defaultMessage: 'Upgrade to Modrinth+', + }, + news: { + id: 'app.news.title', + defaultMessage: 'News', + }, + viewAllNews: { + id: 'app.news.view-all', + defaultMessage: 'View all news', + }, + playingAs: { + id: 'app.sidebar.playing-as', + defaultMessage: 'Playing as', + }, }) function handleAdsConsentRequired(required) { @@ -571,12 +610,6 @@ async function setupApp() { settings.pending_update_toast_for_version = null await setSettings(settings) } - - if (osType === 'windows') { - await processPendingSurveys() - } else { - console.info('Skipping user surveys on non-Windows platforms') - } } const stateFailed = ref(false) @@ -1439,115 +1472,6 @@ function handleAuxClick(e) { } } -function cleanupOldSurveyDisplayData() { - const threeWeeksAgo = new Date() - threeWeeksAgo.setDate(threeWeeksAgo.getDate() - 21) - - for (let i = 0; i < localStorage.length; i++) { - const key = localStorage.key(i) - - if (key.startsWith('survey-') && key.endsWith('-display')) { - const dateValue = new Date(localStorage.getItem(key)) - if (dateValue < threeWeeksAgo) { - localStorage.removeItem(key) - } - } - } -} - -async function openSurvey() { - if (!availableSurvey.value) { - console.error('No survey to open') - return - } - - const creds = await getCreds().catch(handleError) - const userId = creds?.user_id - - const formId = availableSurvey.value.tally_id - - const popupOptions = { - layout: 'modal', - width: 700, - autoClose: 2000, - hideTitle: true, - hiddenFields: { - user_id: userId, - }, - onOpen: () => console.info('Opened user survey'), - onClose: () => { - console.info('Closed user survey') - show_ads_window() - }, - onSubmit: () => console.info('Active user survey submitted'), - } - - try { - hide_ads_window() - if (window.Tally?.openPopup) { - console.info(`Opening Tally popup for user survey (form ID: ${formId})`) - dismissSurvey() - window.Tally.openPopup(formId, popupOptions) - } else { - console.warn('Tally script not yet loaded') - show_ads_window() - } - } catch (e) { - console.error('Error opening Tally popup:', e) - show_ads_window() - } - - console.info(`Found user survey to show with tally_id: ${formId}`) - window.Tally.openPopup(formId, popupOptions) -} - -function dismissSurvey() { - localStorage.setItem(`survey-${availableSurvey.value.id}-display`, new Date()) - availableSurvey.value = undefined -} - -async function processPendingSurveys() { - function isWithinLastTwoWeeks(date) { - const twoWeeksAgo = new Date() - twoWeeksAgo.setDate(twoWeeksAgo.getDate() - 14) - return date >= twoWeeksAgo - } - - cleanupOldSurveyDisplayData() - - const creds = await getCreds().catch(handleError) - const userId = creds?.user_id - - const instances = (await list().catch(handleError)) ?? [] - const isActivePlayer = instances.some( - (instance) => - isWithinLastTwoWeeks(instance.last_played) && !isWithinLastTwoWeeks(instance.created), - ) - - let surveys = [] - try { - surveys = await $fetch('https://api.modrinth.com/v2/surveys') - } catch (e) { - console.error('Error fetching surveys:', e) - } - - const surveyToShow = surveys.find( - (survey) => - !!( - localStorage.getItem(`survey-${survey.id}-display`) === null && - survey.type === 'tally_app' && - ((survey.condition === 'active_player' && isActivePlayer) || - (survey.assigned_users?.includes(userId) && !survey.dismissed_users?.includes(userId))) - ), - ) - - if (surveyToShow) { - availableSurvey.value = surveyToShow - } else { - console.info('No user survey to show') - } -} - provideAppUpdateDownloadProgress(appUpdateDownload) @@ -1570,7 +1494,7 @@ provideAppUpdateDownloadProgress(appUpdateDownload) class="flex items-center gap-4 text-contrast font-semibold text-xl select-none cursor-default" > - Restarting... + {{ formatMessage(messages.restarting) }} @@ -1595,25 +1519,22 @@ provideAppUpdateDownloadProgress(appUpdateDownload)
- + - - - - + @@ -1653,7 +1574,7 @@ provideAppUpdateDownloadProgress(appUpdateDownload) - Signed in as - - - {{ credentials?.user?.username }} - + + + - - + @@ -1741,28 +1670,7 @@ provideAppUpdateDownloadProgress(appUpdateDownload) }" >
- -
-

Hey there Modrinth user!

-

- Would you mind answering a few questions about your experience with Modrinth App? -

-

- This feedback will go directly to the Modrinth team and help guide future updates! -

-
- - - - - - -
-
-
+