refactor (client): stop importing things directly from firefish-js/src

This commit is contained in:
naskya 2024-04-01 13:58:54 +09:00
parent f70c9efe6b
commit 81b9fdf397
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C

View file

@ -8,12 +8,12 @@
<MkPagination <MkPagination
v-else v-else
ref="pagingComponent" ref="pagingComponent"
v-slot="{ items }: { items: NoteEdit[] }" v-slot="{ items }: { items: entities.NoteEdit[] }"
:pagination="pagination" :pagination="pagination"
> >
<div ref="tlEl" class="giivymft noGap"> <div ref="tlEl" class="giivymft noGap">
<XList <XList
v-slot="{ item }: { item: Note }" v-slot="{ item }: { item: entities.Note }"
:items="convertNoteEditsToNotes(items)" :items="convertNoteEditsToNotes(items)"
class="notes" class="notes"
:no-gap="true" :no-gap="true"
@ -42,7 +42,7 @@ import XNote from "@/components/MkNote.vue";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";
import { definePageMetadata } from "@/scripts/page-metadata"; import { definePageMetadata } from "@/scripts/page-metadata";
import icon from "@/scripts/icon"; import icon from "@/scripts/icon";
import type { Note, NoteEdit } from "firefish-js/src/entities"; import type { entities } from "firefish-js";
const pagingComponent = ref<InstanceType<typeof MkPagination>>(); const pagingComponent = ref<InstanceType<typeof MkPagination>>();
@ -66,7 +66,7 @@ definePageMetadata(
})), })),
); );
const note = ref<Note>({} as Note); const note = ref<entities.Note>({} as entities.Note);
const loaded = ref(false); const loaded = ref(false);
onMounted(() => { onMounted(() => {
@ -84,8 +84,8 @@ onMounted(() => {
}); });
}); });
function convertNoteEditsToNotes(noteEdits: NoteEdit[]) { function convertNoteEditsToNotes(noteEdits: entities.NoteEdit[]) {
const now: NoteEdit = { const now: entities.NoteEdit = {
id: "EditionNow", id: "EditionNow",
noteId: note.value.id, noteId: note.value.id,
updatedAt: note.value.createdAt, updatedAt: note.value.createdAt,
@ -96,7 +96,9 @@ function convertNoteEditsToNotes(noteEdits: NoteEdit[]) {
emojis: note.value.emojis, emojis: note.value.emojis,
}; };
return [now].concat(noteEdits).map((noteEdit: NoteEdit, index, arr): Note => { return [now]
.concat(noteEdits)
.map((noteEdit: entities.NoteEdit, index, arr): entities.Note => {
return Object.assign({}, note.value, { return Object.assign({}, note.value, {
historyId: noteEdit.id, historyId: noteEdit.id,
// Conversion from updatedAt to createdAt // Conversion from updatedAt to createdAt