Skip to content

Commit 86c0937

Browse files
authored
fix: app problems post release qa (#5554)
* fix: app problems post release qa * fix: lint * fix: dont prefill * fix: toggle gap * feat: macs thing * fix: lint
1 parent 51deba8 commit 86c0937

File tree

31 files changed

+512
-139
lines changed

31 files changed

+512
-139
lines changed

apps/app-frontend/src/App.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ provideModalBehavior({
147147
148148
const {
149149
installationModal,
150+
fetchExistingInstanceNames,
150151
handleCreate,
151152
handleBrowseModpacks,
152153
searchModpacks,
@@ -945,6 +946,7 @@ provideAppUpdateDownloadProgress(appUpdateDownload)
945946
ref="installationModal"
946947
type="instance"
947948
show-snapshot-toggle
949+
:fetch-existing-instance-names="fetchExistingInstanceNames"
948950
:search-modpacks="searchModpacks"
949951
:get-project-versions="getProjectVersions"
950952
@create="handleCreate"

apps/app-frontend/src/components/ui/instance_settings/GeneralSettings.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,15 @@ watch(
109109
const removing = ref(false)
110110
async function removeProfile() {
111111
removing.value = true
112+
const path = props.instance.path
112113
113114
trackEvent('InstanceRemove', {
114115
loader: props.instance.loader,
115116
game_version: props.instance.game_version,
116117
})
117118
118119
await router.push({ path: '/' })
119-
await remove(props.instance.path).catch(handleError)
120+
await remove(path).catch(handleError)
120121
}
121122
122123
const messages = defineMessages({

apps/app-frontend/src/pages/instance/Index.vue

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@
246246
:options="options"
247247
:offline="offline"
248248
:playing="playing"
249-
:versions="modrinthVersions"
250249
:installed="instance.install_stage !== 'installed'"
251250
:is-server-instance="isServerInstance"
252251
:open-settings="() => settingsModal?.show(1)"
@@ -332,7 +331,7 @@ import InstanceSettingsModal from '@/components/ui/modal/InstanceSettingsModal.v
332331
import UpdateToPlayModal from '@/components/ui/modal/UpdateToPlayModal.vue'
333332
import NavTabs from '@/components/ui/NavTabs.vue'
334333
import { trackEvent } from '@/helpers/analytics'
335-
import { get_project_v3, get_version_many } from '@/helpers/cache.js'
334+
import { get_project_v3 } from '@/helpers/cache.js'
336335
import { process_listener, profile_listener } from '@/helpers/events'
337336
import { get_by_profile_path } from '@/helpers/process'
338337
import { finish_install, get, get_full_path, kill, run } from '@/helpers/profile'
@@ -362,7 +361,6 @@ window.addEventListener('online', () => {
362361
})
363362
364363
const instance = ref<GameInstance>()
365-
const modrinthVersions = ref<Labrinth.Versions.v2.Version[]>([])
366364
const playing = ref(false)
367365
const loading = ref(false)
368366
const exportModal = ref<InstanceType<typeof ExportModal>>()
@@ -385,7 +383,6 @@ const loadingServerPing = ref(false)
385383
async function fetchInstance() {
386384
isServerInstance.value = false
387385
linkedProjectV3.value = undefined
388-
modrinthVersions.value = []
389386
ping.value = undefined
390387
playersOnline.value = undefined
391388
loadingServerPing.value = false
@@ -402,14 +399,6 @@ async function fetchInstance() {
402399
if (linkedProjectV3.value?.minecraft_server != null) {
403400
isServerInstance.value = true
404401
}
405-
406-
if (linkedProjectV3.value && linkedProjectV3.value.versions) {
407-
const versions = await get_version_many(linkedProjectV3.value.versions, 'must_revalidate')
408-
modrinthVersions.value = versions.sort(
409-
(a: Labrinth.Versions.v2.Version, b: Labrinth.Versions.v2.Version) =>
410-
dayjs(b.date_published).valueOf() - dayjs(a.date_published).valueOf(),
411-
)
412-
}
413402
} catch (error) {
414403
handleError(error as Error)
415404
}
@@ -605,18 +594,23 @@ const handleOptionsClick = async (args: { option: string; item: unknown }) => {
605594
606595
const unlistenProfiles = await profile_listener(
607596
async (event: { profile_path_id: string; event: string }) => {
608-
if (event.profile_path_id === route.params.id) {
609-
if (event.event === 'removed') {
610-
await router.push({
611-
path: '/',
612-
})
613-
return
597+
if (event.profile_path_id !== route.params.id) return
598+
if (event.event === 'removed' || route.path === '/') {
599+
if (route.path !== '/') {
600+
await router.push({ path: '/' })
614601
}
615-
instance.value = await get(route.params.id as string).catch(handleError)
616-
if (!instance.value?.linked_data?.project_id) {
617-
linkedProjectV3.value = undefined
618-
isServerInstance.value = false
602+
return
603+
}
604+
instance.value = await get(route.params.id as string).catch((err) => {
605+
if (String(err).includes('not managed')) {
606+
router.push({ path: '/' })
607+
return undefined
619608
}
609+
return handleError(err)
610+
})
611+
if (!instance.value?.linked_data?.project_id) {
612+
linkedProjectV3.value = undefined
613+
isServerInstance.value = false
620614
}
621615
},
622616
)

apps/app-frontend/src/pages/instance/Logs.vue

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,6 @@ const props = defineProps({
150150
return false
151151
},
152152
},
153-
versions: {
154-
type: Array,
155-
required: true,
156-
},
157153
installed: {
158154
type: Boolean,
159155
default() {

apps/app-frontend/src/pages/instance/Mods.vue

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
: (updatingProject?.version?.id ?? '')
3737
"
3838
:is-app="true"
39-
:is-modpack="updatingModpack"
39+
:project-type="updatingModpack ? 'modpack' : updatingProject?.project_type"
4040
:project-icon-url="
4141
updatingModpack ? linkedModpackProject?.icon_url : updatingProject?.project?.icon_url
4242
"
@@ -73,6 +73,7 @@ import {
7373
type OverflowMenuOption,
7474
provideAppBackup,
7575
provideContentManager,
76+
useDebugLogger,
7677
useVIntl,
7778
} from '@modrinth/ui'
7879
import { ContentCardLayout as ContentPageLayout } from '@modrinth/ui'
@@ -165,10 +166,10 @@ const { formatMessage } = useVIntl()
165166
const { handleError, addNotification } = injectNotificationManager()
166167
const { installingItems } = injectContentInstall()
167168
const router = useRouter()
169+
const debug = useDebugLogger('Mods:ContentUpdate')
168170
169171
const props = defineProps<{
170172
instance: GameInstance
171-
versions: Labrinth.Versions.v2.Version[]
172173
isServerInstance?: boolean
173174
openSettings?: () => void
174175
}>()
@@ -349,6 +350,18 @@ async function handleUpdate(id: string) {
349350
const item = projects.value.find((p) => p.file_name === id)
350351
if (!item?.has_update || !item.project?.id || !item.version?.id) return
351352
353+
debug('handleUpdate triggered', {
354+
fileName: item.file_name,
355+
projectType: item.project_type,
356+
projectId: item.project.id,
357+
projectTitle: item.project.title,
358+
currentVersionId: item.version.id,
359+
currentVersionNumber: item.version.version_number,
360+
updateVersionId: item.update_version_id,
361+
instanceGameVersion: props.instance.game_version,
362+
instanceLoader: props.instance.loader,
363+
})
364+
352365
updatingModpack.value = false
353366
updatingProject.value = item
354367
updatingProjectVersions.value = []
@@ -365,7 +378,24 @@ async function handleUpdate(id: string) {
365378
366379
loadingVersions.value = false
367380
368-
if (!versions) return
381+
if (!versions) {
382+
debug('handleUpdate: no versions returned', { projectId: item.project.id })
383+
return
384+
}
385+
386+
debug('handleUpdate: fetched versions', {
387+
projectId: item.project.id,
388+
projectType: item.project_type,
389+
totalVersions: versions.length,
390+
versionSample: versions.slice(0, 5).map((v) => ({
391+
id: v.id,
392+
number: v.version_number,
393+
loaders: v.loaders,
394+
gameVersions: v.game_versions,
395+
})),
396+
currentVersionInList: versions.some((v) => v.id === item.version?.id),
397+
updateVersionInList: versions.some((v) => v.id === item.update_version_id),
398+
})
369399
370400
versions.sort(
371401
(a, b) => new Date(b.date_published).getTime() - new Date(a.date_published).getTime(),
@@ -493,9 +523,17 @@ function handleModpackUpdateCancel() {
493523
pendingModpackUpdateVersion.value = null
494524
}
495525
496-
async function handleModalUpdate(selectedVersion: Labrinth.Versions.v2.Version) {
526+
async function handleModalUpdate(
527+
selectedVersion: Labrinth.Versions.v2.Version,
528+
event?: MouseEvent,
529+
) {
497530
if (updatingModpack.value) {
498-
handleModpackUpdateRequest(selectedVersion)
531+
if (event?.shiftKey) {
532+
pendingModpackUpdateVersion.value = selectedVersion
533+
await handleModpackUpdateConfirm()
534+
} else {
535+
handleModpackUpdateRequest(selectedVersion)
536+
}
499537
} else if (updatingProject.value) {
500538
const mod = updatingProject.value
501539
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<template>{{ instance.name }} overview</template>
22
<script setup lang="ts">
3-
import type { Version } from '@modrinth/utils'
4-
53
import type ContextMenu from '@/components/ui/ContextMenu.vue'
64
import type { GameInstance } from '@/helpers/types'
75
@@ -10,7 +8,6 @@ defineProps<{
108
options: InstanceType<typeof ContextMenu>
119
offline: boolean
1210
playing: boolean
13-
versions: Version[]
1411
installed: boolean
1512
}>()
1613
</script>

apps/app-frontend/src/pages/instance/Worlds.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ import {
134134
RadialHeader,
135135
StyledInput,
136136
} from '@modrinth/ui'
137-
import type { Version } from '@modrinth/utils'
138137
import { platform } from '@tauri-apps/plugin-os'
139138
import { computed, onUnmounted, ref, watch } from 'vue'
140139
import { useRoute } from 'vue-router'
@@ -202,7 +201,6 @@ const props = defineProps<{
202201
options: InstanceType<typeof ContextMenu> | null
203202
offline: boolean
204203
playing: boolean
205-
versions: Version[]
206204
installed: boolean
207205
}>()
208206

apps/app-frontend/src/providers/setup/creation-modal.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,14 @@ export function setupCreationModal(notificationManager: AbstractWebNotificationM
1313
const router = useRouter()
1414

1515
const installationModal = useTemplateRef('installationModal')
16-
provide('showCreationModal', async () => {
16+
17+
async function fetchExistingInstanceNames(): Promise<string[]> {
1718
const instances = await list().catch(handleError)
18-
installationModal.value?.show(instances?.length ?? 0)
19+
return instances?.map((i) => i.name) ?? []
20+
}
21+
22+
provide('showCreationModal', () => {
23+
installationModal.value?.show()
1924
})
2025

2126
async function handleCreate(config: CreationFlowContextValue) {
@@ -57,9 +62,10 @@ export function setupCreationModal(notificationManager: AbstractWebNotificationM
5762
? null
5863
: (config.selectedLoaderVersion.value ?? config.loaderVersionType.value)
5964
const iconPath = config.instanceIconPath.value ?? null
65+
const name = config.instanceName.value.trim() || config.autoInstanceName.value
6066

6167
await create(
62-
config.instanceName.value,
68+
name,
6369
config.selectedGameVersion.value,
6470
loader,
6571
loaderVersion,
@@ -68,7 +74,7 @@ export function setupCreationModal(notificationManager: AbstractWebNotificationM
6874
).catch(handleError)
6975

7076
trackEvent('InstanceCreate', {
71-
profile_name: config.instanceName.value,
77+
profile_name: name,
7278
game_version: config.selectedGameVersion.value,
7379
loader,
7480
loader_version: loaderVersion,
@@ -102,6 +108,7 @@ export function setupCreationModal(notificationManager: AbstractWebNotificationM
102108

103109
return {
104110
installationModal,
111+
fetchExistingInstanceNames,
105112
handleCreate,
106113
handleBrowseModpacks,
107114
searchModpacks,

packages/assets/generated-icons.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import _ArchiveIcon from './icons/archive.svg?component'
1111
import _ArrowBigRightDashIcon from './icons/arrow-big-right-dash.svg?component'
1212
import _ArrowBigUpDashIcon from './icons/arrow-big-up-dash.svg?component'
1313
import _ArrowDownIcon from './icons/arrow-down.svg?component'
14+
import _ArrowDownAZIcon from './icons/arrow-down-a-z.svg?component'
1415
import _ArrowDownLeftIcon from './icons/arrow-down-left.svg?component'
16+
import _ArrowDownZAIcon from './icons/arrow-down-z-a.svg?component'
1517
import _ArrowLeftIcon from './icons/arrow-left.svg?component'
1618
import _ArrowLeftRightIcon from './icons/arrow-left-right.svg?component'
1719
import _ArrowUpIcon from './icons/arrow-up.svg?component'
@@ -38,6 +40,7 @@ import _BracesIcon from './icons/braces.svg?component'
3840
import _BrushCleaningIcon from './icons/brush-cleaning.svg?component'
3941
import _BugIcon from './icons/bug.svg?component'
4042
import _CalendarIcon from './icons/calendar.svg?component'
43+
import _CalendarArrowDownIcon from './icons/calendar-arrow-down.svg?component'
4144
import _CardIcon from './icons/card.svg?component'
4245
import _ChangeSkinIcon from './icons/change-skin.svg?component'
4346
import _ChartIcon from './icons/chart.svg?component'
@@ -54,6 +57,8 @@ import _ClearIcon from './icons/clear.svg?component'
5457
import _ClientIcon from './icons/client.svg?component'
5558
import _ClipboardCopyIcon from './icons/clipboard-copy.svg?component'
5659
import _ClockIcon from './icons/clock.svg?component'
60+
import _ClockArrowDownIcon from './icons/clock-arrow-down.svg?component'
61+
import _ClockArrowUpIcon from './icons/clock-arrow-up.svg?component'
5762
import _CloudIcon from './icons/cloud.svg?component'
5863
import _CodeIcon from './icons/code.svg?component'
5964
import _CoffeeIcon from './icons/coffee.svg?component'
@@ -358,6 +363,7 @@ import _ToggleLeftIcon from './icons/toggle-left.svg?component'
358363
import _ToggleRightIcon from './icons/toggle-right.svg?component'
359364
import _TransferIcon from './icons/transfer.svg?component'
360365
import _TrashIcon from './icons/trash.svg?component'
366+
import _TrashExclamationIcon from './icons/trash-exclamation.svg?component'
361367
import _TriangleAlertIcon from './icons/triangle-alert.svg?component'
362368
import _UnderlineIcon from './icons/underline.svg?component'
363369
import _UndoIcon from './icons/undo.svg?component'
@@ -390,7 +396,9 @@ export const ArchiveIcon = _ArchiveIcon
390396
export const ArrowBigRightDashIcon = _ArrowBigRightDashIcon
391397
export const ArrowBigUpDashIcon = _ArrowBigUpDashIcon
392398
export const ArrowDownIcon = _ArrowDownIcon
399+
export const ArrowDownAZIcon = _ArrowDownAZIcon
393400
export const ArrowDownLeftIcon = _ArrowDownLeftIcon
401+
export const ArrowDownZAIcon = _ArrowDownZAIcon
394402
export const ArrowLeftIcon = _ArrowLeftIcon
395403
export const ArrowLeftRightIcon = _ArrowLeftRightIcon
396404
export const ArrowUpIcon = _ArrowUpIcon
@@ -417,6 +425,7 @@ export const BracesIcon = _BracesIcon
417425
export const BrushCleaningIcon = _BrushCleaningIcon
418426
export const BugIcon = _BugIcon
419427
export const CalendarIcon = _CalendarIcon
428+
export const CalendarArrowDownIcon = _CalendarArrowDownIcon
420429
export const CardIcon = _CardIcon
421430
export const ChangeSkinIcon = _ChangeSkinIcon
422431
export const ChartIcon = _ChartIcon
@@ -433,6 +442,8 @@ export const ClearIcon = _ClearIcon
433442
export const ClientIcon = _ClientIcon
434443
export const ClipboardCopyIcon = _ClipboardCopyIcon
435444
export const ClockIcon = _ClockIcon
445+
export const ClockArrowDownIcon = _ClockArrowDownIcon
446+
export const ClockArrowUpIcon = _ClockArrowUpIcon
436447
export const CloudIcon = _CloudIcon
437448
export const CodeIcon = _CodeIcon
438449
export const CoffeeIcon = _CoffeeIcon
@@ -737,6 +748,7 @@ export const ToggleLeftIcon = _ToggleLeftIcon
737748
export const ToggleRightIcon = _ToggleRightIcon
738749
export const TransferIcon = _TransferIcon
739750
export const TrashIcon = _TrashIcon
751+
export const TrashExclamationIcon = _TrashExclamationIcon
740752
export const TriangleAlertIcon = _TriangleAlertIcon
741753
export const UnderlineIcon = _UnderlineIcon
742754
export const UndoIcon = _UndoIcon
Lines changed: 19 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)