cleanup routes names
This commit is contained in:
+2
-1
@@ -2,11 +2,12 @@
|
|||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { RouterView, useRoute } from 'vue-router';
|
import { RouterView, useRoute } from 'vue-router';
|
||||||
import { Sidebar } from './sidebar';
|
import { Sidebar } from './sidebar';
|
||||||
|
import { routeNames } from '@/routes';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
const hideSidebar = computed(() => {
|
const hideSidebar = computed(() => {
|
||||||
return route.name === 'callback' || route.name === 'about';
|
return route.name === routeNames.callback || route.name === routeNames.about;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ClipboardButton } from '@/components';
|
import { ClipboardButton } from '@/components';
|
||||||
import { InformationCircleIcon } from '@heroicons/vue/24/outline';
|
import { InformationCircleIcon } from '@heroicons/vue/24/outline';
|
||||||
|
import { routeNames } from '@/routes';
|
||||||
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -21,7 +22,7 @@ withDefaults(defineProps<Props>(), {
|
|||||||
<img v-if="id" :src="`https://images.evetech.net/types/${id}/icon?size=32`" class="inline-block w-5 h-5 me-1 mt-1" alt="" />
|
<img v-if="id" :src="`https://images.evetech.net/types/${id}/icon?size=32`" class="inline-block w-5 h-5 me-1 mt-1" alt="" />
|
||||||
<template v-if="name">
|
<template v-if="name">
|
||||||
{{ name }}
|
{{ name }}
|
||||||
<RouterLink v-if="id" :to="{ name: 'market-types', params: { type: id } }" class="button btn-icon ms-1 me-1 mt-1" title="Show item info">
|
<RouterLink v-if="id" :to="{ name: routeNames.marketTypes, params: { type: id } }" class="button btn-icon ms-1 me-1 mt-1" title="Show item info">
|
||||||
<InformationCircleIcon />
|
<InformationCircleIcon />
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
<ClipboardButton v-if="!hideCopy" :value="name" />
|
<ClipboardButton v-if="!hideCopy" :value="name" />
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {RouterLink, RouterView} from 'vue-router';
|
import {RouterLink, RouterView} from 'vue-router';
|
||||||
|
import {routeNames} from '@/routes';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<div class="flex border-b-2 border-emerald-500">
|
<div class="flex border-b-2 border-emerald-500">
|
||||||
<RouterLink :to="{name: 'market-types'}" class="tab">
|
<RouterLink :to="{name: routeNames.marketTypes}" class="tab">
|
||||||
<span>Item Info</span>
|
<span>Item Info</span>
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
<RouterLink to="/market/tracking" class="tab">
|
<RouterLink to="/market/tracking" class="tab">
|
||||||
|
|||||||
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|
||||||
import {RouterLink, RouterView} from "vue-router";
|
import {RouterLink, RouterView} from "vue-router";
|
||||||
|
import {routeNames} from '@/routes';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<div class="flex border-b-2 border-emerald-500">
|
<div class="flex border-b-2 border-emerald-500">
|
||||||
<RouterLink :to="{ name: 'list-rule-books' }" class="tab">
|
<RouterLink :to="{ name: routeNames.listRuleBooks }" class="tab">
|
||||||
<span>Rule Books</span>
|
<span>Rule Books</span>
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
<RouterLink to="/characters/rules" class="tab">
|
<RouterLink to="/characters/rules" class="tab">
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {BookmarkIcon, BookmarkSlashIcon, ShoppingCartIcon} from '@heroicons/vue/
|
|||||||
import log from "loglevel";
|
import log from "loglevel";
|
||||||
import {computed, ref, watch} from "vue";
|
import {computed, ref, watch} from "vue";
|
||||||
import {useRoute, useRouter} from "vue-router";
|
import {useRoute, useRouter} from "vue-router";
|
||||||
|
import {routeNames} from "@/routes";
|
||||||
import {computedAsync} from "@vueuse/core";
|
import {computedAsync} from "@vueuse/core";
|
||||||
|
|
||||||
const buyModal = ref<typeof BuyModal>();
|
const buyModal = ref<typeof BuyModal>();
|
||||||
@@ -52,7 +53,7 @@ const view = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
router.push({
|
router.push({
|
||||||
name: 'market-types',
|
name: routeNames.marketTypes,
|
||||||
params: {
|
params: {
|
||||||
type: inputItem.value.id
|
type: inputItem.value.id
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {useDebounceFn} from "@vueuse/core";
|
|||||||
import log from "loglevel";
|
import log from "loglevel";
|
||||||
import {activityTypes, RuleInput, Rules, useRuleBooksStore} from "@/rules";
|
import {activityTypes, RuleInput, Rules, useRuleBooksStore} from "@/rules";
|
||||||
import {PlusIcon, TrashIcon} from "@heroicons/vue/24/outline";
|
import {PlusIcon, TrashIcon} from "@heroicons/vue/24/outline";
|
||||||
|
import {routeNames} from "@/routes";
|
||||||
|
|
||||||
const ruleBookId = ref<string>();
|
const ruleBookId = ref<string>();
|
||||||
const name = ref<string>('');
|
const name = ref<string>('');
|
||||||
@@ -21,7 +22,7 @@ const save = async () => {
|
|||||||
ledgerRefs: ledgerRefs.value,
|
ledgerRefs: ledgerRefs.value,
|
||||||
rules: rules.value
|
rules: rules.value
|
||||||
})
|
})
|
||||||
await router.push({ name: 'edit-rule-book', params: {ruleBookId: created.ruleBookId}})
|
await router.push({ name: routeNames.editRuleBook, params: {ruleBookId: created.ruleBookId}})
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
await update(ruleBookId.value, {
|
await update(ruleBookId.value, {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import {storeToRefs} from "pinia";
|
import {storeToRefs} from "pinia";
|
||||||
import {CharacterLabel, useCharactersStore} from "@/characters";
|
import {CharacterLabel, useCharactersStore} from "@/characters";
|
||||||
import {PencilSquareIcon} from "@heroicons/vue/24/outline";
|
import {PencilSquareIcon} from "@heroicons/vue/24/outline";
|
||||||
|
import {routeNames} from "@/routes";
|
||||||
|
|
||||||
const {characters} = storeToRefs(useCharactersStore());
|
const {characters} = storeToRefs(useCharactersStore());
|
||||||
|
|
||||||
@@ -11,7 +12,7 @@ const {characters} = storeToRefs(useCharactersStore());
|
|||||||
<div class="grid mb-2 mt-4">
|
<div class="grid mb-2 mt-4">
|
||||||
<div v-for="character in characters" :key="character.characterId" class="flex items-center mb-2">
|
<div v-for="character in characters" :key="character.characterId" class="flex items-center mb-2">
|
||||||
<CharacterLabel class="flex grow" :character="character" />
|
<CharacterLabel class="flex grow" :character="character" />
|
||||||
<RouterLink class="btn-icon ms-2" :to="{ name: 'character-rulebook', params: { characterId: character.characterId } }"><PencilSquareIcon /></RouterLink>
|
<RouterLink class="btn-icon ms-2" :to="{ name: routeNames.characterRulebook, params: { characterId: character.characterId } }"><PencilSquareIcon /></RouterLink>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
import {storeToRefs} from "pinia";
|
import {storeToRefs} from "pinia";
|
||||||
import {PencilSquareIcon, TrashIcon} from "@heroicons/vue/24/outline";
|
import {PencilSquareIcon, TrashIcon} from "@heroicons/vue/24/outline";
|
||||||
import {useRuleBooksStore} from "@/rules";
|
import {useRuleBooksStore} from "@/rules";
|
||||||
|
import {routeNames} from "@/routes";
|
||||||
|
|
||||||
const {ruleBooks} = storeToRefs(useRuleBooksStore());
|
const {ruleBooks} = storeToRefs(useRuleBooksStore());
|
||||||
|
|
||||||
@@ -10,11 +11,11 @@ const {ruleBooks} = storeToRefs(useRuleBooksStore());
|
|||||||
<template>
|
<template>
|
||||||
<div class="grid mb-2 mt-4">
|
<div class="grid mb-2 mt-4">
|
||||||
<div class="flex justify-end border-b-1">
|
<div class="flex justify-end border-b-1">
|
||||||
<RouterLink class="button mb-2 ms-2" :to="{ name: 'new-rule-book'}">New Rule Book</RouterLink>
|
<RouterLink class="button mb-2 ms-2" :to="{ name: routeNames.newRuleBook}">New Rule Book</RouterLink>
|
||||||
</div>
|
</div>
|
||||||
<div v-for="ruleBook in ruleBooks" :key="ruleBook.ruleBookId" class="flex items-center mt-2">
|
<div v-for="ruleBook in ruleBooks" :key="ruleBook.ruleBookId" class="flex items-center mt-2">
|
||||||
<span class="flex grow me-2">{{ruleBook.name}}</span>
|
<span class="flex grow me-2">{{ruleBook.name}}</span>
|
||||||
<RouterLink class="btn-icon me-1" :to="{ name: 'edit-rule-book', params: { ruleBookId: ruleBook.ruleBookId } }"><PencilSquareIcon /></RouterLink>
|
<RouterLink class="btn-icon me-1" :to="{ name: routeNames.editRuleBook, params: { ruleBookId: ruleBook.ruleBookId } }"><PencilSquareIcon /></RouterLink>
|
||||||
<button class="btn-icon"><TrashIcon /></button>
|
<button class="btn-icon"><TrashIcon /></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+23
-10
@@ -1,8 +1,19 @@
|
|||||||
import {RouteRecordRaw} from 'vue-router';
|
import {RouteRecordRaw} from 'vue-router';
|
||||||
|
|
||||||
|
export const routeNames = {
|
||||||
|
home: 'home',
|
||||||
|
callback: 'callback',
|
||||||
|
listRuleBooks: 'list-rule-books',
|
||||||
|
newRuleBook: 'new-rule-book',
|
||||||
|
editRuleBook: 'edit-rule-book',
|
||||||
|
characterRulebook: 'character-rulebook',
|
||||||
|
marketTypes: 'market-types',
|
||||||
|
about: 'about',
|
||||||
|
} as const;
|
||||||
|
|
||||||
export const routes: RouteRecordRaw[] = [
|
export const routes: RouteRecordRaw[] = [
|
||||||
{path: '/', name: 'home', component: () => import('@/pages/Index.vue')},
|
{path: '/', name: routeNames.home, component: () => import('@/pages/Index.vue')},
|
||||||
{path: '/callback', name: 'callback', component: () => import('@/pages/Index.vue')},
|
{path: '/callback', name: routeNames.callback, component: () => import('@/pages/Index.vue')},
|
||||||
|
|
||||||
{path: '/ledgers', component: () => import('@/pages/Ledgers.vue'), children: [
|
{path: '/ledgers', component: () => import('@/pages/Ledgers.vue'), children: [
|
||||||
{path: '', component: () => import('@/pages/ledger/ListLedgers.vue')},
|
{path: '', component: () => import('@/pages/ledger/ListLedgers.vue')},
|
||||||
@@ -11,17 +22,19 @@ export const routes: RouteRecordRaw[] = [
|
|||||||
{path: '/rules', component: () => import('@/pages/Rules.vue'), children: [
|
{path: '/rules', component: () => import('@/pages/Rules.vue'), children: [
|
||||||
{path: '', redirect: '/rule-books'},
|
{path: '', redirect: '/rule-books'},
|
||||||
{path: '/rule-books', children: [
|
{path: '/rule-books', children: [
|
||||||
{path: '', name: 'list-rule-books', component: () => import('./pages/rules/ListRuleBooks.vue')},
|
{path: '', name: routeNames.listRuleBooks, component: () => import('@/pages/rules/ListRuleBooks.vue')},
|
||||||
{path: 'new', name: 'new-rule-book', component: () => import('@/pages/rules/EditRuleBook.vue')},
|
{path: 'new', name: routeNames.newRuleBook, component: () => import('@/pages/rules/EditRuleBook.vue')},
|
||||||
{path: ':ruleBookId', name: 'edit-rule-book', component: () => import('@/pages/rules/EditRuleBook.vue')},
|
{path: ':ruleBookId', name: routeNames.editRuleBook, component: () => import('@/pages/rules/EditRuleBook.vue')},
|
||||||
]},
|
]},
|
||||||
{path: '/characters/rules', component: () => import('./pages/rules/ListCharacterRuleBooks.vue')},
|
{path: '/characters/rules', children: [
|
||||||
{path: '/characters/:characterId/rules', name: 'character-rulebook', component: () => import('@/pages/rules/EditCharacterRuleBook.vue')},
|
{path: '', component: () => import('@/pages/rules/ListCharacterRuleBooks.vue')},
|
||||||
|
{path: '/characters/:characterId/rules', name: routeNames.characterRulebook, component: () => import('@/pages/rules/EditCharacterRuleBook.vue')},
|
||||||
|
]}
|
||||||
]},
|
]},
|
||||||
|
|
||||||
{path: '/market', component: () => import('@/pages/Market.vue'), children: [
|
{path: '/market', component: () => import('@/pages/Market.vue'), children: [
|
||||||
{path: '', redirect: '/market/types'},
|
{path: '', redirect: '/market/types'},
|
||||||
{path: 'types/:type?', name: 'market-types', component: () => import('@/pages/market/TypeInfo.vue')},
|
{path: 'types/:type?', name: routeNames.marketTypes, component: () => import('@/pages/market/TypeInfo.vue')},
|
||||||
{path: 'tracking', component: () => import('@/pages/market/Tracking.vue')},
|
{path: 'tracking', component: () => import('@/pages/market/Tracking.vue')},
|
||||||
{path: 'acquisitions', component: () => import('@/pages/market/Acquisitions.vue')},
|
{path: 'acquisitions', component: () => import('@/pages/market/Acquisitions.vue')},
|
||||||
]},
|
]},
|
||||||
@@ -31,5 +44,5 @@ export const routes: RouteRecordRaw[] = [
|
|||||||
{path: '/tools', component: () => import('@/pages/Tools.vue')},
|
{path: '/tools', component: () => import('@/pages/Tools.vue')},
|
||||||
|
|
||||||
{path: '/characters', component: () => import('@/pages/Characters.vue')},
|
{path: '/characters', component: () => import('@/pages/Characters.vue')},
|
||||||
{path: '/about', name: 'about', component: () => import('@/pages/About.vue')},
|
{path: '/about', name: routeNames.about, component: () => import('@/pages/About.vue')},
|
||||||
];
|
] as const;
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {Dropdown} from '@/components';
|
import {Dropdown} from '@/components';
|
||||||
import {RouterLink} from 'vue-router';
|
import {RouterLink} from 'vue-router';
|
||||||
|
import {routeNames} from '@/routes';
|
||||||
|
|
||||||
const links = [
|
const links = [
|
||||||
{name: "Ledger", path: "/ledgers"},
|
{name: "Ledger", path: "/ledgers"},
|
||||||
@@ -28,7 +29,7 @@ const logout = async () => {
|
|||||||
<RouterLink class="sidebar-button py-0.5 px-2" to="/characters">Characters</RouterLink>
|
<RouterLink class="sidebar-button py-0.5 px-2" to="/characters">Characters</RouterLink>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<RouterLink class="sidebar-button py-0.5 px-2" :to="{name: 'about'}">About EVE Online</RouterLink>
|
<RouterLink class="sidebar-button py-0.5 px-2" :to="{name: routeNames.about}">About EVE Online</RouterLink>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="sidebar-button py-0.5 px-2 text-amber-700" @click="logout">Logout</a>
|
<a class="sidebar-button py-0.5 px-2 text-amber-700" @click="logout">Logout</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user