diff --git a/apps/app-frontend/src/App.vue b/apps/app-frontend/src/App.vue
index f7e78a4963..87263b4af8 100644
--- a/apps/app-frontend/src/App.vue
+++ b/apps/app-frontend/src/App.vue
@@ -10,24 +10,20 @@ import {
} from '@modrinth/api-client'
import {
ArrowBigUpDashIcon,
- ChangeSkinIcon,
CompassIcon,
- ExternalIcon,
HomeIcon,
LeftArrowIcon,
LibraryIcon,
LogInIcon,
LogOutIcon,
NewspaperIcon,
- NotepadTextIcon,
PlusIcon,
RefreshCwIcon,
RightArrowIcon,
ServerStackIcon,
SettingsIcon,
+ ShirtIcon,
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'
@@ -148,6 +140,7 @@ import { setupAuthProvider } from '@/providers/setup/auth'
import { setupLoadingStateProvider } from '@/providers/setup/loading-state'
import { useError } from '@/store/error.js'
import { useTheming } from '@/store/state'
+import { appMessages } from '@/utils/app-messages'
import { generateSkinPreviews } from './helpers/rendering/batch-skin-renderer'
import { get_available_capes, get_available_skins } from './helpers/skins'
@@ -289,7 +282,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 +395,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 +611,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 +1473,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 +1495,7 @@ provideAppUpdateDownloadProgress(appUpdateDownload)
class="flex items-center gap-4 text-contrast font-semibold text-xl select-none cursor-default"
>
- Restarting...
+ {{ formatMessage(messages.restarting) }}
@@ -1593,27 +1518,24 @@ provideAppUpdateDownloadProgress(appUpdateDownload)
/>
-
+
-
-
-
-
-
+
+
-
@@ -1653,7 +1574,7 @@ provideAppUpdateDownloadProgress(appUpdateDownload)
- Signed in as
-
-
- {{ credentials?.user?.username }}
-
+
+
+
+
+
+
+
+
-
- Sign out
+
+
+ {{ formatMessage(commonMessages.signOutButton) }}
+
@@ -1741,28 +1670,7 @@ provideAppUpdateDownloadProgress(appUpdateDownload)
}"
>
-
-
-
-
- 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!
-
-
-
-
-
-
-
-
-
-
-
+