mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-11-17 18:52:06 +00:00
chore: navigate to inspect details page when pressing button
This commit is contained in:
@@ -1,16 +1,21 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Button from "primevue/button";
|
import Button from "primevue/button";
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
import IconArrowLeft from "./icons/IconArrowLeft.vue";
|
import IconArrowLeft from "./icons/IconArrowLeft.vue";
|
||||||
import IconGear from "./icons/IconGear.vue";
|
import IconGear from "./icons/IconGear.vue";
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
function onClickBack() {
|
||||||
|
router.back();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<header class="header">
|
<header class="header">
|
||||||
<div class="header-section left">
|
<div class="header-section left">
|
||||||
<Button variant="text" severity="secondary" aria-label="Back">
|
<Button variant="text" severity="secondary" aria-label="Back" @click="onClickBack">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<IconArrowLeft class="icon" />
|
<IconArrowLeft class="icon" />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
export const PAGE = {
|
export const PAGE = {
|
||||||
HOME: "Home",
|
HOME: "Home",
|
||||||
INSPECT_ZONE: "Inspect zone",
|
INSPECT: {
|
||||||
|
SELECT_ZONE: "Inspect zone",
|
||||||
|
ZONE_DETAILS: "Zone details",
|
||||||
|
},
|
||||||
OPTIONS: "Options",
|
OPTIONS: "Options",
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,12 +1,24 @@
|
|||||||
import { createRouter, createWebHashHistory, type RouteRecordRaw } from "vue-router";
|
import { createRouter, createWebHashHistory, type RouteRecordRaw } from "vue-router";
|
||||||
import { PAGE } from "./Page";
|
import { PAGE } from "./Page";
|
||||||
import ZoneInspector from "@/view/inspect/ZoneInspector.vue";
|
import ZoneInspector from "@/view/inspect/ZoneInspector.vue";
|
||||||
|
import InspectDetails from "@/view/inspect_details/InspectDetails.vue";
|
||||||
|
|
||||||
const ROUTES: RouteRecordRaw[] = [
|
const ROUTES: RouteRecordRaw[] = [
|
||||||
{
|
{
|
||||||
path: "/",
|
path: "/",
|
||||||
name: PAGE.INSPECT_ZONE,
|
children: [
|
||||||
component: ZoneInspector,
|
{
|
||||||
|
path: "",
|
||||||
|
name: PAGE.INSPECT.SELECT_ZONE,
|
||||||
|
component: ZoneInspector,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: ":zoneName",
|
||||||
|
name: PAGE.INSPECT.ZONE_DETAILS,
|
||||||
|
component: InspectDetails,
|
||||||
|
props: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import { computed, ref, watch } from "vue";
|
|||||||
import type { CommonAssetType, ZoneAssetsDto } from "@/native/AssetBinds";
|
import type { CommonAssetType, ZoneAssetsDto } from "@/native/AssetBinds";
|
||||||
import { webviewBinds } from "@/native";
|
import { webviewBinds } from "@/native";
|
||||||
import { getAssetTypeNameCapitalized } from "@/utils/AssetTypeName";
|
import { getAssetTypeNameCapitalized } from "@/utils/AssetTypeName";
|
||||||
|
import { useRouter } from "vue-router";
|
||||||
|
import { PAGE } from "@/router/Page";
|
||||||
|
|
||||||
const zoneStore = useZoneStore();
|
const zoneStore = useZoneStore();
|
||||||
|
|
||||||
@@ -77,6 +79,18 @@ const selectedZoneDetails = computed<ZoneDto | null>(
|
|||||||
() => zoneStore.loadedZones.find((zone) => zone.name === props.selectedZone) ?? null,
|
() => zoneStore.loadedZones.find((zone) => zone.name === props.selectedZone) ?? null,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
function onClickShowAssets() {
|
||||||
|
if (!props.selectedZone) return;
|
||||||
|
|
||||||
|
router.push({
|
||||||
|
name: PAGE.INSPECT.ZONE_DETAILS,
|
||||||
|
params: {
|
||||||
|
zoneName: props.selectedZone,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.selectedZone,
|
() => props.selectedZone,
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
@@ -95,7 +109,7 @@ watch(
|
|||||||
<template>
|
<template>
|
||||||
<div class="zone-details">
|
<div class="zone-details">
|
||||||
<h2>{{ selectedZone ?? "No zone selected" }}</h2>
|
<h2>{{ selectedZone ?? "No zone selected" }}</h2>
|
||||||
<Button label="Show assets" :disabled="!selectedZone" />
|
<Button label="Show assets" :disabled="!selectedZone" @click="onClickShowAssets" />
|
||||||
<div v-if="selectedZoneDetails" class="zone-tags">
|
<div v-if="selectedZoneDetails" class="zone-tags">
|
||||||
<Tag :value="selectedZoneDetails.game" />
|
<Tag :value="selectedZoneDetails.game" />
|
||||||
<Tag :value="selectedZoneDetails.platform" />
|
<Tag :value="selectedZoneDetails.platform" />
|
||||||
|
|||||||
9
src/ModManUi/src/view/inspect_details/InspectDetails.vue
Normal file
9
src/ModManUi/src/view/inspect_details/InspectDetails.vue
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
defineProps<{
|
||||||
|
zoneName: string;
|
||||||
|
}>();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="inspect-details"></div>
|
||||||
|
</template>
|
||||||
Reference in New Issue
Block a user