Skip to content

Commit 9952c3a

Browse files
0.9.0 release (app) (#3056)
* Debug app * Bump version, final fixes
1 parent cae6f12 commit 9952c3a

File tree

17 files changed

+111
-70
lines changed

17 files changed

+111
-70
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/app-frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@modrinth/app-frontend",
33
"private": true,
4-
"version": "0.9.0-2",
4+
"version": "0.9.0",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

apps/app-frontend/src/App.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,15 @@ router.afterEach((to) => {
264264
forceSidebar.value = to.path.startsWith('/browse') || to.path.startsWith('/project')
265265
})
266266
267+
const currentTimeout = ref(null)
267268
watch(
268269
showAd,
269270
() => {
270271
if (!showAd.value) {
272+
if (currentTimeout.value) clearTimeout(currentTimeout.value)
271273
hide_ads_window(true)
272274
} else {
273-
setTimeout(() => {
275+
currentTimeout.value = setTimeout(() => {
274276
init_ads_window(true)
275277
}, 400)
276278
}
@@ -441,7 +443,7 @@ function handleAuxClick(e) {
441443
<div data-tauri-drag-region class="app-grid-statusbar bg-bg-raised h-[--top-bar-height] flex">
442444
<div data-tauri-drag-region class="flex p-3">
443445
<ModrinthAppLogo class="h-full w-auto text-contrast pointer-events-none" />
444-
<Breadcrumbs />
446+
<Breadcrumbs class="pt-[2px]" />
445447
</div>
446448
<section class="flex ml-auto items-center">
447449
<ButtonStyled

apps/app-frontend/src/components/RowDisplay.vue

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { showProfileInFolder } from '@/helpers/utils.js'
2525
import { trackEvent } from '@/helpers/analytics'
2626
import { handleSevereError } from '@/store/error.js'
2727
import { install as installVersion } from '@/store/install.js'
28+
import { openUrl } from '@tauri-apps/plugin-opener'
2829
2930
const router = useRouter()
3031
@@ -165,13 +166,7 @@ const handleOptionsClick = async (args) => {
165166
break
166167
}
167168
case 'open_link':
168-
window.__TAURI_INVOKE__('tauri', {
169-
__tauriModule: 'Shell',
170-
message: {
171-
cmd: 'open',
172-
path: `https://modrinth.com/${args.item.project_type}/${args.item.slug}`,
173-
},
174-
})
169+
openUrl(`https://modrinth.com/${args.item.project_type}/${args.item.slug}`)
175170
break
176171
case 'copy_link':
177172
await navigator.clipboard.writeText(

apps/app-frontend/src/components/ui/Instance.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,12 @@ onUnmounted(() => unlisten())
189189
v-else-if="modLoading || installing"
190190
v-tooltip="modLoading ? 'Instance is loading...' : 'Installing...'"
191191
class="animate-spin w-8 h-8"
192+
tabindex="-1"
192193
/>
193194
<ButtonStyled v-else size="large" color="brand" circular>
194195
<button
195196
v-tooltip="'Play'"
196-
class="transition-all scale-75 group-hover:scale-100 origin-bottom opacity-0 group-hover:opacity-100 card-shadow"
197+
class="transition-all scale-75 group-hover:scale-100 group-focus-within:scale-100 origin-bottom opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 card-shadow"
197198
@click="(e) => play(e, 'InstanceCard')"
198199
@mousehover="checkProcess"
199200
>

apps/app-frontend/src/components/ui/QuickInstanceSwitcher.vue

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ const getInstances = async () => {
1616
recentInstances.value = profiles
1717
.sort((a, b) => {
1818
const dateACreated = dayjs(a.created)
19-
const dateAPlayed = dayjs(a.last_played)
19+
const dateAPlayed = a.last_played ? dayjs(a.last_played) : dayjs(0)
2020
2121
const dateBCreated = dayjs(b.created)
22-
const dateBPlayed = dayjs(b.last_played)
22+
const dateBPlayed = b.last_played ? dayjs(b.last_played) : dayjs(0)
2323
2424
const dateA = dateACreated.isAfter(dateAPlayed) ? dateACreated : dateAPlayed
2525
const dateB = dateBCreated.isAfter(dateBPlayed) ? dateBCreated : dateBPlayed
@@ -35,8 +35,10 @@ const getInstances = async () => {
3535
3636
await getInstances()
3737
38-
const unlistenProfile = await profile_listener(async () => {
39-
await getInstances()
38+
const unlistenProfile = await profile_listener(async (event) => {
39+
if (event.event !== 'synced') {
40+
await getInstances()
41+
}
4042
})
4143
4244
onUnmounted(() => {
@@ -50,6 +52,7 @@ onUnmounted(() => {
5052
:key="instance.id"
5153
v-tooltip.right="instance.name"
5254
:to="`/instance/${encodeURIComponent(instance.path)}`"
55+
class="relative"
5356
>
5457
<Avatar
5558
:src="instance.icon_path ? convertFileSrc(instance.icon_path) : null"
@@ -59,7 +62,7 @@ onUnmounted(() => {
5962
/>
6063
<div
6164
v-if="instance.install_stage !== 'installed'"
62-
class="absolute inset-0 flex items-center justify-center"
65+
class="absolute inset-0 flex items-center justify-center z-10"
6366
>
6467
<SpinnerIcon class="animate-spin w-4 h-4" />
6568
</div>

apps/app-frontend/src/components/ui/RunningAppBar.vue

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
<template>
22
<div class="action-groups">
3-
<Button
4-
v-if="currentLoadingBars.length > 0"
5-
ref="infoButton"
6-
icon-only
7-
class="icon-button show-card-icon"
8-
@click="toggleCard()"
9-
>
10-
<DownloadIcon />
11-
</Button>
3+
<ButtonStyled v-if="currentLoadingBars.length > 0" color="brand" type="transparent" circular>
4+
<button ref="infoButton" @click="toggleCard()">
5+
<DownloadIcon />
6+
</button>
7+
</ButtonStyled>
128
<div v-if="offline" class="status">
139
<UnplugIcon />
1410
<div class="running-text">
@@ -41,15 +37,6 @@
4137
<Button v-tooltip="'View logs'" icon-only class="icon-button" @click="goToTerminal()">
4238
<TerminalSquareIcon />
4339
</Button>
44-
<Button
45-
v-if="currentLoadingBars.length > 0"
46-
ref="infoButton"
47-
icon-only
48-
class="icon-button show-card-icon"
49-
@click="toggleCard()"
50-
>
51-
<DownloadIcon />
52-
</Button>
5340
</div>
5441
<div v-else class="status">
5542
<span class="circle stopped" />
@@ -111,7 +98,7 @@ import {
11198
DropdownIcon,
11299
UnplugIcon,
113100
} from '@modrinth/assets'
114-
import { Button, Card } from '@modrinth/ui'
101+
import { Button, ButtonStyled, Card } from '@modrinth/ui'
115102
import { onBeforeUnmount, onMounted, ref } from 'vue'
116103
import { get_all as getRunningProcesses, kill as killProcess } from '@/helpers/process'
117104
import { loading_listener, process_listener } from '@/helpers/events'
@@ -409,10 +396,6 @@ onBeforeUnmount(() => {
409396
}
410397
}
411398
412-
.show-card-icon {
413-
color: var(--color-brand);
414-
}
415-
416399
.download-enter-active,
417400
.download-leave-active {
418401
transition: opacity 0.3s ease;

apps/app-frontend/src/components/ui/SearchCard.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,13 @@ const installing = ref(false)
157157
async function install() {
158158
installing.value = true
159159
await installVersion(
160-
props.project.project_id,
160+
props.project.project_id ?? props.project.id,
161161
null,
162162
props.instance ? props.instance.path : null,
163163
'SearchCard',
164164
() => {
165165
installing.value = false
166-
emit('install', props.project.project_id)
166+
emit('install', props.project.project_id ?? props.project.id)
167167
},
168168
)
169169
}

apps/app-frontend/src/pages/Browse.vue

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup lang="ts">
22
import { computed, nextTick, ref, shallowRef, watch } from 'vue'
33
import type { Ref } from 'vue'
4-
import { SearchIcon, XIcon } from '@modrinth/assets'
4+
import { SearchIcon, XIcon, ClipboardCopyIcon, GlobeIcon, ExternalIcon } from '@modrinth/assets'
55
import type { Category, GameVersion, Platform, ProjectType, SortType, Tags } from '@modrinth/ui'
66
import {
77
SearchFilterControl,
@@ -25,6 +25,8 @@ import NavTabs from '@/components/ui/NavTabs.vue'
2525
import type Instance from '@/components/ui/Instance.vue'
2626
import InstanceIndicator from '@/components/ui/InstanceIndicator.vue'
2727
import { defineMessages, useVIntl } from '@vintl/vintl'
28+
import ContextMenu from '@/components/ui/ContextMenu.vue'
29+
import { openUrl } from '@tauri-apps/plugin-opener'
2830
2931
const { formatMessage } = useVIntl()
3032
@@ -351,6 +353,36 @@ const messages = defineMessages({
351353
},
352354
})
353355
356+
const options = ref(null)
357+
const handleRightClick = (event, result) => {
358+
options.value.showMenu(event, result, [
359+
{
360+
name: 'install',
361+
},
362+
{
363+
type: 'divider',
364+
},
365+
{
366+
name: 'open_link',
367+
},
368+
{
369+
name: 'copy_link',
370+
},
371+
])
372+
}
373+
const handleOptionsClick = (args) => {
374+
switch (args.option) {
375+
case 'open_link':
376+
openUrl(`https://modrinth.com/${args.item.project_type}/${args.item.slug}`)
377+
break
378+
case 'copy_link':
379+
navigator.clipboard.writeText(
380+
`https://modrinth.com/${args.item.project_type}/${args.item.slug}`,
381+
)
382+
break
383+
}
384+
}
385+
354386
await refreshSearch()
355387
</script>
356388

@@ -477,7 +509,12 @@ await refreshSearch()
477509
newlyInstalled.push(id)
478510
}
479511
"
512+
@contextmenu.prevent.stop="(event) => handleRightClick(event, result)"
480513
/>
514+
<ContextMenu ref="options" @option-clicked="handleOptionsClick">
515+
<template #open_link> <GlobeIcon /> Open in Modrinth <ExternalIcon /> </template>
516+
<template #copy_link> <ClipboardCopyIcon /> Copy link </template>
517+
</ContextMenu>
481518
</section>
482519
<div class="flex justify-end">
483520
<pagination

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

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,15 @@
218218
</ButtonStyled>
219219
</template>
220220
</ContentListPanel>
221+
<div class="flex justify-end mt-4">
222+
<Pagination
223+
v-if="search.length > 0"
224+
:page="currentPage"
225+
:count="Math.ceil(search.length / 20)"
226+
:link-function="(page) => `?page=${page}`"
227+
@switch-page="(page) => (currentPage = page)"
228+
/>
229+
</div>
221230
</template>
222231
<div v-else class="w-full flex flex-col items-center justify-center mt-6 max-w-[48rem] mx-auto">
223232
<div class="top-box w-full">
@@ -416,6 +425,7 @@ const initProjects = async (cacheBehaviour?) => {
416425
icon: null,
417426
disabled: file.file_name.endsWith('.disabled'),
418427
outdated: false,
428+
updated: dayjs(0),
419429
project_type: file.project_type === 'shaderpack' ? 'shader' : file.project_type,
420430
})
421431
}
@@ -541,20 +551,19 @@ const search = computed(() => {
541551
switch (sortColumn.value) {
542552
case 'Updated':
543553
return filtered.slice().sort((a, b) => {
544-
if (a.updated < b.updated) {
545-
return ascending.value ? 1 : -1
546-
}
547-
if (a.updated > b.updated) {
548-
return ascending.value ? -1 : 1
549-
}
550-
return 0
554+
const updated = a.updated.isAfter(b.updated) ? 1 : -1
555+
return ascending.value ? -updated : updated
551556
})
552557
default:
553-
return filtered.slice().sort((a, b) => a.name.localeCompare(b.name))
558+
return filtered
559+
.slice()
560+
.sort((a, b) =>
561+
ascending.value ? a.name.localeCompare(b.name) : b.name.localeCompare(a.name),
562+
)
554563
}
555564
})
556565
557-
watch(search, () => (currentPage.value = 1))
566+
watch([sortColumn, ascending, selectedFilters.value, searchFilter], () => (currentPage.value = 1))
558567
559568
const sortProjects = (filter) => {
560569
if (sortColumn.value === filter) {

0 commit comments

Comments
 (0)