Skip to content

Commit

Permalink
fixed detail view
Browse files Browse the repository at this point in the history
  • Loading branch information
zurdi15 committed Jul 3, 2024
1 parent 040fd83 commit 1a0a06d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
7 changes: 6 additions & 1 deletion frontend/src/components/common/Game/Dialog/MatchRom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import storeRoms, { type SimpleRom } from "@/stores/roms";
import type { Events } from "@/types/emitter";
import type { Emitter } from "mitt";
import { inject, onBeforeUnmount, ref } from "vue";
import { useRoute } from "vue-router";
import { useDisplay, useTheme } from "vuetify";
type MatchedSource = {
Expand All @@ -21,6 +22,7 @@ const show = ref(false);
const rom = ref<SimpleRom | null>(null);
const romsStore = storeRoms();
const searching = ref(false);
const route = useRoute();
const searchTerm = ref("");
const theme = useTheme();
const searchBy = ref("Name");
Expand Down Expand Up @@ -169,7 +171,10 @@ async function updateRom(selectedRom: SearchRomSchema) {
icon: "mdi-check-bold",
color: "green",
});
romsStore.update(data);
romsStore.update(data as SimpleRom);
if (route.name == "rom") {
romsStore.currentRom = data;
}
})
.catch((error) => {
emitter?.emit("snackbarShow", {
Expand Down
12 changes: 9 additions & 3 deletions frontend/src/views/GameDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import type { Events } from "@/types/emitter";
import type { Emitter } from "mitt";
import { storeToRefs } from "pinia";
import { inject, onBeforeMount, ref, watch } from "vue";
import { useRoute } from "vue-router";
import { onBeforeRouteLeave, useRoute } from "vue-router";
import { useDisplay } from "vuetify";
// Props
Expand Down Expand Up @@ -82,6 +82,10 @@ onBeforeMount(async () => {
downloadStore.clear();
});
onBeforeRouteLeave(() => {
currentRom.value = null;
});
watch(
() => route.fullPath,
async () => {
Expand Down Expand Up @@ -180,8 +184,10 @@ watch(
<v-window disabled v-model="tab" class="py-2">
<v-window-item value="details">
<v-row no-gutters :class="{ 'mx-2': mdAndUp }">
<file-info :rom="currentRom" :platform="platform" />
<game-info :rom="currentRom" />
<v-col>
<file-info :rom="currentRom" :platform="platform" />
<game-info :rom="currentRom" />
</v-col>
</v-row>
</v-window-item>
<v-window-item value="saves">
Expand Down

0 comments on commit 1a0a06d

Please sign in to comment.