@@ -11,7 +11,7 @@ import ButtonShelf from '@/components/generic/ButtonShelf.vue';
1111import GenericModal from ' @/components/generic/GenericModal.vue' ;
1212import { useMessages } from ' @/composables/messages' ;
1313import { $t } from ' @/i18n' ;
14- import { ArrowBackIcon , HistoryIcon , NoContentIcon } from ' @/icons' ;
14+ import { ArchiveIcon , ArrowBackIcon , NoContentIcon } from ' @/icons' ;
1515import { useStateStore } from ' @/stores' ;
1616import { utcToDateTimeString } from ' @/utils' ;
1717import { NButton , NEmpty , NFlex , NIcon , NSpin } from ' naive-ui' ;
@@ -40,7 +40,7 @@ const showModal = ref(false);
4040const loading = ref (false );
4141const selectedContent = ref <AnyContentRead >();
4242const archiveItems = ref <AnyContentArchiveItem []>([]);
43- const title = ref ($t (' contents.archiveWidgetTitle ' ));
43+ const title = ref ($t (' contents.archive.widgetTitle ' ));
4444
4545function getTsDistanceMs(utcStr1 : string , utcStr2 : string ) {
4646 return Math .ceil (Math .abs (new Date (utcStr1 ).getTime () - new Date (utcStr2 ).getTime ()));
@@ -111,7 +111,7 @@ async function handleItemClick(archiveItem: AnyContentArchiveItem) {
111111 const { data, error } = await GET (' /contents/{id}' , { params: { path: { id: archiveItem .id } } });
112112 if (! error ) {
113113 selectedContent .value = data ;
114- title .value = archiveItem .createdAtStr ?? $t (' contents.archiveWidgetTitle ' );
114+ title .value = archiveItem .createdAtStr ?? $t (' contents.archive.widgetTitle ' );
115115 }
116116 loading .value = false ;
117117}
@@ -124,33 +124,37 @@ async function restoreArchivedContent(archivedContent: AnyContentRead) {
124124 });
125125 if (! error ) {
126126 emit (' restore' , data );
127- message .success ($t (' contents.msgRestored' ));
127+ message .success ($t (' contents.archive. msgRestored' ));
128128 }
129129 loading .value = false ;
130130 showModal .value = false ;
131131}
132132
133133function handleBackToOverview() {
134134 selectedContent .value = undefined ;
135- title .value = $t (' contents.archiveWidgetTitle ' );
135+ title .value = $t (' contents.archive.widgetTitle ' );
136136}
137137
138138function cleanup() {
139139 selectedContent .value = undefined ;
140140 archiveItems .value = [];
141- title .value = $t (' contents.archiveWidgetTitle ' );
141+ title .value = $t (' contents.archive.widgetTitle ' );
142142}
143143 </script >
144144
145145<template >
146- <n-button v-bind =" $attrs" @click.stop.prevent =" handleWidgetClick" >
147- {{ $t('contents.archiveWidgetTitle') }}
146+ <n-button
147+ v-bind =" $attrs"
148+ :title =" $t('contents.archive.widgetTip')"
149+ @click.stop.prevent =" handleWidgetClick"
150+ >
151+ {{ $t('contents.archive.widgetTitle') }}
148152 </n-button >
149153
150154 <generic-modal
151155 v-model:show =" showModal"
152156 :title =" title"
153- :icon =" HistoryIcon "
157+ :icon =" ArchiveIcon "
154158 width =" wide"
155159 @after-enter =" loadArchiveData"
156160 @after-leave =" cleanup"
@@ -177,10 +181,11 @@ function cleanup() {
177181 />
178182 </div >
179183 <template v-else-if =" ! selectedContent " >
180- <n-flex v-if = " archiveItems?.length > 1 " vertical size =" large" >
184+ <n-flex vertical size =" large" >
181185 <template v-for =" item in archiveItems " :key =" item .id " >
182- <n-button v-if =" !item.archived" secondary disabled >
183- {{ $t('common.today') }}
186+ <n-button v-if =" !item.archived" dashed disabled >
187+ {{ item.createdAtStr }}
188+ ({{ $t('common.latest') }})
184189 </n-button >
185190 <n-button v-else secondary @click =" handleItemClick(item)" >
186191 {{ item.createdAtStr }}
@@ -190,11 +195,15 @@ function cleanup() {
190195 class =" time-gap translucent text-tiny"
191196 :style =" { lineHeight: 12 + item.distanceRel * 120 + 'px' }"
192197 >
193- {{ item.distanceStr }}
198+ ~ {{ item.distanceStr }}
194199 </div >
195200 </template >
196201 </n-flex >
197- <n-empty v-else-if =" !loading" :description =" $t('contents.msgNoArchivedContents')" >
202+ <n-empty
203+ v-if =" !loading"
204+ :description =" $t('contents.archive.msgNoArchivedContents')"
205+ class =" mt-lg"
206+ >
198207 <template #icon >
199208 <n-icon :component =" NoContentIcon" />
200209 </template >
@@ -208,7 +217,7 @@ function cleanup() {
208217 type =" warning"
209218 @click =" restoreArchivedContent(selectedContent)"
210219 >
211- {{ $t('contents.restore') }}
220+ {{ $t('contents.archive. restore') }}
212221 </n-button >
213222 <n-button type =" primary" @click =" showModal = false" >
214223 {{ $t('common.close') }}
0 commit comments