enhance: click to switch timestamp

This commit is contained in:
fly_mc 2024-10-16 02:17:48 +08:00
parent e481c2ae96
commit 11f6dc9991

View file

@ -26,8 +26,12 @@ SPDX-License-Identifier: AGPL-3.0-only
<div v-if="mock"> <div v-if="mock">
<MkTime :time="note.createdAt" colored/> <MkTime :time="note.createdAt" colored/>
</div> </div>
<MkA v-else :to="notePage(note)"> <MkA v-else @click="toggleDetail()">
<MkTime :time="note.createdAt" colored/> <MkTime
:time="isDetail ? note.createdAt : note.createdAt"
:mode="isDetail ? 'detail' : undefined"
colored
/>
</MkA> </MkA>
<span v-if="note.visibility !== 'public'" style="margin-left: 0.5em;" :title="i18n.ts._visibility[note.visibility]"> <span v-if="note.visibility !== 'public'" style="margin-left: 0.5em;" :title="i18n.ts._visibility[note.visibility]">
<i v-if="note.visibility === 'home'" class="ti ti-home"></i> <i v-if="note.visibility === 'home'" class="ti ti-home"></i>
@ -42,13 +46,18 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { inject } from 'vue'; import { inject, ref } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { notePage } from '@/filters/note.js'; import { notePage } from '@/filters/note.js';
import { userPage } from '@/filters/user.js'; import { userPage } from '@/filters/user.js';
import { defaultStore } from '@/store.js'; import { defaultStore } from '@/store.js';
const isDetail = ref(false);
const toggleDetail = () => {
isDetail.value = !isDetail.value;
};
defineProps<{ defineProps<{
note: Misskey.entities.Note; note: Misskey.entities.Note;
}>(); }>();