feat: preferences syncing frontend (#7192)

* feat: prefs frontend

* fix: DI issue

* fix: lint

* feat: appearance settings cleanup + fix settings, remove pinia

* fix: sync btn when logged out

* fix: prepr

* fix: sidebar issue

* feat: language coverage + cleanup

* feat: cleanup lang settings

* fix: fmt

* fix: CI

* fix: ci

* fix: storybook

* feat: bring back loader/game version sort

---------

Co-authored-by: tdgao <mr.trumgao@gmail.com>
This commit is contained in:
Calum H.
2026-08-20 07:23:01 +00:00
committed by GitHub
co-authored by tdgao
parent 79fcf41316
commit 3e07267e10
191 changed files with 3356 additions and 4372 deletions
@@ -1710,6 +1710,69 @@ export namespace Labrinth {
export type Role = Common.Role
export type AuthProvider = Common.AuthProvider
export type UserPayoutData = Common.UserPayoutData
export type Theme = 'light' | 'dark' | 'oled' | 'retro'
export type LayoutOption = 'grid' | 'rows'
export type FriendPrivacy = 'none' | 'mutual' | 'everyone'
export type InvitePrivacy = 'none' | 'friends' | 'everyone'
export type AppearancePreferences = {
auto: boolean
theme: Theme
}
export type BehaviorPreferences = {
minimize_app: boolean
hide_right_sidebar: boolean
show_jump_in: boolean
show_play_time: boolean
hide_nametag: boolean
warn_on_unknown_modpacks: boolean
skip_non_essential_warnings: boolean
}
export type LocalizationPreferences = {
locale: string
}
export type LayoutPreferences = {
mods: LayoutOption
plugins: LayoutOption
datapacks: LayoutOption
shaders: LayoutOption
resourcepacks: LayoutOption
modpacks: LayoutOption
servers: LayoutOption
users: LayoutOption
}
export type SidebarPreferences = {
right_aligned_search: boolean
left_aligned_content: boolean
}
export type SocialPreferences = {
friend_privacy: FriendPrivacy
shared_instances_privacy: InvitePrivacy
hosting_access_privacy: InvitePrivacy
}
export type UserPreferences = {
appearance: AppearancePreferences
behavior: BehaviorPreferences
localization: LocalizationPreferences
layouts: LayoutPreferences
sidebars: SidebarPreferences
social: SocialPreferences
}
export type PartialUserPreferences = {
appearance?: Partial<AppearancePreferences>
behavior?: Partial<BehaviorPreferences>
localization?: Partial<LocalizationPreferences>
layouts?: Partial<LayoutPreferences>
sidebars?: Partial<SidebarPreferences>
social?: Partial<SocialPreferences>
}
export type Pride26CampaignDonation = {
last_donated_at: string
@@ -37,6 +37,43 @@ export class LabrinthUsersV3Module extends AbstractModule {
)
}
/**
* Get a user's account preferences. The authenticated user may access their
* own preferences, while moderators may access another user's preferences.
*
* GET /v3/user/{id}/preferences
*/
public async getPreferences(idOrUsername: string): Promise<Labrinth.Users.v3.UserPreferences> {
return this.client.request<Labrinth.Users.v3.UserPreferences>(
`/user/${encodeURIComponent(idOrUsername)}/preferences`,
{
api: 'labrinth',
version: 3,
method: 'GET',
},
)
}
/**
* Update a user's account preferences and return the fully resolved result.
*
* PATCH /v3/user/{id}/preferences
*/
public async patchPreferences(
idOrUsername: string,
preferences: Labrinth.Users.v3.PartialUserPreferences,
): Promise<Labrinth.Users.v3.UserPreferences> {
return this.client.request<Labrinth.Users.v3.UserPreferences>(
`/user/${encodeURIComponent(idOrUsername)}/preferences`,
{
api: 'labrinth',
version: 3,
method: 'PATCH',
body: preferences,
},
)
}
/**
* Search users by username prefix.
*