you know what let's just change frontend framework again
This commit is contained in:
parent
c8cd483d20
commit
0d47f1fb01
115 changed files with 4407 additions and 10824 deletions
23
Foxnouns.Frontend/src/lib/api/models/auth.ts
Normal file
23
Foxnouns.Frontend/src/lib/api/models/auth.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
import type { User } from "./user";
|
||||
|
||||
export type AuthResponse = {
|
||||
user: User;
|
||||
token: string;
|
||||
expires_at: string;
|
||||
};
|
||||
|
||||
export type CallbackResponse = {
|
||||
has_account: boolean;
|
||||
ticket?: string;
|
||||
remote_username?: string;
|
||||
user?: User;
|
||||
token?: string;
|
||||
expires_at?: string;
|
||||
};
|
||||
|
||||
export type AuthUrls = {
|
||||
email_enabled: boolean;
|
||||
discord?: string;
|
||||
google?: string;
|
||||
tumblr?: string;
|
||||
};
|
4
Foxnouns.Frontend/src/lib/api/models/index.ts
Normal file
4
Foxnouns.Frontend/src/lib/api/models/index.ts
Normal file
|
@ -0,0 +1,4 @@
|
|||
export * from "./meta";
|
||||
export * from "./user";
|
||||
export * from "./member";
|
||||
export * from "./auth";
|
9
Foxnouns.Frontend/src/lib/api/models/member.ts
Normal file
9
Foxnouns.Frontend/src/lib/api/models/member.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import type { Field, PartialMember, PartialUser, PrideFlag } from "./user";
|
||||
|
||||
export type Member = PartialMember & {
|
||||
fields: Field[];
|
||||
flags: PrideFlag[];
|
||||
links: string[];
|
||||
|
||||
user: PartialUser;
|
||||
};
|
19
Foxnouns.Frontend/src/lib/api/models/meta.ts
Normal file
19
Foxnouns.Frontend/src/lib/api/models/meta.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
export type Meta = {
|
||||
repository: string;
|
||||
version: string;
|
||||
hash: string;
|
||||
users: {
|
||||
total: number;
|
||||
active_month: number;
|
||||
active_week: number;
|
||||
active_day: number;
|
||||
};
|
||||
members: number;
|
||||
limits: Limits;
|
||||
};
|
||||
|
||||
export type Limits = {
|
||||
member_count: number;
|
||||
bio_length: number;
|
||||
custom_preferences: number;
|
||||
};
|
139
Foxnouns.Frontend/src/lib/api/models/user.ts
Normal file
139
Foxnouns.Frontend/src/lib/api/models/user.ts
Normal file
|
@ -0,0 +1,139 @@
|
|||
export type PartialUser = {
|
||||
id: string;
|
||||
username: string;
|
||||
display_name: string | null;
|
||||
avatar_url: string | null;
|
||||
custom_preferences: Record<string, CustomPreference>;
|
||||
};
|
||||
|
||||
export type User = PartialUser & {
|
||||
bio: string | null;
|
||||
member_title: string | null;
|
||||
links: string[];
|
||||
names: FieldEntry[];
|
||||
pronouns: Pronoun[];
|
||||
fields: Field[];
|
||||
flags: PrideFlag[];
|
||||
role: "USER" | "MODERATOR" | "ADMIN";
|
||||
};
|
||||
|
||||
export type MeUser = UserWithMembers & {
|
||||
auth_methods: AuthMethod[];
|
||||
member_list_hidden: boolean;
|
||||
last_active: string;
|
||||
last_sid_reroll: string;
|
||||
};
|
||||
|
||||
export type UserWithMembers = User & { members: PartialMember[] };
|
||||
|
||||
export type UserWithHiddenFields = User & {
|
||||
auth_methods?: unknown[];
|
||||
member_list_hidden: boolean;
|
||||
last_active: string;
|
||||
};
|
||||
|
||||
export type UserSettings = {
|
||||
dark_mode: boolean | null;
|
||||
};
|
||||
|
||||
export type PartialMember = {
|
||||
id: string;
|
||||
name: string;
|
||||
display_name: string;
|
||||
bio: string | null;
|
||||
avatar_url: string | null;
|
||||
names: FieldEntry[];
|
||||
pronouns: Pronoun[];
|
||||
unlisted: boolean | null;
|
||||
};
|
||||
|
||||
export type FieldEntry = {
|
||||
value: string;
|
||||
status: string;
|
||||
};
|
||||
|
||||
export type Pronoun = FieldEntry & { display_text: string | null };
|
||||
|
||||
export type Field = {
|
||||
name: string;
|
||||
entries: FieldEntry[];
|
||||
};
|
||||
|
||||
export type PrideFlag = {
|
||||
id: string;
|
||||
image_url: string;
|
||||
name: string;
|
||||
description: string | null;
|
||||
};
|
||||
|
||||
export type AuthMethod = {
|
||||
id: string;
|
||||
type: "DISCORD" | "GOOGLE" | "TUMBLR" | "FEDIVERSE" | "EMAIL";
|
||||
remote_id: string;
|
||||
remote_username?: string;
|
||||
};
|
||||
|
||||
export type CustomPreference = {
|
||||
icon: string;
|
||||
tooltip: string;
|
||||
muted: boolean;
|
||||
favourite: boolean;
|
||||
size: PreferenceSize;
|
||||
};
|
||||
|
||||
export enum PreferenceSize {
|
||||
Large = "LARGE",
|
||||
Normal = "NORMAL",
|
||||
Small = "SMALL",
|
||||
}
|
||||
|
||||
export function mergePreferences(
|
||||
prefs: Record<string, CustomPreference>,
|
||||
): Record<string, CustomPreference> {
|
||||
return Object.assign({}, defaultPreferences, prefs);
|
||||
}
|
||||
|
||||
export const defaultPreferences = Object.freeze({
|
||||
favourite: {
|
||||
icon: "heart-fill",
|
||||
tooltip: "Favourite",
|
||||
size: PreferenceSize.Large,
|
||||
muted: false,
|
||||
favourite: true,
|
||||
},
|
||||
okay: {
|
||||
icon: "hand-thumbs-up",
|
||||
tooltip: "Okay",
|
||||
size: PreferenceSize.Normal,
|
||||
muted: false,
|
||||
favourite: false,
|
||||
},
|
||||
jokingly: {
|
||||
icon: "emoji-laughing",
|
||||
tooltip: "Jokingly",
|
||||
size: PreferenceSize.Normal,
|
||||
muted: false,
|
||||
favourite: false,
|
||||
},
|
||||
friends_only: {
|
||||
icon: "people",
|
||||
tooltip: "Friends only",
|
||||
size: PreferenceSize.Normal,
|
||||
muted: false,
|
||||
favourite: false,
|
||||
},
|
||||
avoid: {
|
||||
icon: "hand-thumbs-down",
|
||||
tooltip: "Avoid",
|
||||
size: PreferenceSize.Small,
|
||||
muted: true,
|
||||
favourite: false,
|
||||
},
|
||||
missing: {
|
||||
icon: "question-lg",
|
||||
tooltip: "Unknown (missing)",
|
||||
size: PreferenceSize.Normal,
|
||||
muted: false,
|
||||
favourite: false,
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue