chore: ⬆️ Upgrade to new @versia/client

This commit is contained in:
Jesse Wierzbinski 2025-05-26 11:19:15 +02:00
parent 0a157d06f6
commit f807b05784
No known key found for this signature in database
71 changed files with 451 additions and 492 deletions

View file

@ -17,8 +17,10 @@
</template>
<script lang="ts" setup>
import type { Status } from "@versia/client/schemas";
import { Ellipsis, Heart, Quote, Repeat, Reply } from "lucide-vue-next";
import { toast } from "vue-sonner";
import type { z } from "zod";
import * as m from "~/paraglide/messages.js";
import { getLocale } from "~/paraglide/runtime";
import { confirmModalService } from "../modals/composable";
@ -33,7 +35,7 @@ const { noteId } = defineProps<{
noteId: string;
isRemote: boolean;
url: string;
remoteUrl: string;
remoteUrl?: string;
authorId: string;
liked: boolean;
reblogged: boolean;
@ -108,7 +110,10 @@ const reblog = async () => {
const { data } = await client.value.reblogStatus(noteId);
toast.dismiss(id);
toast.success(m.weird_moving_hawk_lift());
useEvent("note:edit", data.reblog || data);
useEvent(
"note:edit",
(data.reblog as z.infer<typeof Status> | null) || data,
);
};
const unreblog = async () => {

View file

@ -6,13 +6,14 @@
</template>
<script lang="ts" setup>
import type { Attachment } from "@versia/client/types";
import type { Attachment } from "@versia/client/schemas";
import type { z } from "zod";
import AudioAttachment from "./attachments/audio.vue";
import FileAttachment from "./attachments/file.vue";
import ImageAttachment from "./attachments/image.vue";
import VideoAttachment from "./attachments/video.vue";
defineProps<{
attachment: Attachment;
attachment: z.infer<typeof Attachment>;
}>();
</script>

View file

@ -6,10 +6,11 @@
</template>
<script lang="ts" setup>
import type { Attachment as AttachmentType } from "@versia/client/types";
import type { Attachment as AttachmentType } from "@versia/client/schemas";
import type { z } from "zod";
import Attachment from "./attachment.vue";
defineProps<{
attachments: AttachmentType[];
attachments: z.infer<typeof AttachmentType>[];
}>();
</script>

View file

@ -5,10 +5,11 @@
</template>
<script lang="ts" setup>
import type { Attachment } from "@versia/client/types";
import type { Attachment } from "@versia/client/schemas";
import type { z } from "zod";
import Base from "./base.vue";
const { attachment } = defineProps<{
attachment: Attachment;
attachment: z.infer<typeof Attachment>;
}>();
</script>

View file

@ -48,8 +48,9 @@
</template>
<script lang="ts" setup>
import type { Attachment } from "@versia/client/types";
import type { Attachment } from "@versia/client/schemas";
import { Captions, Download, File, X } from "lucide-vue-next";
import type { z } from "zod";
import { Button } from "~/components/ui/button";
import { Card } from "~/components/ui/card";
import {
@ -67,7 +68,7 @@ import {
} from "~/components/ui/popover";
const { attachment, lightbox = false } = defineProps<{
attachment: Attachment;
attachment: z.infer<typeof Attachment>;
lightbox?: boolean;
}>();
</script>

View file

@ -8,11 +8,12 @@
</template>
<script lang="ts" setup>
import type { Attachment } from "@versia/client/types";
import type { Attachment } from "@versia/client/schemas";
import { File } from "lucide-vue-next";
import type { z } from "zod";
import Base from "./base.vue";
const { attachment } = defineProps<{
attachment: Attachment;
attachment: z.infer<typeof Attachment>;
}>();
</script>

View file

@ -5,10 +5,11 @@
</template>
<script lang="ts" setup>
import type { Attachment } from "@versia/client/types";
import type { Attachment } from "@versia/client/schemas";
import type { z } from "zod";
import Base from "./base.vue";
const { attachment } = defineProps<{
attachment: Attachment;
attachment: z.infer<typeof Attachment>;
}>();
</script>

View file

@ -5,10 +5,11 @@
</template>
<script lang="ts" setup>
import type { Attachment } from "@versia/client/types";
import type { Attachment } from "@versia/client/schemas";
import type { z } from "zod";
import Base from "./base.vue";
const { attachment } = defineProps<{
attachment: Attachment;
attachment: z.infer<typeof Attachment>;
}>();
</script>

View file

@ -13,7 +13,8 @@
</template>
<script lang="ts" setup>
import type { Attachment, Emoji, Status } from "@versia/client/types";
import type { Attachment, CustomEmoji, Status } from "@versia/client/schemas";
import type { z } from "zod";
import Attachments from "./attachments.vue";
import ContentWarning from "./content-warning.vue";
import Note from "./note.vue";
@ -23,9 +24,9 @@ import Prose from "./prose.vue";
const { content, plainContent, sensitive, contentWarning } = defineProps<{
plainContent?: string;
content: string;
quote?: NonNullable<Status["quote"]>;
emojis: Emoji[];
attachments: Attachment[];
quote?: NonNullable<z.infer<typeof Status.shape.quote>>;
emojis: z.infer<typeof CustomEmoji>[];
attachments: z.infer<typeof Attachment>[];
sensitive: boolean;
contentWarning?: string;
}>();

View file

@ -44,12 +44,13 @@
<script lang="ts" setup>
import { cn } from "@/lib/utils";
import type { Account, StatusVisibility } from "@versia/client/types";
import type { Account, Status } from "@versia/client/schemas";
import type {
UseTimeAgoMessages,
UseTimeAgoUnitNamesDefault,
} from "@vueuse/core";
import { AtSign, Globe, Lock, LockOpen } from "lucide-vue-next";
import type { z } from "zod";
import { getLocale } from "~/paraglide/runtime";
import Avatar from "../profiles/avatar.vue";
import SmallCard from "../profiles/small-card.vue";
@ -61,11 +62,11 @@ import {
const { createdAt, noteUrl, author, authorUrl } = defineProps<{
cornerAvatar?: string;
visibility: StatusVisibility;
visibility: z.infer<typeof Status.shape.visibility>;
noteUrl: string;
createdAt: Date;
smallLayout?: boolean;
author: Account;
author: z.infer<typeof Account>;
authorUrl: string;
}>();

View file

@ -26,7 +26,7 @@ const { authorId, noteId } = defineProps<{
apiNoteString: string;
isRemote: boolean;
url: string;
remoteUrl: string;
remoteUrl?: string;
authorId: string;
noteId: string;
}>();
@ -102,7 +102,7 @@ const _delete = async () => {
<Link />
{{ m.ago_new_pelican_drip() }}
</DropdownMenuItem>
<DropdownMenuItem as="button" v-if="isRemote" @click="copyText(remoteUrl)">
<DropdownMenuItem as="button" v-if="isRemote && remoteUrl" @click="copyText(remoteUrl)">
<Link />
{{ m.solid_witty_zebra_walk() }}
</DropdownMenuItem>

View file

@ -45,7 +45,7 @@
:content="noteToUse.content"
:quote="note.quote ?? undefined"
:attachments="noteToUse.media_attachments"
:plain-content="noteToUse.plain_content ?? undefined"
:plain-content="noteToUse.text ?? undefined"
:emojis="noteToUse.emojis"
:sensitive="noteToUse.sensitive"
:content-warning="noteToUse.spoiler_text"
@ -58,7 +58,7 @@
:url="url"
:api-note-string="JSON.stringify(noteToUse, null, 4)"
:reblog-count="noteToUse.reblogs_count"
:remote-url="noteToUse.url"
:remote-url="noteToUse.url ?? undefined"
:is-remote="isRemote"
:author-id="noteToUse.account.id"
@edit="useEvent('composer:edit', noteToUse)"
@ -75,15 +75,18 @@
<script setup lang="ts">
import { cn } from "@/lib/utils";
import type { Status } from "@versia/client/types";
import type { Status } from "@versia/client/schemas";
import type { z } from "zod";
import { Card, CardContent, CardFooter, CardHeader } from "../ui/card";
import Actions from "./actions.vue";
import Content from "./content.vue";
import Header from "./header.vue";
import ReblogHeader from "./reblog-header.vue";
type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
const { note } = defineProps<{
note: Status;
note: PartialBy<z.infer<typeof Status>, "reblog" | "quote">;
hideActions?: boolean;
smallLayout?: boolean;
contentUnderUsername?: boolean;
@ -92,7 +95,11 @@ const { note } = defineProps<{
}>();
// Notes can be reblogs, in which case the actual thing to render is inside the reblog property
const noteToUse = computed(() => (note.reblog ? note.reblog : note));
const noteToUse = computed(() =>
note.reblog
? (note.reblog as z.infer<typeof Status>)
: (note as z.infer<typeof Status>),
);
const url = wrapUrl(`/@${noteToUse.value.account.acct}/${noteToUse.value.id}`);
const accountUrl = wrapUrl(`/@${noteToUse.value.account.acct}`);

View file

@ -10,8 +10,9 @@
</template>
<script lang="ts" setup>
import type { Emoji } from "@versia/client/types";
import type { CustomEmoji } from "@versia/client/schemas";
import { Repeat } from "lucide-vue-next";
import type { z } from "zod";
import * as m from "~/paraglide/messages.js";
import Avatar from "../profiles/avatar.vue";
import { Card } from "../ui/card";
@ -19,7 +20,7 @@ import { Card } from "../ui/card";
const { url } = defineProps<{
avatar: string;
displayName: string;
emojis: Emoji[];
emojis: z.infer<typeof CustomEmoji>[];
url: string;
}>();

View file

@ -17,11 +17,12 @@
</template>
<script lang="ts" setup>
import type { Status } from "@versia/client/types";
import type { Status } from "@versia/client/schemas";
import type { z } from "zod";
import Note from "./note.vue";
const { note } = defineProps<{
note: Status;
note: z.infer<typeof Status>;
}>();
const parent = useNote(client, note.in_reply_to_id);