feat: add avatar/bio/links/names/pronouns to user page
This commit is contained in:
parent
412d720abc
commit
862a64840e
16 changed files with 650 additions and 90 deletions
|
@ -12,6 +12,7 @@ export type User = PartialUser & {
|
|||
names: FieldEntry[];
|
||||
pronouns: Pronoun[];
|
||||
fields: Field[];
|
||||
custom_preferences: Record<string, CustomPreference>;
|
||||
};
|
||||
|
||||
export type UserWithMembers = User & { members: PartialMember[] };
|
||||
|
@ -47,3 +48,62 @@ export type Field = {
|
|||
name: string;
|
||||
entries: FieldEntry[];
|
||||
};
|
||||
|
||||
export type CustomPreference = {
|
||||
icon: string;
|
||||
tooltip: string;
|
||||
muted: boolean;
|
||||
favourite: boolean;
|
||||
size: PreferenceSize;
|
||||
};
|
||||
|
||||
export enum PreferenceSize {
|
||||
Large = "LARGE",
|
||||
Normal = "NORMAL",
|
||||
Small = "SMALL",
|
||||
}
|
||||
|
||||
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,
|
||||
},
|
||||
});
|
||||
|
|
22
Foxnouns.Frontend/app/lib/markdown.ts
Normal file
22
Foxnouns.Frontend/app/lib/markdown.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
import MarkdownIt from "markdown-it";
|
||||
import sanitize from "sanitize-html";
|
||||
|
||||
const md = new MarkdownIt({
|
||||
html: false,
|
||||
breaks: true,
|
||||
linkify: true,
|
||||
}).disable(["heading", "lheading", "link", "table", "blockquote"]);
|
||||
|
||||
const unsafeMd = new MarkdownIt({
|
||||
html: false,
|
||||
breaks: true,
|
||||
linkify: true,
|
||||
});
|
||||
|
||||
export function renderMarkdown(src: string | null) {
|
||||
return src ? sanitize(md.render(src)) : null;
|
||||
}
|
||||
|
||||
export function renderUnsafeMarkdown(src: string) {
|
||||
return sanitize(unsafeMd.render(src));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue