Skip to content

Commit 46e1f16

Browse files
DecDuckquexeky
andauthored
Process manager fixes (#71)
* fix: launching on linux * feat: #70 * feat: add dummy store page * feat: add store redir and refresh button to library * feat: cache first object fetching * feat: Remove let_chains feature and update to Rust 2024 Signed-off-by: quexeky <[email protected]> * feat: Check for if process was manually stopped Signed-off-by: quexeky <[email protected]> * fix: use bitcode instead of serde * chore: remove logs * fix: clippy * fix: clippy 2 * fix: swap to stop icon --------- Signed-off-by: quexeky <[email protected]> Co-authored-by: quexeky <[email protected]>
1 parent d19f9bb commit 46e1f16

26 files changed

+424
-225
lines changed

components/GameStatusButton.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ import {
6161
ChevronDownIcon,
6262
PlayIcon,
6363
QueueListIcon,
64+
StopIcon,
6465
WrenchIcon,
6566
} from "@heroicons/vue/20/solid";
6667
@@ -128,7 +129,7 @@ const buttonIcons: { [key in GameStatusEnum]: Component } = {
128129
[GameStatusEnum.Installed]: PlayIcon,
129130
[GameStatusEnum.Updating]: ArrowDownTrayIcon,
130131
[GameStatusEnum.Uninstalling]: TrashIcon,
131-
[GameStatusEnum.Running]: PlayIcon,
132+
[GameStatusEnum.Running]: StopIcon,
132133
[GameStatusEnum.PartiallyInstalled]: ArrowDownTrayIcon
133134
};
134135

components/LibrarySearch.vue

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
11
<template>
22
<div>
3-
<div
4-
class="relative mb-3 transition-transform duration-300 hover:scale-105 active:scale-95"
5-
>
3+
<div class="mb-3 inline-flex gap-x-2">
64
<div
7-
class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3"
5+
class="relative transition-transform duration-300 hover:scale-105 active:scale-95"
86
>
9-
<MagnifyingGlassIcon class="h-5 w-5 text-zinc-400" aria-hidden="true" />
7+
<div
8+
class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3"
9+
>
10+
<MagnifyingGlassIcon
11+
class="h-5 w-5 text-zinc-400"
12+
aria-hidden="true"
13+
/>
14+
</div>
15+
<input
16+
type="text"
17+
v-model="searchQuery"
18+
class="block w-full rounded-lg border-0 bg-zinc-800/50 py-2 pl-10 pr-3 text-zinc-100 placeholder:text-zinc-500 focus:bg-zinc-800 focus:ring-2 focus:ring-inset focus:ring-blue-500 sm:text-sm sm:leading-6"
19+
placeholder="Search library..."
20+
/>
1021
</div>
11-
<input
12-
type="text"
13-
v-model="searchQuery"
14-
class="block w-full rounded-lg border-0 bg-zinc-800/50 py-2 pl-10 pr-3 text-zinc-100 placeholder:text-zinc-500 focus:bg-zinc-800 focus:ring-2 focus:ring-inset focus:ring-blue-500 sm:text-sm sm:leading-6"
15-
placeholder="Search library..."
16-
/>
22+
<button
23+
@click="() => calculateGames(true)"
24+
class="p-1 flex items-center justify-center transition-transform duration-300 size-10 hover:scale-110 active:scale-90 rounded-lg bg-zinc-800/50 text-zinc-100"
25+
>
26+
<ArrowPathIcon class="size-4" />
27+
</button>
1728
</div>
1829

1930
<TransitionGroup name="list" tag="ul" class="flex flex-col gap-y-1.5">
@@ -60,7 +71,7 @@
6071
</template>
6172

6273
<script setup lang="ts">
63-
import { MagnifyingGlassIcon } from "@heroicons/vue/20/solid";
74+
import { ArrowPathIcon, MagnifyingGlassIcon } from "@heroicons/vue/20/solid";
6475
import { invoke } from "@tauri-apps/api/core";
6576
import { GameStatusEnum, type Game, type GameStatus } from "~/types";
6677
import { TransitionGroup } from "vue";
@@ -76,7 +87,7 @@ const gameStatusTextStyle: { [key in GameStatusEnum]: string } = {
7687
[GameStatusEnum.Updating]: "text-blue-500",
7788
[GameStatusEnum.Uninstalling]: "text-zinc-100",
7889
[GameStatusEnum.SetupRequired]: "text-yellow-500",
79-
[GameStatusEnum.PartiallyInstalled]: "text-gray-600"
90+
[GameStatusEnum.PartiallyInstalled]: "text-gray-600",
8091
};
8192
const gameStatusText: { [key in GameStatusEnum]: string } = {
8293
[GameStatusEnum.Remote]: "Not installed",
@@ -87,7 +98,7 @@ const gameStatusText: { [key in GameStatusEnum]: string } = {
8798
[GameStatusEnum.Uninstalling]: "Uninstalling...",
8899
[GameStatusEnum.SetupRequired]: "Setup required",
89100
[GameStatusEnum.Running]: "Running",
90-
[GameStatusEnum.PartiallyInstalled]: "Partially installed"
101+
[GameStatusEnum.PartiallyInstalled]: "Partially installed",
91102
};
92103
93104
const router = useRouter();
@@ -101,16 +112,20 @@ const icons: { [key: string]: string } = {};
101112
102113
const rawGames: Ref<Game[], Game[]> = ref([]);
103114
104-
async function calculateGames() {
105-
rawGames.value = await invoke("fetch_library");
106-
for (const game of rawGames.value) {
115+
async function calculateGames(clearAll = false) {
116+
if (clearAll) rawGames.value = [];
117+
// If we update immediately, the navigation gets re-rendered before we
118+
// add all the necessary state, and it freaks tf out
119+
const newGames = await invoke<typeof rawGames.value>("fetch_library");
120+
for (const game of newGames) {
107121
if (games[game.id]) continue;
108122
games[game.id] = await useGame(game.id);
109123
}
110-
for (const game of rawGames.value) {
124+
for (const game of newGames) {
111125
if (icons[game.id]) continue;
112126
icons[game.id] = await useObject(game.mIconObjectId);
113127
}
128+
rawGames.value = newGames;
114129
}
115130
116131
await calculateGames();

composables/game.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export type SerializedGameStatus = [
1414
];
1515

1616
export const parseStatus = (status: SerializedGameStatus): GameStatus => {
17-
console.log(status);
1817
if (status[0]) {
1918
return {
2019
type: status[0].type,
@@ -48,7 +47,6 @@ export const useGame = async (gameId: string) => {
4847
status: SerializedGameStatus;
4948
version?: GameVersion;
5049
} = event.payload as any;
51-
console.log(payload.status);
5250
gameStatusRegistry[gameId].value = parseStatus(payload.status);
5351

5452
/**

composables/state-navigation.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function setupHooks() {
1818
});
1919

2020
listen("auth/finished", async (event) => {
21-
router.push("/store");
21+
router.push("/library");
2222
state.value = JSON.parse(await invoke("fetch_state"));
2323
});
2424

@@ -30,12 +30,31 @@ export function setupHooks() {
3030
description: `Drop encountered an error while downloading your game: "${(
3131
event.payload as unknown as string
3232
).toString()}"`,
33-
buttonText: "Close"
33+
buttonText: "Close",
3434
},
3535
(e, c) => c()
3636
);
3737
});
3838

39+
// This is for errors that (we think) aren't our fault
40+
listen("launch_external_error", (event) => {
41+
createModal(
42+
ModalType.Confirmation,
43+
{
44+
title: "Did something go wrong?",
45+
description:
46+
"Drop detected that something might've gone wrong with launching your game. Do you want to open the log directory?",
47+
buttonText: "Open",
48+
},
49+
async (e, c) => {
50+
if (e == "confirm") {
51+
await invoke("open_process_logs", { gameId: event.payload });
52+
}
53+
c();
54+
}
55+
);
56+
});
57+
3958
/*
4059
4160
document.addEventListener("contextmenu", (event) => {
@@ -63,6 +82,6 @@ export function initialNavigation(state: Ref<AppState>) {
6382
router.push("/error/serverunavailable");
6483
break;
6584
default:
66-
router.push("/store");
85+
router.push("/library");
6786
}
6887
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"@tauri-apps/api": ">=2.0.0",
1919
"@tauri-apps/plugin-deep-link": "~2",
2020
"@tauri-apps/plugin-dialog": "^2.0.1",
21+
"@tauri-apps/plugin-opener": "^2.4.0",
2122
"@tauri-apps/plugin-os": "~2",
2223
"@tauri-apps/plugin-shell": "^2.2.1",
2324
"koa": "^2.16.1",

pages/settings/debug.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ const systemData = await invoke<{
106106
dataDir: string;
107107
}>("fetch_system_data");
108108
109-
console.log(systemData);
110-
111109
clientId.value = systemData.clientId;
112110
baseUrl.value = systemData.baseUrl;
113111
dataDir.value = systemData.dataDir;

pages/store/index.vue

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,37 @@
11
<template>
2+
<div class="grow w-full h-full flex items-center justify-center">
3+
<div class="flex flex-col items-center">
4+
<BuildingStorefrontIcon
5+
class="h-12 w-12 text-blue-600"
6+
aria-hidden="true"
7+
/>
8+
<div class="mt-3 text-center sm:mt-5">
9+
<h1 class="text-3xl font-semibold font-display leading-6 text-zinc-100">
10+
Store not supported in client
11+
</h1>
12+
<div class="mt-4">
13+
<p class="text-sm text-zinc-400 max-w-lg">
14+
Currently, Drop requires you to view the store in your browser.
15+
Please click the button below to open it in your default browser.
16+
</p>
17+
<NuxtLink
18+
:href="storeUrl"
19+
target="_blank"
20+
class="mt-6 transition text-sm/6 font-semibold text-zinc-400 hover:text-zinc-100 inline-flex gap-x-2 items-center duration-200 hover:scale-105"
21+
>
22+
Open Store <ArrowTopRightOnSquareIcon class="size-4" />
23+
</NuxtLink>
24+
</div>
25+
</div>
26+
</div>
27+
</div>
228
</template>
3-
<script setup lang="ts"></script>
29+
<script setup lang="ts">
30+
import {
31+
ArrowTopRightOnSquareIcon,
32+
BuildingStorefrontIcon,
33+
} from "@heroicons/vue/20/solid";
34+
import { invoke } from "@tauri-apps/api/core";
35+
36+
const storeUrl = await invoke<string>("gen_drop_url", { path: "/store" });
37+
</script>

0 commit comments

Comments
 (0)