feat: 🎨 Design refactor of all pages

This commit is contained in:
Jesse Wierzbinski 2024-04-25 19:54:02 -10:00
parent 9467cef34b
commit a45c04258e
No known key found for this signature in database
20 changed files with 407 additions and 267 deletions

View file

@ -4,7 +4,7 @@ export const useAccount = async (
client: Mastodon | null,
accountId: string,
) => {
if (process.server || !client) {
if (!client) {
return null;
}

View file

@ -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;
}

View file

@ -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 },
);

View file

@ -8,5 +8,6 @@ export const useInstance = async (client: Mastodon | null) => {
return (await client.getInstance()).data as Instance & {
banner?: string;
lysand_version?: string;
};
};

View file

@ -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;

View file

@ -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;
}