mirror of
https://github.com/versia-pub/frontend.git
synced 2026-03-13 03:29:16 +01:00
feat: 🎨 Design refactor of all pages
This commit is contained in:
parent
9467cef34b
commit
a45c04258e
20 changed files with 407 additions and 267 deletions
|
|
@ -4,7 +4,7 @@ export const useAccount = async (
|
|||
client: Mastodon | null,
|
||||
accountId: string,
|
||||
) => {
|
||||
if (process.server || !client) {
|
||||
if (!client) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import type { Mastodon } from "megalodon";
|
||||
|
||||
export const useAccountSearch = async (client: Mastodon | null, q: string) => {
|
||||
if (process.server || !client) {
|
||||
if (!client) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import type { Status } from "~/types/mastodon/status";
|
|||
|
||||
export const useAccountTimeline = (
|
||||
client: Mastodon | null,
|
||||
id: string | null,
|
||||
id: MaybeRef<string | null>,
|
||||
options: MaybeRef<
|
||||
Partial<{
|
||||
limit?: number | undefined;
|
||||
|
|
@ -21,7 +21,7 @@ export const useAccountTimeline = (
|
|||
loadNext: () => Promise<void>;
|
||||
loadPrev: () => Promise<void>;
|
||||
} => {
|
||||
if (!client || !id) {
|
||||
if (!client) {
|
||||
return {
|
||||
timeline: ref([]),
|
||||
loadNext: async () => {},
|
||||
|
|
@ -35,7 +35,7 @@ export const useAccountTimeline = (
|
|||
let prevMinId: string | undefined = undefined;
|
||||
|
||||
const loadNext = async () => {
|
||||
const response = await client.getAccountStatuses(id, {
|
||||
const response = await client.getAccountStatuses(ref(id).value ?? "", {
|
||||
only_media: false,
|
||||
...ref(options).value,
|
||||
max_id: nextMaxId,
|
||||
|
|
@ -57,7 +57,7 @@ export const useAccountTimeline = (
|
|||
};
|
||||
|
||||
const loadPrev = async () => {
|
||||
const response = await client.getAccountStatuses(id, {
|
||||
const response = await client.getAccountStatuses(ref(id).value ?? "", {
|
||||
only_media: false,
|
||||
...ref(options).value,
|
||||
min_id: prevMinId,
|
||||
|
|
@ -79,11 +79,11 @@ export const useAccountTimeline = (
|
|||
};
|
||||
|
||||
watch(
|
||||
() => ref(options).value,
|
||||
async ({ max_id, min_id }) => {
|
||||
[() => ref(id).value, () => ref(options).value],
|
||||
async ([id, { max_id, min_id }]) => {
|
||||
nextMaxId = max_id;
|
||||
prevMinId = min_id;
|
||||
await loadNext();
|
||||
id && (await loadNext());
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
|
|
|||
|
|
@ -8,5 +8,6 @@ export const useInstance = async (client: Mastodon | null) => {
|
|||
|
||||
return (await client.getInstance()).data as Instance & {
|
||||
banner?: string;
|
||||
lysand_version?: string;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import { Mastodon } from "megalodon";
|
||||
|
||||
export const useMegalodon = async () => {
|
||||
/* if (process.server) {
|
||||
export const useMegalodon = async (disableOnServer = false) => {
|
||||
if (disableOnServer && process.server) {
|
||||
return null;
|
||||
} */
|
||||
}
|
||||
|
||||
const baseUrl = useBaseUrl().value;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import type { Mastodon } from "megalodon";
|
||||
|
||||
export const useNote = async (client: Mastodon | null, noteId: string) => {
|
||||
if (process.server || !client) {
|
||||
if (!client) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue