mirror of
https://github.com/versia-pub/frontend.git
synced 2026-03-13 03:29:16 +01:00
chore: ⬆️ Upgrade to new @versia/client
This commit is contained in:
parent
0a157d06f6
commit
f807b05784
71 changed files with 451 additions and 492 deletions
|
|
@ -1,11 +1,11 @@
|
|||
<template>
|
||||
<Timeline type="status" :items="(items as Status[])" :is-loading="isLoading" :has-reached-end="hasReachedEnd"
|
||||
<Timeline type="status" :items="items" :is-loading="isLoading" :has-reached-end="hasReachedEnd"
|
||||
:error="error" :load-next="loadNext" :load-prev="loadPrev" :remove-item="removeItem"
|
||||
:update-item="updateItem" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { Status } from "@versia/client/types";
|
||||
import type { z } from "zod";
|
||||
import Timeline from "./timeline.vue";
|
||||
|
||||
const props = defineProps<{
|
||||
|
|
@ -34,4 +34,4 @@ useListen("note:edit", (updatedNote) => {
|
|||
useListen("composer:send", () => {
|
||||
loadPrev();
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<template>
|
||||
<Timeline type="status" :items="(items as Status[])" :is-loading="isLoading" :has-reached-end="hasReachedEnd"
|
||||
<Timeline type="status" :items="items" :is-loading="isLoading" :has-reached-end="hasReachedEnd"
|
||||
:error="error" :load-next="loadNext" :load-prev="loadPrev" :remove-item="removeItem"
|
||||
:update-item="updateItem" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { Status } from "@versia/client/types";
|
||||
import type { z } from "zod";
|
||||
import { useGlobalTimeline } from "~/composables/GlobalTimeline";
|
||||
import Timeline from "./timeline.vue";
|
||||
|
||||
|
|
@ -31,4 +31,4 @@ useListen("note:edit", (updatedNote) => {
|
|||
useListen("composer:send", () => {
|
||||
loadPrev();
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
<template>
|
||||
<Timeline type="status" :items="(items as Status[])" :is-loading="isLoading" :has-reached-end="hasReachedEnd"
|
||||
<Timeline type="status" :items="items" :is-loading="isLoading" :has-reached-end="hasReachedEnd"
|
||||
:error="error" :load-next="loadNext" :load-prev="loadPrev" :remove-item="removeItem"
|
||||
:update-item="updateItem" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { Status } from "@versia/client/types";
|
||||
import { useHomeTimeline } from "~/composables/HomeTimeline";
|
||||
<script lang="ts" setup>import { useHomeTimeline } from "~/composables/HomeTimeline";
|
||||
import Timeline from "./timeline.vue";
|
||||
import type { z } from "zod";
|
||||
|
||||
const {
|
||||
error,
|
||||
|
|
@ -31,4 +30,4 @@ useListen("note:edit", (updatedNote) => {
|
|||
useListen("composer:send", () => {
|
||||
loadPrev();
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<template>
|
||||
<Timeline type="status" :items="(items as Status[])" :is-loading="isLoading" :has-reached-end="hasReachedEnd"
|
||||
<Timeline type="status" :items="items" :is-loading="isLoading" :has-reached-end="hasReachedEnd"
|
||||
:error="error" :load-next="loadNext" :load-prev="loadPrev" :remove-item="removeItem"
|
||||
:update-item="updateItem" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { Status } from "@versia/client/types";
|
||||
import type { z } from "zod";
|
||||
import { useLocalTimeline } from "~/composables/LocalTimeline";
|
||||
import Timeline from "./timeline.vue";
|
||||
|
||||
|
|
@ -31,4 +31,4 @@ useListen("note:edit", (updatedNote) => {
|
|||
useListen("composer:send", () => {
|
||||
loadPrev();
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
<template>
|
||||
<Timeline type="notification" :items="(items as Notification[])" :is-loading="isLoading"
|
||||
<Timeline type="notification" :items="items" :is-loading="isLoading"
|
||||
:has-reached-end="hasReachedEnd" :error="error" :load-next="loadNext" :load-prev="loadPrev"
|
||||
:remove-item="removeItem" :update-item="updateItem" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { Notification } from "@versia/client/types";
|
||||
import { useNotificationTimeline } from "~/composables/NotificationTimeline";
|
||||
import Timeline from "./timeline.vue";
|
||||
|
||||
|
|
@ -19,4 +18,4 @@ const {
|
|||
removeItem,
|
||||
updateItem,
|
||||
} = useNotificationTimeline(client.value);
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
<template>
|
||||
<Timeline type="status" :items="(items as Status[])" :is-loading="isLoading" :has-reached-end="hasReachedEnd"
|
||||
<Timeline type="status" :items="items" :is-loading="isLoading" :has-reached-end="hasReachedEnd"
|
||||
:error="error" :load-next="loadNext" :load-prev="loadPrev" :remove-item="removeItem"
|
||||
:update-item="updateItem" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { Status } from "@versia/client/types";
|
||||
import { usePublicTimeline } from "~/composables/PublicTimeline";
|
||||
import Timeline from "./timeline.vue";
|
||||
|
||||
|
|
@ -31,4 +30,4 @@ useListen("note:edit", (updatedNote) => {
|
|||
useListen("composer:send", () => {
|
||||
loadPrev();
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,15 +1,16 @@
|
|||
<template>
|
||||
<component :is="itemComponent" :note="type === 'status' ? item : undefined" :notification="type === 'notification' ? item : undefined" @update="$emit('update', $event)"
|
||||
<component :is="itemComponent" :note="type === 'status' ? item : undefined" :notification="type === 'notification' ? item : (undefined as any)" @update="$emit('update', $event)"
|
||||
@delete="$emit('delete', item?.id)" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { Notification, Status } from "@versia/client/types";
|
||||
import type { Notification, Status } from "@versia/client/schemas";
|
||||
import type { z } from "zod";
|
||||
import Thread from "../notes/thread.vue";
|
||||
import NotificationItem from "../notifications/notification.vue";
|
||||
|
||||
const props = defineProps<{
|
||||
item?: Status | Notification;
|
||||
item?: z.infer<typeof Status> | z.infer<typeof Notification>;
|
||||
type: "status" | "notification";
|
||||
}>();
|
||||
|
||||
|
|
@ -17,9 +18,11 @@ const itemComponent = computed(() => {
|
|||
if (props.type === "status") {
|
||||
return Thread;
|
||||
}
|
||||
|
||||
if (props.type === "notification") {
|
||||
return NotificationItem;
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -40,8 +40,9 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { Notification, Status } from "@versia/client/types";
|
||||
import type { Notification, Status } from "@versia/client/schemas";
|
||||
import { useIntersectionObserver } from "@vueuse/core";
|
||||
import type { z } from "zod";
|
||||
import * as m from "~/paraglide/messages.js";
|
||||
import NoPosts from "../errors/NoPosts.vue";
|
||||
import ReachedEnd from "../errors/ReachedEnd.vue";
|
||||
|
|
@ -50,7 +51,7 @@ import { Button } from "../ui/button";
|
|||
import TimelineItem from "./timeline-item.vue";
|
||||
|
||||
const props = defineProps<{
|
||||
items: Status[] | Notification[];
|
||||
items: z.infer<typeof Status>[] | z.infer<typeof Notification>[];
|
||||
type: "status" | "notification";
|
||||
isLoading: boolean;
|
||||
hasReachedEnd: boolean;
|
||||
|
|
@ -58,14 +59,15 @@ const props = defineProps<{
|
|||
loadNext: () => void;
|
||||
loadPrev: () => void;
|
||||
removeItem: (id: string) => void;
|
||||
updateItem: ((item: Status) => void) | ((item: Notification) => void);
|
||||
updateItem:
|
||||
| ((item: z.infer<typeof Status>) => void)
|
||||
| ((item: z.infer<typeof Notification>) => void);
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<(e: "update") => void>();
|
||||
|
||||
const loadMoreTrigger = ref<HTMLElement | null>(null);
|
||||
|
||||
// @ts-expect-error Too complex?
|
||||
useIntersectionObserver(loadMoreTrigger, ([observer]) => {
|
||||
if (observer?.isIntersecting && !props.isLoading && !props.hasReachedEnd) {
|
||||
props.loadNext();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue