mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-14 00:31:33 +10:00
feat(download ui): debug queue interface
This commit is contained in:
@ -40,12 +40,10 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Game } from "@prisma/client";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import type { NavigationItem } from "~/types";
|
||||
import type { Game, NavigationItem } from "~/types";
|
||||
|
||||
const rawGames = await invoke<string>("fetch_library");
|
||||
const games: Array<Game> = JSON.parse(rawGames);
|
||||
const games: Array<Game> = await invoke("fetch_library");
|
||||
const icons = await Promise.all(games.map((e) => useObject(e.mIconId)));
|
||||
|
||||
const navigation = games.map((e) => {
|
||||
|
||||
@ -318,25 +318,15 @@ import {
|
||||
} from "@headlessui/vue";
|
||||
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
|
||||
import { XCircleIcon } from "@heroicons/vue/24/solid";
|
||||
|
||||
import type { Game } from "@prisma/client";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
import type { GameStatus } from "~/types";
|
||||
import type { Game, GameStatus } from "~/types";
|
||||
|
||||
const route = useRoute();
|
||||
const id = route.params.id;
|
||||
const id = route.params.id.toString();
|
||||
|
||||
const raw: { game: Game; status: GameStatus } = JSON.parse(
|
||||
await invoke<string>("fetch_game", { id: id })
|
||||
);
|
||||
const game = ref(raw.game);
|
||||
const status = ref(raw.status);
|
||||
|
||||
listen(`update_game/${game.value.id}`, (event) => {
|
||||
const payload: { status: GameStatus } = event.payload as any;
|
||||
status.value = payload.status;
|
||||
});
|
||||
const { game: rawGame, status } = await useGame(id);
|
||||
const game = ref(rawGame);
|
||||
|
||||
const bannerUrl = await useObject(game.value.mBannerId);
|
||||
|
||||
|
||||
24
pages/queue.vue
Normal file
24
pages/queue.vue
Normal file
@ -0,0 +1,24 @@
|
||||
<template>
|
||||
<draggable v-model="queue.queue" @end="onEnd">
|
||||
<template #item="{ element }: { element: (typeof queue.value.queue)[0] }">
|
||||
<div class="text-white">
|
||||
{{ element.id }}
|
||||
</div>
|
||||
</template>
|
||||
</draggable>
|
||||
{{ current }}
|
||||
{{ rest }}
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
|
||||
const queue = useQueueState();
|
||||
|
||||
const current = computed(() => queue.value.queue.at(0));
|
||||
const rest = computed(() => queue.value.queue.slice(1));
|
||||
|
||||
async function onEnd(event: { oldIndex: number; newIndex: number }) {
|
||||
await invoke("move_game_in_queue", { oldIndex: event.oldIndex, newIndex: event.newIndex });
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user