diff --git a/src/main/config/appConfig.ts b/src/main/config/appConfig.ts index 15b825d..ed8acd1 100644 --- a/src/main/config/appConfig.ts +++ b/src/main/config/appConfig.ts @@ -27,7 +27,10 @@ function normalizePreferences(raw: Partial | undefined): AppPref const locale = raw?.locale; const accent = raw?.accent?.trim() || null; return { - schemeMode: schemeMode === "light" || schemeMode === "dark" || schemeMode === "auto" ? schemeMode : "auto", + schemeMode: + schemeMode === "light" || schemeMode === "dark" || schemeMode === "auto" + ? schemeMode + : "auto", accent: accent && /^#[\da-f]{6}$/i.test(accent) ? accent : null, locale: isAppLocale(locale) ? locale : DEFAULT_LOCALE, showDebugNav: raw?.showDebugNav === true, diff --git a/src/main/ipc/handlers.ts b/src/main/ipc/handlers.ts index 5da4e9e..415b364 100644 --- a/src/main/ipc/handlers.ts +++ b/src/main/ipc/handlers.ts @@ -81,7 +81,8 @@ const handlers = { "avatar:select": (avatarId) => guard(() => avatars.selectAvatar(avatarId)), "avatar:update": ({ avatarId, edit }) => guard(() => avatars.updateAvatar(avatarId, edit)), "avatar:delete": (avatarId) => guard(() => avatars.deleteAvatar(avatarId)), - "avatar:favorite": ({ avatarId, folder }) => guard(() => avatars.favoriteAvatar(avatarId, folder)), + "avatar:favorite": ({ avatarId, folder }) => + guard(() => avatars.favoriteAvatar(avatarId, folder)), "avatar:unfavorite": (avatarId) => guard(() => avatars.unfavoriteAvatar(avatarId)), "avatar:reloadFavorites": () => guard(() => avatars.reloadFavorites()), "avatar:moveFavorite": ({ avatarId, folder, reload }) => diff --git a/src/main/vrchat/avatarService.ts b/src/main/vrchat/avatarService.ts index 8eb0fe0..57ba885 100644 --- a/src/main/vrchat/avatarService.ts +++ b/src/main/vrchat/avatarService.ts @@ -305,7 +305,11 @@ async function restoreAvatarFavorite( fav: { favoriteId: string; tags: string[] }, ): Promise { await vrc.addFavorite({ - body: { type: "avatar", favoriteId: fav.favoriteId, tags: fav.tags.length ? fav.tags : ["avatars1"] }, + body: { + type: "avatar", + favoriteId: fav.favoriteId, + tags: fav.tags.length ? fav.tags : ["avatars1"], + }, throwOnError: true, }); } diff --git a/src/main/vrchat/errors.ts b/src/main/vrchat/errors.ts index f36fefa..912d258 100644 --- a/src/main/vrchat/errors.ts +++ b/src/main/vrchat/errors.ts @@ -54,7 +54,11 @@ export function toApiError(err: unknown): ApiError { else if (status === undefined && /network|fetch|ENOTFOUND|ECONN/i.test(message)) code = "network"; if (status === 429) { - return { code, message: "VRChat API rate limit hit. Try again shortly.", retryAfter: retryAfterOf(e) }; + return { + code, + message: "VRChat API rate limit hit. Try again shortly.", + retryAfter: retryAfterOf(e), + }; } if (status !== undefined && status >= 500) { return { code, message: "VRChat API is temporarily unavailable. Try again shortly." }; diff --git a/src/main/vrchat/worldService.ts b/src/main/vrchat/worldService.ts index 7639ddf..d7d4f96 100644 --- a/src/main/vrchat/worldService.ts +++ b/src/main/vrchat/worldService.ts @@ -260,7 +260,13 @@ function fillSlots(existing: FavoriteGroupInput[], caps: WorldFavoriteCaps): Fav for (let i = 1; mine.length < max && i <= max; i++) { const name = `${prefix}${i}`; if (taken.has(name)) continue; - mine.push({ name, displayName: prettyFolderName(name), visibility: "private", worlds: [], vrcPlus }); + mine.push({ + name, + displayName: prettyFolderName(name), + visibility: "private", + worlds: [], + vrcPlus, + }); } out.push(...mine); } @@ -354,10 +360,7 @@ export async function unfavoriteWorlds(worldIds: string[]): Promise { await reloadMyFavorites(); } -export async function moveWorldsToFolder( - worldIds: string[], - folder: string, -): Promise { +export async function moveWorldsToFolder(worldIds: string[], folder: string): Promise { const vrc = requireActiveClient(); const me = await currentUser(); const records = await favoriteRecords(vrc); @@ -458,10 +461,11 @@ async function favoriteTypeForExistingFolder( query: { ownerId: userId, n: 100 }, throwOnError: true, }); - return ( - data.find((g) => g.name === folder && isWorldGroupType(g.type))?.type ?? - favoriteTypeForFolder(folder) + const group = data.find( + (g): g is (typeof data)[number] & { type: WorldFavoriteGroupType } => + g.name === folder && isWorldGroupType(g.type), ); + return group?.type ?? favoriteTypeForFolder(folder); } type AddFavoriteBody = NonNullable[0]>["body"]; @@ -487,7 +491,9 @@ async function favoriteRecordEntries(vrc: VRChat): Promise isWorldGroupType(g.type)); + const groups = rawGroups.filter((g): g is (typeof rawGroups)[number] & { type: WorldFavoriteGroupType } => + isWorldGroupType(g.type), + ); const pageSize = 100; const entries: WorldFavoriteRecord[] = []; for (const group of groups) { diff --git a/src/renderer/src/components/ui/CheckBox.tsx b/src/renderer/src/components/ui/CheckBox.tsx index 266fd5e..58a9802 100644 --- a/src/renderer/src/components/ui/CheckBox.tsx +++ b/src/renderer/src/components/ui/CheckBox.tsx @@ -23,7 +23,9 @@ export function CheckBox({ onChange(); }} className={`flex size-5 items-center justify-center rounded-md border transition-colors ${ - on ? "border-accent bg-accent text-on-accent" : "border-border bg-surface-2/80 hover:border-accent" + on + ? "border-accent bg-accent text-on-accent" + : "border-border bg-surface-2/80 hover:border-accent" }`} > {indeterminate ? : checked ? : null} diff --git a/src/renderer/src/features/account/useAccountSettings.ts b/src/renderer/src/features/account/useAccountSettings.ts index 9fba324..e829715 100644 --- a/src/renderer/src/features/account/useAccountSettings.ts +++ b/src/renderer/src/features/account/useAccountSettings.ts @@ -15,15 +15,9 @@ export function useAccountSettings(): { const [nonce, setNonce] = useState(0); const [override, setOverride] = useState(null); - const fetched = useAsync( - () => api.settings.get(), - [activeId, nonce], - "Failed to load settings.", - ); + const fetched = useAsync(() => api.settings.get(), [activeId, nonce], "Failed to load settings."); - const state: Async = override - ? { status: "ready", data: override } - : fetched; + const state: Async = override ? { status: "ready", data: override } : fetched; const reload = useCallback(() => { setOverride(null); diff --git a/src/renderer/src/features/auth/AccountSwitcher.tsx b/src/renderer/src/features/auth/AccountSwitcher.tsx index 21b6e02..d67dce5 100644 --- a/src/renderer/src/features/auth/AccountSwitcher.tsx +++ b/src/renderer/src/features/auth/AccountSwitcher.tsx @@ -26,7 +26,9 @@ export function AccountSwitcher() { const status = self?.status ?? "offline"; const activeName = active ? (demoMode ? demoName(active.id) : active.displayName) : "Account"; const activeIcon = demoMode ? undefined : active?.userIcon; - const activeSub = demoMode ? statusMeta[status].label : self?.statusDescription || statusMeta[status].label; + const activeSub = demoMode + ? statusMeta[status].label + : self?.statusDescription || statusMeta[status].label; function close() { setOpen(false); @@ -57,9 +59,7 @@ export function AccountSwitcher() { {activeName} - - {activeSub} - + {activeSub} {isOwner ? ( <> -