mirror of
https://github.com/modrinth/code.git
synced 2026-08-31 12:05:53 +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:
@@ -1,4 +1,4 @@
|
||||
import { provideNotificationManager } from '@modrinth/ui'
|
||||
import { provideNotificationManager, setupUserPreferencesProvider } from '@modrinth/ui'
|
||||
|
||||
import { FrontendNotificationManager } from './frontend-notifications'
|
||||
import { setupAuthProvider } from './setup/auth'
|
||||
@@ -10,13 +10,23 @@ import { setupTagsProvider } from './setup/tags'
|
||||
import { setupUserCountryProvider } from './setup/user-country'
|
||||
|
||||
export function setupProviders(auth: Awaited<ReturnType<typeof useAuth>>) {
|
||||
provideNotificationManager(new FrontendNotificationManager())
|
||||
const notificationManager = new FrontendNotificationManager()
|
||||
provideNotificationManager(notificationManager)
|
||||
|
||||
setupAuthProvider(auth)
|
||||
setupModrinthClientProvider(auth)
|
||||
const authProvider = setupAuthProvider(auth)
|
||||
const client = setupModrinthClientProvider(auth)
|
||||
const userPreferences = setupUserPreferencesProvider({
|
||||
auth: authProvider,
|
||||
getPreferences: (userId) => client.labrinth.users_v3.getPreferences(userId),
|
||||
patchPreferences: (userId, preferences) =>
|
||||
client.labrinth.users_v3.patchPreferences(userId, preferences),
|
||||
notificationManager,
|
||||
})
|
||||
setupTagsProvider()
|
||||
setupFilePickerProvider()
|
||||
setupPageContextProvider()
|
||||
setupLoadingStateProvider()
|
||||
setupUserCountryProvider()
|
||||
|
||||
return userPreferences
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user