@@ -3,8 +3,9 @@ import type { ClientSegmentRead } from '@/api';
33import HydratedHtml from ' @/components/generic/HydratedHtml.vue' ;
44import IconHeading from ' @/components/generic/IconHeading.vue' ;
55import { usePlatformData } from ' @/composables/platformData' ;
6- import { useStateStore } from ' @/stores' ;
7- import { NSpin } from ' naive-ui' ;
6+ import { EditIcon } from ' @/icons' ;
7+ import { useAuthStore , useStateStore } from ' @/stores' ;
8+ import { NButton , NIcon , NSpin } from ' naive-ui' ;
89import { ref , watchEffect , type Component } from ' vue' ;
910import { useRouter } from ' vue-router' ;
1011
@@ -14,12 +15,17 @@ const props = defineProps<{
1415}>();
1516
1617const state = useStateStore ();
18+ const auth = useAuthStore ();
1719const loading = ref (false );
1820const { getSegment } = usePlatformData ();
1921const router = useRouter ();
2022
2123const page = ref <ClientSegmentRead >();
2224
25+ function handleEditClick() {
26+ router .push ({ name: ' adminInfoPages' , hash: page .value ? ` #page=${page .value .id } ` : undefined });
27+ }
28+
2329watchEffect (async () => {
2430 loading .value = true ;
2531 page .value = await getSegment (props .pageKey , state .locale );
@@ -35,6 +41,18 @@ watchEffect(async () => {
3541 <template v-else-if =" page " >
3642 <icon-heading v-if =" page.title" level =" 1" :icon =" icon" >
3743 {{ page.title }}
44+ <n-button
45+ v-if =" !!auth.user?.isSuperuser"
46+ circle
47+ quaternary
48+ size =" small"
49+ :title =" $t('admin.infoPages.editPage')"
50+ @click =" handleEditClick"
51+ >
52+ <template #icon >
53+ <n-icon :component =" EditIcon" />
54+ </template >
55+ </n-button >
3856 </icon-heading >
3957 <div class =" content-block" style =" padding : 1.2rem " >
4058 <hydrated-html :html =" page.html" />
0 commit comments