mirror of
https://github.com/modrinth/code.git
synced 2026-09-02 04:56:52 +00:00
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:
@@ -5,8 +5,9 @@
|
||||
*/
|
||||
import { invoke } from '@tauri-apps/api/core'
|
||||
|
||||
import type { FeatureFlag } from '@/composables/use-app-settings.ts'
|
||||
import type { ColorTheme } from '@/composables/use-theme.ts'
|
||||
import type { Hooks, MemorySettings, WindowSize } from '@/helpers/types'
|
||||
import type { ColorTheme, FeatureFlag } from '@/store/theme.ts'
|
||||
|
||||
// Settings object
|
||||
/*
|
||||
@@ -43,6 +44,8 @@ export type AppSettings = {
|
||||
advanced_rendering: boolean
|
||||
native_decorations: boolean
|
||||
toggle_sidebar: boolean
|
||||
sync_theme_across_devices: boolean
|
||||
sync_behavior_across_devices: boolean
|
||||
|
||||
telemetry: boolean
|
||||
discord_rpc: boolean
|
||||
|
||||
+2
@@ -213,6 +213,8 @@ type AppSettings = {
|
||||
advanced_rendering: boolean
|
||||
native_decorations: boolean
|
||||
worlds_in_home: boolean
|
||||
sync_theme_across_devices: boolean
|
||||
sync_behavior_across_devices: boolean
|
||||
|
||||
telemetry: boolean
|
||||
discord_rpc: boolean
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import type { UserPreferencesContext } from '@modrinth/ui'
|
||||
import { invoke } from '@tauri-apps/api/core'
|
||||
|
||||
type UserPreferences = NonNullable<UserPreferencesContext['preferences']['value']>
|
||||
type PartialUserPreferences = Parameters<UserPreferencesContext['updatePreferences']>[0]
|
||||
|
||||
export async function get_user_preferences(userId: string): Promise<UserPreferences> {
|
||||
return await invoke<UserPreferences>('plugin:users|get_user_preferences', { userId })
|
||||
}
|
||||
|
||||
export async function patch_user_preferences(
|
||||
userId: string,
|
||||
preferences: PartialUserPreferences,
|
||||
): Promise<UserPreferences> {
|
||||
return await invoke<UserPreferences>('plugin:users|patch_user_preferences', {
|
||||
userId,
|
||||
preferences,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user