diff --git a/frontend/src/lib/api/default_preferences.ts b/frontend/src/lib/api/default_preferences.ts new file mode 100644 index 0000000..ad8a2dc --- /dev/null +++ b/frontend/src/lib/api/default_preferences.ts @@ -0,0 +1,41 @@ +import { type CustomPreferences, PreferenceSize } from "./entities"; + +const defaultPreferences: CustomPreferences = { + 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: "people", + tooltip: "Avoid", + size: PreferenceSize.Small, + muted: true, + favourite: false, + }, +}; + +export default defaultPreferences; diff --git a/frontend/src/lib/api/entities.ts b/frontend/src/lib/api/entities.ts index 70dd2a6..b5cac81 100644 --- a/frontend/src/lib/api/entities.ts +++ b/frontend/src/lib/api/entities.ts @@ -16,6 +16,25 @@ export interface User { pronouns: Pronoun[]; members: PartialMember[]; fields: Field[]; + custom_preferences: CustomPreferences; +} + +export interface CustomPreferences { + [key: string]: CustomPreference; +} + +export interface CustomPreference { + icon: string; + tooltip: string; + size: PreferenceSize; + muted: boolean; + favourite: boolean; +} + +export enum PreferenceSize { + Large = "large", + Normal = "normal", + Small = "small", } export interface MeUser extends User { @@ -80,6 +99,7 @@ export interface MemberPartialUser { name: string; display_name: string | null; avatar: string | null; + custom_preferences: CustomPreferences; } export interface Invite { diff --git a/frontend/src/lib/components/FieldCard.svelte b/frontend/src/lib/components/FieldCard.svelte index 9d2a9f5..8abaffd 100644 --- a/frontend/src/lib/components/FieldCard.svelte +++ b/frontend/src/lib/components/FieldCard.svelte @@ -1,16 +1,17 @@

{field.name}

diff --git a/frontend/src/lib/components/StatusIcon.svelte b/frontend/src/lib/components/StatusIcon.svelte index ca92c9e..b26b03c 100644 --- a/frontend/src/lib/components/StatusIcon.svelte +++ b/frontend/src/lib/components/StatusIcon.svelte @@ -1,53 +1,24 @@ - -{statusText} + +{currentPreference.tooltip} diff --git a/frontend/src/lib/components/StatusLine.svelte b/frontend/src/lib/components/StatusLine.svelte index ada28f6..77ae5d0 100644 --- a/frontend/src/lib/components/StatusLine.svelte +++ b/frontend/src/lib/components/StatusLine.svelte @@ -1,14 +1,44 @@ -{#if status === WordStatus.Favourite} - -{:else if status === WordStatus.Avoid} - +{#if currentPreference.size === PreferenceSize.Large} + {:else} - + {/if} diff --git a/frontend/src/routes/@[username]/+page.svelte b/frontend/src/routes/@[username]/+page.svelte index 5c6ea6c..6d7cb2c 100644 --- a/frontend/src/routes/@[username]/+page.svelte +++ b/frontend/src/routes/@[username]/+page.svelte @@ -146,7 +146,7 @@

Names

@@ -156,14 +156,14 @@

Pronouns

{/if} {#each data.fields as field}
- +
{/each} diff --git a/frontend/src/routes/@[username]/[memberName]/+page.svelte b/frontend/src/routes/@[username]/[memberName]/+page.svelte index c6ca432..7ef25d9 100644 --- a/frontend/src/routes/@[username]/[memberName]/+page.svelte +++ b/frontend/src/routes/@[username]/[memberName]/+page.svelte @@ -81,7 +81,7 @@

Names

@@ -91,14 +91,14 @@

Pronouns

{/if} {#each data.fields as field}
- +
{/each}