refactor: ♻️ Use new Versia branding everywhere

This commit is contained in:
Jesse Wierzbinski 2024-08-28 00:23:29 +02:00
parent b734d8ad67
commit cc54e95e92
No known key found for this signature in database
68 changed files with 147 additions and 154 deletions

View file

@ -1,8 +1,8 @@
import type { LysandClient } from "@lysand-org/client";
import type { Account } from "@lysand-org/client/types";
import type { Client } from "@versia/client";
import type { Account } from "@versia/client/types";
export const useAccount = (
client: MaybeRef<LysandClient | null>,
client: MaybeRef<Client | null>,
accountId: MaybeRef<string | null>,
) => {
if (!client) {

View file

@ -1,8 +1,8 @@
import type { LysandClient } from "@lysand-org/client";
import type { Account } from "@lysand-org/client/types";
import type { Client } from "@versia/client";
import type { Account } from "@versia/client/types";
export const useAccountSearch = (
client: MaybeRef<LysandClient | null>,
client: MaybeRef<Client | null>,
q: string,
): Ref<Account[] | null> => {
const output = ref(null as Account[] | null);

View file

@ -1,9 +1,9 @@
import type { LysandClient } from "@lysand-org/client";
import type { Status } from "@lysand-org/client/types";
import type { Client } from "@versia/client";
import type { Status } from "@versia/client/types";
import { type TimelineOptions, useTimeline } from "./Timeline";
export function useAccountTimeline(
client: LysandClient,
client: Client,
accountId: string,
options: Partial<TimelineOptions<Status>> = {},
) {

View file

@ -1,8 +1,8 @@
import type { ApplicationData } from "@lysand-org/client/types";
import type { ApplicationData } from "@versia/client/types";
import { StorageSerializers } from "@vueuse/core";
export const useAppData = () => {
return useLocalStorage<ApplicationData | null>("lysand:app_data", null, {
return useLocalStorage<ApplicationData | null>("versia:app_data", null, {
serializer: StorageSerializers.object,
});
};

View file

@ -1,7 +1,7 @@
import type { LysandClient } from "@lysand-org/client";
import type { RolePermission } from "@lysand-org/client/types";
import type { Client } from "@versia/client";
import type { RolePermission } from "@versia/client/types";
export const useCacheRefresh = (client: MaybeRef<LysandClient | null>) => {
export const useCacheRefresh = (client: MaybeRef<Client | null>) => {
if (import.meta.server) {
return;
}

View file

@ -1,11 +1,11 @@
import { LysandClient, type Token } from "@lysand-org/client";
import { Client, type Token } from "@versia/client";
export const useClient = (
customToken: MaybeRef<Token | null> = null,
): Ref<LysandClient> => {
): Ref<Client> => {
return computed(
() =>
new LysandClient(
new Client(
new URL(useBaseUrl().value),
toValue(customToken)?.access_token ??
identity.value?.tokens.access_token ??

View file

@ -1,5 +1,5 @@
import type { createToaster } from "@ark-ui/vue";
import type { Account, Attachment, Status } from "@lysand-org/client/types";
import type { Account, Attachment, Status } from "@versia/client/types";
import mitt from "mitt";
import type { Identity } from "./Identities";

View file

@ -1,13 +1,11 @@
import type { LysandClient } from "@lysand-org/client";
import type { Client } from "@versia/client";
type ExtendedDescription = {
updated_at: string;
content: string;
};
export const useExtendedDescription = (
client: MaybeRef<LysandClient | null>,
) => {
export const useExtendedDescription = (client: MaybeRef<Client | null>) => {
if (!ref(client).value) {
return ref(null as ExtendedDescription | null);
}

View file

@ -1,9 +1,9 @@
import type { LysandClient } from "@lysand-org/client";
import type { Status } from "@lysand-org/client/types";
import type { Client } from "@versia/client";
import type { Status } from "@versia/client/types";
import { type TimelineOptions, useTimeline } from "./Timeline";
export function useHomeTimeline(
client: LysandClient,
client: Client,
options: Partial<TimelineOptions<Status>> = {},
) {
return useTimeline(client, {

View file

@ -1,10 +1,10 @@
import type { Token } from "@lysand-org/client";
import type { Token } from "@versia/client";
import type {
Account,
Emoji,
Instance,
RolePermission,
} from "@lysand-org/client/types";
} from "@versia/client/types";
import { StorageSerializers, useLocalStorage } from "@vueuse/core";
import { ref, watch } from "vue";
@ -25,7 +25,7 @@ export interface Identity {
* @returns A reactive reference to an array of identities.
*/
function useIdentities(): Ref<Identity[]> {
return useLocalStorage<Identity[]>("lysand:identities", [], {
return useLocalStorage<Identity[]>("versia:identities", [], {
serializer: StorageSerializers.object,
});
}
@ -33,7 +33,7 @@ function useIdentities(): Ref<Identity[]> {
export const identities = useIdentities();
const currentId = useLocalStorage<string | null>(
"lysand:identities:current",
"versia:identities:current",
null,
);

View file

@ -1,11 +1,11 @@
import type { LysandClient } from "@lysand-org/client";
import type { ExtendedDescription, Instance } from "@lysand-org/client/types";
import type { Client } from "@versia/client";
import type { ExtendedDescription, Instance } from "@versia/client/types";
export const useInstance = () => {
return computed(() => identity.value?.instance);
};
export const useInstanceFromClient = (client: MaybeRef<LysandClient>) => {
export const useInstanceFromClient = (client: MaybeRef<Client>) => {
if (!client) {
return ref(null as Instance | null);
}
@ -23,7 +23,7 @@ export const useInstanceFromClient = (client: MaybeRef<LysandClient>) => {
return output;
};
export const useTos = (client: MaybeRef<LysandClient>) => {
export const useTos = (client: MaybeRef<Client>) => {
if (!client) {
return ref(null as ExtendedDescription | null);
}

View file

@ -1,4 +1,4 @@
import type { LysandClient } from "@lysand-org/client";
import type { Client } from "@versia/client";
type SSOProvider = {
id: string;
@ -6,7 +6,7 @@ type SSOProvider = {
icon: string;
};
export const useLinkedSSO = (client: MaybeRef<LysandClient>) => {
export const useLinkedSSO = (client: MaybeRef<Client>) => {
if (!client) {
return ref([] as SSOProvider[]);
}

View file

@ -1,9 +1,9 @@
import type { LysandClient } from "@lysand-org/client";
import type { Status } from "@lysand-org/client/types";
import type { Client } from "@versia/client";
import type { Status } from "@versia/client/types";
import { type TimelineOptions, useTimeline } from "./Timeline";
export function useLocalTimeline(
client: LysandClient,
client: Client,
options: Partial<TimelineOptions<Status>> = {},
) {
return useTimeline(client, {

View file

@ -1,10 +1,7 @@
import type { LysandClient } from "@lysand-org/client";
import type { Status } from "@lysand-org/client/types";
import type { Client } from "@versia/client";
import type { Status } from "@versia/client/types";
export const useNote = (
client: MaybeRef<LysandClient | null>,
noteId: string,
) => {
export const useNote = (client: MaybeRef<Client | null>, noteId: string) => {
if (!ref(client).value) {
return ref(null as Status | null);
}

View file

@ -1,8 +1,8 @@
import type { LysandClient } from "@lysand-org/client";
import type { Context } from "@lysand-org/client/types";
import type { Client } from "@versia/client";
import type { Context } from "@versia/client/types";
export const useNoteContext = (
client: MaybeRef<LysandClient | null>,
client: MaybeRef<Client | null>,
noteId: MaybeRef<string | null>,
) => {
if (!ref(client).value) {

View file

@ -1,10 +1,10 @@
import type { LysandClient } from "@lysand-org/client";
import type { Status } from "@lysand-org/client/types";
import type { Client } from "@versia/client";
import type { Status } from "@versia/client/types";
import { SettingIds, type Settings } from "~/settings";
export const useNoteData = (
noteProp: MaybeRef<Status | undefined>,
client: Ref<LysandClient>,
client: Ref<Client>,
settings: MaybeRef<Settings>,
) => {
const isReply = computed(() => !!toValue(noteProp)?.in_reply_to_id);

View file

@ -1,9 +1,9 @@
import type { LysandClient } from "@lysand-org/client";
import type { Notification } from "@lysand-org/client/types";
import type { Client } from "@versia/client";
import type { Notification } from "@versia/client/types";
import { type TimelineOptions, useTimeline } from "./Timeline";
export function useNotificationTimeline(
client: LysandClient,
client: Client,
options: Partial<TimelineOptions<Notification>> = {},
) {
return useTimeline(client, {

View file

@ -1,4 +1,4 @@
import type { Account, Emoji } from "@lysand-org/client/types";
import type { Account, Emoji } from "@versia/client/types";
import { renderToString } from "vue/server-renderer";
import { SettingIds, type Settings } from "~/settings";
import MentionComponent from "../components/social-elements/notes/mention.vue";

View file

@ -1,9 +1,9 @@
import type { LysandClient } from "@lysand-org/client";
import type { Status } from "@lysand-org/client/types";
import type { Client } from "@versia/client";
import type { Status } from "@versia/client/types";
import { type TimelineOptions, useTimeline } from "./Timeline";
export function usePublicTimeline(
client: LysandClient,
client: Client,
options: Partial<TimelineOptions<Status>> = {},
) {
return useTimeline(client, {

View file

@ -1,8 +1,8 @@
import type { LysandClient } from "@lysand-org/client";
import type { Relationship } from "@lysand-org/client/types";
import type { Client } from "@versia/client";
import type { Relationship } from "@versia/client/types";
export const useRelationship = (
client: MaybeRef<LysandClient | null>,
client: MaybeRef<Client | null>,
accountId: MaybeRef<string | null>,
) => {
const relationship = ref(null as Relationship | null);

View file

@ -1,9 +1,9 @@
import type { LysandClient } from "@lysand-org/client";
import type { Account, Mention } from "@lysand-org/client/types";
import type { Client } from "@versia/client";
import type { Account, Mention } from "@versia/client/types";
export const useResolveMentions = (
mentions: Ref<Mention[]>,
client: LysandClient | null,
client: Client | null,
): Ref<Account[]> => {
if (!client) {
return ref([]);

View file

@ -1,4 +1,4 @@
import type { Instance } from "@lysand-org/client/types";
import type { Instance } from "@versia/client/types";
export const useSSOConfig = (): Ref<Instance["sso"] | null> => {
const instance = useInstance();

View file

@ -1,6 +1,5 @@
import { StorageSerializers } from "@vueuse/core";
import {
type Setting,
type SettingIds,
type Settings,
mergeSettings,
@ -8,7 +7,7 @@ import {
} from "~/settings";
const useSettings = () => {
return useLocalStorage<Settings>("lysand:settings", settingsJson, {
return useLocalStorage<Settings>("versia:settings", settingsJson, {
serializer: {
read(raw) {
const json = StorageSerializers.object.read(raw);

View file

@ -1,18 +1,15 @@
import type { LysandClient, Output } from "@lysand-org/client";
import type { Notification, Status } from "@lysand-org/client/types";
import type { Client, Output } from "@versia/client";
import type { Notification, Status } from "@versia/client/types";
import { useIntervalFn } from "@vueuse/core";
export interface TimelineOptions<T> {
fetchFunction: (
client: LysandClient,
options: object,
) => Promise<Output<T[]>>;
fetchFunction: (client: Client, options: object) => Promise<Output<T[]>>;
updateInterval?: number;
limit?: number;
}
export function useTimeline<T extends Status | Notification>(
client: LysandClient,
client: Client,
options: TimelineOptions<T>,
) {
const items = ref<T[]>([]) as Ref<T[]>;