feat(ui): overhaul frontend design system and layout

Introduce reusable UI components (AppShell, EntityCard, PageHeader)
Implement Pokemon-themed CSS variables and responsive grids
Refactor all views to adopt the new component structure
This commit is contained in:
2026-04-30 13:52:44 +08:00
parent 0f5ff7be15
commit b39e37ca28
58 changed files with 5203 additions and 463 deletions

4142
DesignGuidelines.html Normal file

File diff suppressed because it is too large Load Diff

BIN
frontend/public/types/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
frontend/public/types/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
frontend/public/types/3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
frontend/public/types/4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
frontend/public/types/5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
frontend/public/types/6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
frontend/public/types/7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
frontend/public/types/8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
frontend/public/types/9.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -1,6 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, onUnmounted, ref } from 'vue'; import { onMounted, onUnmounted, ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import AppShell from './components/AppShell.vue';
import { api, getAuthToken, onAuthTokenChange, setAuthToken, type AuthUser } from './services/api'; import { api, getAuthToken, onAuthTokenChange, setAuthToken, type AuthUser } from './services/api';
const navItems = [ const navItems = [
@@ -54,31 +55,7 @@ onUnmounted(() => {
</script> </script>
<template> <template>
<div class="app-shell"> <AppShell :current-user="currentUser" :nav-items="navItems" @logout="logout">
<header class="topbar"> <RouterView />
<div class="topbar-main"> </AppShell>
<RouterLink class="brand" to="/pokemon">Pokopia Wiki</RouterLink>
<nav class="nav-tabs" aria-label="主导航">
<RouterLink v-for="item in navItems" :key="item.to" :to="item.to">
{{ item.label }}
</RouterLink>
</nav>
</div>
<div class="auth-actions">
<template v-if="currentUser">
<span class="auth-user">{{ currentUser.displayName || currentUser.email }}</span>
<button class="plain-button" type="button" @click="logout">退出</button>
</template>
<template v-else>
<RouterLink to="/login">登录</RouterLink>
<RouterLink to="/register">注册</RouterLink>
</template>
</div>
</header>
<main class="page">
<RouterView />
</main>
</div>
</template> </template>

View File

@@ -0,0 +1,50 @@
<script setup lang="ts">
import type { AuthUser } from '../services/api';
import PokeBallMark from './PokeBallMark.vue';
defineProps<{
currentUser: AuthUser | null;
navItems: Array<{ label: string; to: string }>;
}>();
defineEmits<{
logout: [];
}>();
</script>
<template>
<div class="app-shell">
<header class="site-header">
<div class="container top-nav">
<RouterLink class="brand-lockup" to="/pokemon" aria-label="Pokopia Wiki">
<PokeBallMark size="42px" />
<span>
<span class="pokemon-word">Pokopia</span>
<span class="brand-subtitle">Community Wiki</span>
</span>
</RouterLink>
<nav class="nav-links" aria-label="主导航">
<RouterLink v-for="item in navItems" :key="item.to" :to="item.to">
{{ item.label }}
</RouterLink>
</nav>
<div class="auth-actions">
<template v-if="currentUser">
<span class="auth-user">{{ currentUser.displayName || currentUser.email }}</span>
<button class="ui-button ui-button--ghost ui-button--small" type="button" @click="$emit('logout')">退出</button>
</template>
<template v-else>
<RouterLink class="ui-button ui-button--ghost ui-button--small" to="/login">登录</RouterLink>
<RouterLink class="ui-button ui-button--primary ui-button--small" to="/register">注册</RouterLink>
</template>
</div>
</div>
</header>
<main class="page">
<slot></slot>
</main>
</div>
</template>

View File

@@ -0,0 +1,17 @@
<script setup lang="ts">
defineProps<{
title: string;
}>();
</script>
<template>
<section class="detail-section">
<div class="detail-section__header">
<h2>{{ title }}</h2>
<slot name="actions"></slot>
</div>
<div class="detail-section__body">
<slot></slot>
</div>
</section>
</template>

View File

@@ -0,0 +1,36 @@
<script setup lang="ts">
import PokeBallMark from './PokeBallMark.vue';
defineProps<{
title: string;
subtitle?: string;
to?: string;
marker?: string;
}>();
</script>
<template>
<RouterLink v-if="to" class="entity-card entity-card--link" :to="to">
<span class="entity-card__mark">
<PokeBallMark v-if="!marker" size="30px" />
<span v-else>{{ marker }}</span>
</span>
<div class="entity-card__content">
<span class="entity-card__title">{{ title }}</span>
<span v-if="subtitle" class="entity-card__subtitle">{{ subtitle }}</span>
<slot></slot>
</div>
</RouterLink>
<article v-else class="entity-card">
<span class="entity-card__mark">
<PokeBallMark v-if="!marker" size="30px" />
<span v-else>{{ marker }}</span>
</span>
<div class="entity-card__content">
<span class="entity-card__title">{{ title }}</span>
<span v-if="subtitle" class="entity-card__subtitle">{{ subtitle }}</span>
<slot></slot>
</div>
</article>
</template>

View File

@@ -0,0 +1,5 @@
<template>
<section class="filter-panel" aria-label="筛选">
<slot></slot>
</section>
</template>

View File

@@ -0,0 +1,22 @@
<script setup lang="ts">
defineProps<{
title: string;
subtitle?: string;
}>();
</script>
<template>
<div class="page-header">
<div class="page-header__copy">
<span class="page-kicker">
<slot name="kicker">Pokopia Wiki</slot>
</span>
<h1 class="page-title">{{ title }}</h1>
<p v-if="subtitle" class="page-subtitle">{{ subtitle }}</p>
<slot name="meta"></slot>
</div>
<div v-if="$slots.actions" class="page-header__actions">
<slot name="actions"></slot>
</div>
</div>
</template>

View File

@@ -0,0 +1,14 @@
<script setup lang="ts">
withDefaults(
defineProps<{
size?: string;
}>(),
{
size: '34px'
}
);
</script>
<template>
<span class="pokeball-mark" :style="{ '--ball-size': size }" aria-hidden="true"></span>
</template>

View File

@@ -0,0 +1,43 @@
<script setup lang="ts">
import { onBeforeUnmount, onMounted, ref, watch } from 'vue';
const props = withDefaults(
defineProps<{
variant?: 'info' | 'success' | 'warning' | 'danger';
duration?: number;
}>(),
{
variant: 'info',
duration: 3800
}
);
const visible = ref(true);
let timer: number | null = null;
function clearTimer() {
if (!timer) return;
window.clearTimeout(timer);
timer = null;
}
function scheduleDismiss() {
visible.value = true;
clearTimer();
if (props.duration <= 0) return;
timer = window.setTimeout(() => {
visible.value = false;
}, props.duration);
}
onMounted(scheduleDismiss);
onBeforeUnmount(clearTimer);
watch(() => props.duration, scheduleDismiss);
</script>
<template>
<p class="status-message" :class="[`status-message--${variant}`, { 'status-message--hidden': !visible }]">
<slot></slot>
</p>
</template>

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted, ref } from 'vue'; import { computed, onMounted, ref } from 'vue';
import PageHeader from '../components/PageHeader.vue';
import StatusMessage from '../components/StatusMessage.vue';
import TagsSelect from '../components/TagsSelect.vue'; import TagsSelect from '../components/TagsSelect.vue';
import { import {
api, api,
@@ -467,13 +469,10 @@ onMounted(() => {
</script> </script>
<template> <template>
<section> <section class="page-stack">
<div class="page-header"> <PageHeader title="管理" subtitle="维护 Wiki 数据和系统配置。">
<div> <template #kicker>Admin</template>
<h1 class="page-title">管理</h1> </PageHeader>
<p class="page-subtitle">维护 Wiki 数据和系统配置</p>
</div>
</div>
<div v-if="canEdit" class="tabs" role="tablist" aria-label="管理模块"> <div v-if="canEdit" class="tabs" role="tablist" aria-label="管理模块">
<button v-for="tab in tabs" :key="tab.key" :class="{ active: activeTab === tab.key }" type="button" @click="setTab(tab.key)"> <button v-for="tab in tabs" :key="tab.key" :class="{ active: activeTab === tab.key }" type="button" @click="setTab(tab.key)">
@@ -481,7 +480,7 @@ onMounted(() => {
</button> </button>
</div> </div>
<p v-if="message" class="status">{{ message }}</p> <StatusMessage v-if="message" variant="warning">{{ message }}</StatusMessage>
<section v-if="canEdit && activeTab === 'config'" class="admin-layout"> <section v-if="canEdit && activeTab === 'config'" class="admin-layout">
<form class="detail-section" @submit.prevent="saveConfig"> <form class="detail-section" @submit.prevent="saveConfig">

View File

@@ -1,8 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted, ref } from 'vue'; import { computed, onMounted, ref } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import DetailSection from '../components/DetailSection.vue';
import EditMeta from '../components/EditMeta.vue'; import EditMeta from '../components/EditMeta.vue';
import EntityChips from '../components/EntityChips.vue'; import EntityChips from '../components/EntityChips.vue';
import PageHeader from '../components/PageHeader.vue';
import StatusMessage from '../components/StatusMessage.vue';
import { api, type HabitatDetail } from '../services/api'; import { api, type HabitatDetail } from '../services/api';
const route = useRoute(); const route = useRoute();
@@ -78,25 +81,24 @@ onMounted(async () => {
</script> </script>
<template> <template>
<p v-if="!habitat" class="status">加载中</p> <StatusMessage v-if="!habitat" :duration="0">加载中</StatusMessage>
<section v-else> <section v-else class="page-stack">
<div class="page-header"> <PageHeader :title="habitat.name" subtitle="栖息地详情">
<div> <template #kicker>Habitat Detail</template>
<h1 class="page-title">{{ habitat.name }}</h1> <template #meta>
<p class="page-subtitle">栖息地详情</p>
<EditMeta :entity="habitat" /> <EditMeta :entity="habitat" />
</div> </template>
<RouterLink class="link-button" to="/habitats">返回列表</RouterLink> <template #actions>
</div> <RouterLink class="ui-button ui-button--blue ui-button--small" to="/habitats">返回列表</RouterLink>
</template>
</PageHeader>
<div class="detail-grid"> <div class="detail-grid">
<section class="detail-section"> <DetailSection title="配方列表">
<h2>配方列表</h2>
<EntityChips :items="habitat.recipe" /> <EntityChips :items="habitat.recipe" />
</section> </DetailSection>
<section class="detail-section"> <DetailSection title="可能出现的宝可梦">
<h2>可能出现的宝可梦</h2>
<ul class="row-list appearance-list"> <ul class="row-list appearance-list">
<li v-for="item in pokemonRows" :key="`${item.id}-${item.rarity}`"> <li v-for="item in pokemonRows" :key="`${item.id}-${item.rarity}`">
<RouterLink class="appearance-name" :to="`/pokemon/${item.id}`">{{ item.name }}</RouterLink> <RouterLink class="appearance-name" :to="`/pokemon/${item.id}`">{{ item.name }}</RouterLink>
@@ -120,7 +122,7 @@ onMounted(async () => {
</dl> </dl>
</li> </li>
</ul> </ul>
</section> </DetailSection>
</div> </div>
</section> </section>
</template> </template>

View File

@@ -2,6 +2,9 @@
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import EditMeta from '../components/EditMeta.vue'; import EditMeta from '../components/EditMeta.vue';
import EntityChips from '../components/EntityChips.vue'; import EntityChips from '../components/EntityChips.vue';
import EntityCard from '../components/EntityCard.vue';
import PageHeader from '../components/PageHeader.vue';
import StatusMessage from '../components/StatusMessage.vue';
import { api, type Habitat } from '../services/api'; import { api, type Habitat } from '../services/api';
const habitats = ref<Habitat[]>([]); const habitats = ref<Habitat[]>([]);
@@ -14,22 +17,18 @@ onMounted(async () => {
</script> </script>
<template> <template>
<section> <section class="page-stack">
<div class="page-header"> <PageHeader title="栖息地" subtitle="查看配方和可能出现的宝可梦。">
<div> <template #kicker>Habitats</template>
<h1 class="page-title">栖息地</h1> </PageHeader>
<p class="page-subtitle">查看配方和可能出现的宝可梦</p>
</div>
</div>
<p v-if="loading" class="status">加载中</p> <StatusMessage v-if="loading" :duration="0">加载中</StatusMessage>
<div v-else class="grid"> <div v-else class="entity-grid">
<RouterLink v-for="item in habitats" :key="item.id" class="entity-card" :to="`/habitats/${item.id}`"> <EntityCard v-for="item in habitats" :key="item.id" :title="item.name" :to="`/habitats/${item.id}`" marker="◎">
<h2>{{ item.name }}</h2>
<EditMeta :entity="item" /> <EditMeta :entity="item" />
<EntityChips :items="item.recipe" /> <EntityChips :items="item.recipe" />
<EntityChips :items="item.pokemon ?? []" /> <EntityChips :items="item.pokemon ?? []" />
</RouterLink> </EntityCard>
</div> </div>
</section> </section>
</template> </template>

View File

@@ -1,8 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted, ref } from 'vue'; import { computed, onMounted, ref } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import DetailSection from '../components/DetailSection.vue';
import EditMeta from '../components/EditMeta.vue'; import EditMeta from '../components/EditMeta.vue';
import EntityChips from '../components/EntityChips.vue'; import EntityChips from '../components/EntityChips.vue';
import PageHeader from '../components/PageHeader.vue';
import StatusMessage from '../components/StatusMessage.vue';
import { api, type ItemDetail } from '../services/api'; import { api, type ItemDetail } from '../services/api';
const route = useRoute(); const route = useRoute();
@@ -26,54 +29,50 @@ onMounted(async () => {
</script> </script>
<template> <template>
<p v-if="!item" class="status">加载中</p> <StatusMessage v-if="!item" :duration="0">加载中</StatusMessage>
<section v-else> <section v-else class="page-stack">
<div class="page-header"> <PageHeader :title="item.name" :subtitle="item.usage ? `${item.category.name} · ${item.usage.name}` : item.category.name">
<div> <template #kicker>Item Detail</template>
<h1 class="page-title">{{ item.name }}</h1> <template #meta>
<p class="page-subtitle">{{ item.usage ? `${item.category.name} · ${item.usage.name}` : item.category.name }}</p>
<EditMeta :entity="item" /> <EditMeta :entity="item" />
</div> </template>
<RouterLink class="link-button" to="/items">返回列表</RouterLink> <template #actions>
</div> <RouterLink class="ui-button ui-button--blue ui-button--small" to="/items">返回列表</RouterLink>
</template>
</PageHeader>
<div class="detail-grid"> <div class="detail-grid">
<section class="detail-section"> <DetailSection title="入手方式">
<h2>入手方式</h2>
<EntityChips :items="item.acquisitionMethods" /> <EntityChips :items="item.acquisitionMethods" />
</section> </DetailSection>
<section class="detail-section"> <DetailSection title="自定义">
<h2>自定义</h2>
<div v-if="customization.length" class="chips"> <div v-if="customization.length" class="chips">
<span v-for="entry in customization" :key="entry" class="chip">{{ entry }}</span> <span v-for="entry in customization" :key="entry" class="chip">{{ entry }}</span>
</div> </div>
<p v-else class="meta-line"></p> <p v-else class="meta-line"></p>
</section> </DetailSection>
<section class="detail-section"> <DetailSection title="标签">
<h2>标签</h2>
<EntityChips :items="item.tags" /> <EntityChips :items="item.tags" />
</section> </DetailSection>
<section class="detail-section"> <DetailSection title="材料单信息">
<h2>材料单信息</h2>
<template v-if="item.recipe"> <template v-if="item.recipe">
<RouterLink :to="`/recipes/${item.recipe.id}`">{{ item.recipe.name }}</RouterLink> <RouterLink :to="`/recipes/${item.recipe.id}`">{{ item.recipe.name }}</RouterLink>
<EntityChips :items="item.recipe.materials" /> <EntityChips :items="item.recipe.materials" />
</template> </template>
<p v-else class="meta-line"></p> <p v-else class="meta-line"></p>
</section> </DetailSection>
<section class="detail-section"> <DetailSection title="相关栖息地">
<h2>相关栖息地</h2>
<ul class="row-list"> <ul class="row-list">
<li v-for="habitat in item.relatedHabitats" :key="habitat.id"> <li v-for="habitat in item.relatedHabitats" :key="habitat.id">
<RouterLink :to="`/habitats/${habitat.id}`">{{ habitat.name }}</RouterLink> <RouterLink :to="`/habitats/${habitat.id}`">{{ habitat.name }}</RouterLink>
<span>× {{ habitat.quantity }}</span> <span>× {{ habitat.quantity }}</span>
</li> </li>
</ul> </ul>
</section> </DetailSection>
</div> </div>
</section> </section>
</template> </template>

View File

@@ -2,6 +2,10 @@
import { computed, onMounted, ref, watch } from 'vue'; import { computed, onMounted, ref, watch } from 'vue';
import EditMeta from '../components/EditMeta.vue'; import EditMeta from '../components/EditMeta.vue';
import EntityChips from '../components/EntityChips.vue'; import EntityChips from '../components/EntityChips.vue';
import EntityCard from '../components/EntityCard.vue';
import FilterPanel from '../components/FilterPanel.vue';
import PageHeader from '../components/PageHeader.vue';
import StatusMessage from '../components/StatusMessage.vue';
import TagsSelect from '../components/TagsSelect.vue'; import TagsSelect from '../components/TagsSelect.vue';
import { api, type Item, type Options, type Recipe } from '../services/api'; import { api, type Item, type Options, type Recipe } from '../services/api';
@@ -41,20 +45,17 @@ watch([tab, itemQuery], loadItems);
</script> </script>
<template> <template>
<section> <section class="page-stack">
<div class="page-header"> <PageHeader title="物品 / 材料单" subtitle="按分类、用途、标签查看物品,并浏览材料单。">
<div> <template #kicker>Bag</template>
<h1 class="page-title">物品 / 材料单</h1> </PageHeader>
<p class="page-subtitle">按分类用途标签查看物品并浏览材料单</p>
</div>
</div>
<div class="tabs" role="tablist" aria-label="物品和材料单"> <div class="tabs" role="tablist" aria-label="物品和材料单">
<button :class="{ active: tab === 'items' }" type="button" @click="tab = 'items'">物品</button> <button :class="{ active: tab === 'items' }" type="button" @click="tab = 'items'">物品</button>
<button :class="{ active: tab === 'recipes' }" type="button" @click="tab = 'recipes'">材料单</button> <button :class="{ active: tab === 'recipes' }" type="button" @click="tab = 'recipes'">材料单</button>
</div> </div>
<div v-if="tab === 'items' && options" class="toolbar"> <FilterPanel v-if="tab === 'items' && options">
<div class="field"> <div class="field">
<label for="item-search">搜索</label> <label for="item-search">搜索</label>
<input id="item-search" v-model="search" type="search" placeholder="名称" /> <input id="item-search" v-model="search" type="search" placeholder="名称" />
@@ -88,24 +89,28 @@ watch([tab, itemQuery], loadItems);
<label for="tags">标签</label> <label for="tags">标签</label>
<TagsSelect id="tags" v-model="tagIds" :options="options.itemTags" placeholder="搜索标签" /> <TagsSelect id="tags" v-model="tagIds" :options="options.itemTags" placeholder="搜索标签" />
</div> </div>
</div> </FilterPanel>
<p v-if="loading" class="status">加载中</p> <StatusMessage v-if="loading" :duration="0">加载中</StatusMessage>
<div v-else-if="tab === 'items'" class="grid"> <div v-else-if="tab === 'items'" class="entity-grid">
<RouterLink v-for="item in items" :key="item.id" class="entity-card" :to="`/items/${item.id}`"> <EntityCard
<h2>{{ item.name }}</h2> v-for="item in items"
<p class="meta-line">{{ item.usage ? `${item.category.name} · ${item.usage.name}` : item.category.name }}</p> :key="item.id"
:title="item.name"
:subtitle="item.usage ? `${item.category.name} · ${item.usage.name}` : item.category.name"
:to="`/items/${item.id}`"
marker=""
>
<EditMeta :entity="item" /> <EditMeta :entity="item" />
<EntityChips :items="item.tags" /> <EntityChips :items="item.tags" />
</RouterLink> </EntityCard>
</div> </div>
<div v-else class="grid"> <div v-else class="entity-grid">
<RouterLink v-for="item in recipes" :key="item.id" class="entity-card" :to="`/recipes/${item.id}`"> <EntityCard v-for="item in recipes" :key="item.id" :title="item.name" :to="`/recipes/${item.id}`" marker="▦">
<h2>{{ item.name }}</h2>
<EditMeta :entity="item" /> <EditMeta :entity="item" />
<EntityChips :items="item.materials" /> <EntityChips :items="item.materials" />
</RouterLink> </EntityCard>
</div> </div>
</section> </section>
</template> </template>

View File

@@ -1,6 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'; import { ref } from 'vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import PageHeader from '../components/PageHeader.vue';
import StatusMessage from '../components/StatusMessage.vue';
import { api, setAuthToken } from '../services/api'; import { api, setAuthToken } from '../services/api';
const route = useRoute(); const route = useRoute();
@@ -37,12 +39,9 @@ async function submitLogin() {
<template> <template>
<section class="auth-page"> <section class="auth-page">
<div class="auth-panel"> <div class="auth-panel">
<div class="page-header"> <PageHeader title="登录" subtitle="使用已验证邮箱进入 Pokopia Wiki">
<div> <template #kicker>Trainer Pass</template>
<h1 class="page-title">登录</h1> </PageHeader>
<p class="page-subtitle">使用已验证邮箱进入 Pokopia Wiki</p>
</div>
</div>
<form class="auth-form" @submit.prevent="submitLogin"> <form class="auth-form" @submit.prevent="submitLogin">
<div class="field"> <div class="field">
@@ -55,9 +54,9 @@ async function submitLogin() {
<input id="login-password" v-model="password" autocomplete="current-password" required type="password" /> <input id="login-password" v-model="password" autocomplete="current-password" required type="password" />
</div> </div>
<p v-if="errorMessage" class="auth-message error">{{ errorMessage }}</p> <StatusMessage v-if="errorMessage" variant="danger">{{ errorMessage }}</StatusMessage>
<button class="primary-button" :disabled="busy" type="submit"> <button class="ui-button ui-button--primary" :disabled="busy" type="submit">
{{ busy ? '登录中' : '登录' }} {{ busy ? '登录中' : '登录' }}
</button> </button>
</form> </form>

View File

@@ -1,8 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted, ref } from 'vue'; import { computed, onMounted, ref } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import DetailSection from '../components/DetailSection.vue';
import EditMeta from '../components/EditMeta.vue'; import EditMeta from '../components/EditMeta.vue';
import EntityChips from '../components/EntityChips.vue'; import EntityChips from '../components/EntityChips.vue';
import PageHeader from '../components/PageHeader.vue';
import StatusMessage from '../components/StatusMessage.vue';
import { api, type PokemonDetail } from '../services/api'; import { api, type PokemonDetail } from '../services/api';
const route = useRoute(); const route = useRoute();
@@ -78,30 +81,28 @@ onMounted(async () => {
</script> </script>
<template> <template>
<p v-if="!pokemon" class="status">加载中</p> <StatusMessage v-if="!pokemon" :duration="0">加载中</StatusMessage>
<section v-else> <section v-else class="page-stack">
<div class="page-header"> <PageHeader :title="`#${pokemon.id} ${pokemon.name}`" :subtitle="`喜欢的环境:${pokemon.environment.name}`">
<div> <template #kicker>Pokédex Detail</template>
<h1 class="page-title">#{{ pokemon.id }} {{ pokemon.name }}</h1> <template #meta>
<p class="page-subtitle">喜欢的环境{{ pokemon.environment.name }}</p>
<EditMeta :entity="pokemon" /> <EditMeta :entity="pokemon" />
</div> </template>
<RouterLink class="link-button" to="/pokemon">返回列表</RouterLink> <template #actions>
</div> <RouterLink class="ui-button ui-button--blue ui-button--small" to="/pokemon">返回列表</RouterLink>
</template>
</PageHeader>
<div class="detail-grid"> <div class="detail-grid">
<section class="detail-section"> <DetailSection title="特长">
<h2>特长</h2>
<EntityChips :items="pokemon.skills" /> <EntityChips :items="pokemon.skills" />
</section> </DetailSection>
<section class="detail-section"> <DetailSection title="喜欢的东西">
<h2>喜欢的东西</h2>
<EntityChips :items="pokemon.favorite_things" /> <EntityChips :items="pokemon.favorite_things" />
</section> </DetailSection>
<section class="detail-section"> <DetailSection title="栖息地">
<h2>栖息地</h2>
<ul class="row-list appearance-list"> <ul class="row-list appearance-list">
<li v-for="habitat in habitatRows" :key="`${habitat.id}-${habitat.rarity}`"> <li v-for="habitat in habitatRows" :key="`${habitat.id}-${habitat.rarity}`">
<RouterLink class="appearance-name" :to="`/habitats/${habitat.id}`">{{ habitat.name }}</RouterLink> <RouterLink class="appearance-name" :to="`/habitats/${habitat.id}`">{{ habitat.name }}</RouterLink>
@@ -125,7 +126,7 @@ onMounted(async () => {
</dl> </dl>
</li> </li>
</ul> </ul>
</section> </DetailSection>
</div> </div>
</section> </section>
</template> </template>

View File

@@ -2,6 +2,10 @@
import { computed, onMounted, ref, watch } from 'vue'; import { computed, onMounted, ref, watch } from 'vue';
import EditMeta from '../components/EditMeta.vue'; import EditMeta from '../components/EditMeta.vue';
import EntityChips from '../components/EntityChips.vue'; import EntityChips from '../components/EntityChips.vue';
import EntityCard from '../components/EntityCard.vue';
import FilterPanel from '../components/FilterPanel.vue';
import PageHeader from '../components/PageHeader.vue';
import StatusMessage from '../components/StatusMessage.vue';
import TagsSelect from '../components/TagsSelect.vue'; import TagsSelect from '../components/TagsSelect.vue';
import { api, type Options, type Pokemon } from '../services/api'; import { api, type Options, type Pokemon } from '../services/api';
@@ -39,15 +43,12 @@ watch(query, loadPokemon);
</script> </script>
<template> <template>
<section> <section class="page-stack">
<div class="page-header"> <PageHeader title="Pokemon" subtitle="搜索宝可梦,并按特长、环境、喜欢的东西筛选。">
<div> <template #kicker>Pokédex</template>
<h1 class="page-title">Pokemon</h1> </PageHeader>
<p class="page-subtitle">搜索宝可梦并按特长环境喜欢的东西筛选</p>
</div>
</div>
<div v-if="options" class="toolbar"> <FilterPanel v-if="options">
<div class="field"> <div class="field">
<label for="pokemon-search">搜索</label> <label for="pokemon-search">搜索</label>
<input id="pokemon-search" v-model="search" type="search" placeholder="名字" /> <input id="pokemon-search" v-model="search" type="search" placeholder="名字" />
@@ -86,17 +87,21 @@ watch(query, loadPokemon);
</button> </button>
</div> </div>
</div> </div>
</div> </FilterPanel>
<p v-if="loading" class="status">加载中</p> <StatusMessage v-if="loading" :duration="0">加载中</StatusMessage>
<div v-else class="grid"> <div v-else class="entity-grid">
<RouterLink v-for="item in pokemon" :key="item.id" class="entity-card" :to="`/pokemon/${item.id}`"> <EntityCard
<h2>#{{ item.id }} {{ item.name }}</h2> v-for="item in pokemon"
<p class="meta-line">喜欢的环境{{ item.environment.name }}</p> :key="item.id"
:title="`#${item.id} ${item.name}`"
:subtitle="`喜欢的环境:${item.environment.name}`"
:to="`/pokemon/${item.id}`"
>
<EditMeta :entity="item" /> <EditMeta :entity="item" />
<EntityChips :items="item.skills" /> <EntityChips :items="item.skills" />
<EntityChips :items="item.favorite_things" /> <EntityChips :items="item.favorite_things" />
</RouterLink> </EntityCard>
</div> </div>
</section> </section>
</template> </template>

View File

@@ -1,8 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import DetailSection from '../components/DetailSection.vue';
import EditMeta from '../components/EditMeta.vue'; import EditMeta from '../components/EditMeta.vue';
import EntityChips from '../components/EntityChips.vue'; import EntityChips from '../components/EntityChips.vue';
import PageHeader from '../components/PageHeader.vue';
import StatusMessage from '../components/StatusMessage.vue';
import { api, type RecipeDetail } from '../services/api'; import { api, type RecipeDetail } from '../services/api';
const route = useRoute(); const route = useRoute();
@@ -14,27 +17,26 @@ onMounted(async () => {
</script> </script>
<template> <template>
<p v-if="!recipe" class="status">加载中</p> <StatusMessage v-if="!recipe" :duration="0">加载中</StatusMessage>
<section v-else> <section v-else class="page-stack">
<div class="page-header"> <PageHeader :title="recipe.name" subtitle="材料单详情">
<div> <template #kicker>Recipe Detail</template>
<h1 class="page-title">{{ recipe.name }}</h1> <template #meta>
<p class="page-subtitle">材料单详情</p>
<EditMeta :entity="recipe" /> <EditMeta :entity="recipe" />
</div> </template>
<RouterLink class="link-button" to="/items">返回列表</RouterLink> <template #actions>
</div> <RouterLink class="ui-button ui-button--blue ui-button--small" to="/items">返回列表</RouterLink>
</template>
</PageHeader>
<div class="detail-grid"> <div class="detail-grid">
<section class="detail-section"> <DetailSection title="入手方式">
<h2>入手方式</h2>
<EntityChips :items="recipe.acquisition_methods" /> <EntityChips :items="recipe.acquisition_methods" />
</section> </DetailSection>
<section class="detail-section"> <DetailSection title="需要材料">
<h2>需要材料</h2>
<EntityChips :items="recipe.materials" /> <EntityChips :items="recipe.materials" />
</section> </DetailSection>
</div> </div>
</section> </section>
</template> </template>

View File

@@ -1,5 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'; import { ref } from 'vue';
import PageHeader from '../components/PageHeader.vue';
import StatusMessage from '../components/StatusMessage.vue';
import { api } from '../services/api'; import { api } from '../services/api';
const email = ref(''); const email = ref('');
@@ -32,12 +34,9 @@ async function submitRegister() {
<template> <template>
<section class="auth-page"> <section class="auth-page">
<div class="auth-panel"> <div class="auth-panel">
<div class="page-header"> <PageHeader title="注册" subtitle="创建账号后需要完成邮箱验证">
<div> <template #kicker>Trainer Pass</template>
<h1 class="page-title">注册</h1> </PageHeader>
<p class="page-subtitle">创建账号后需要完成邮箱验证</p>
</div>
</div>
<form class="auth-form" @submit.prevent="submitRegister"> <form class="auth-form" @submit.prevent="submitRegister">
<div class="field"> <div class="field">
@@ -62,10 +61,10 @@ async function submitRegister() {
/> />
</div> </div>
<p v-if="message" class="auth-message">{{ message }}</p> <StatusMessage v-if="message" variant="success">{{ message }}</StatusMessage>
<p v-if="errorMessage" class="auth-message error">{{ errorMessage }}</p> <StatusMessage v-if="errorMessage" variant="danger">{{ errorMessage }}</StatusMessage>
<button class="primary-button" :disabled="busy" type="submit"> <button class="ui-button ui-button--primary" :disabled="busy" type="submit">
{{ busy ? '发送中' : '发送验证邮件' }} {{ busy ? '发送中' : '发送验证邮件' }}
</button> </button>
</form> </form>

View File

@@ -1,6 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import PageHeader from '../components/PageHeader.vue';
import StatusMessage from '../components/StatusMessage.vue';
import { api } from '../services/api'; import { api } from '../services/api';
const route = useRoute(); const route = useRoute();
@@ -31,18 +33,15 @@ onMounted(async () => {
<template> <template>
<section class="auth-page"> <section class="auth-page">
<div class="auth-panel"> <div class="auth-panel">
<div class="page-header"> <PageHeader title="邮箱验证" subtitle="完成验证后即可登录">
<div> <template #kicker>Trainer Pass</template>
<h1 class="page-title">邮箱验证</h1> </PageHeader>
<p class="page-subtitle">完成验证后即可登录</p>
</div>
</div>
<p v-if="busy" class="auth-message">正在验证邮箱</p> <StatusMessage v-if="busy" :duration="0">正在验证邮箱</StatusMessage>
<p v-else-if="message" class="auth-message">{{ message }}</p> <StatusMessage v-else-if="message" variant="success">{{ message }}</StatusMessage>
<p v-else class="auth-message error">{{ errorMessage }}</p> <StatusMessage v-else variant="danger">{{ errorMessage }}</StatusMessage>
<RouterLink class="primary-button" to="/login">去登录</RouterLink> <RouterLink class="ui-button ui-button--primary" to="/login">去登录</RouterLink>
</div> </div>
</section> </section>
</template> </template>