dify/web/app/components/header/account-setting/query-params.ts
yyh 1cf8db8395
refactor(web): clarify model selector trigger ownership (#40732)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-08-14 01:03:50 +00:00

27 lines
1.0 KiB
TypeScript

import type { inferParserType } from 'nuqs'
import { parseAsStringLiteral } from 'nuqs'
import { INTEGRATION_SECTION_VALUES } from '@/app/components/integrations/routes'
import { ACCOUNT_SETTING_TAB_VALUES } from './constants'
export const settingsQueryParamName = 'settings'
// Settings is a client-owned full-screen surface, so nuqs' shallow replace defaults are enough.
export const settingsQueryParser = parseAsStringLiteral([
...ACCOUNT_SETTING_TAB_VALUES,
...INTEGRATION_SECTION_VALUES,
] as const)
export type SettingsDestination = inferParserType<typeof settingsQueryParser>
export const isAccountSettingDestination = (
destination: SettingsDestination | null,
): destination is (typeof ACCOUNT_SETTING_TAB_VALUES)[number] => {
return ACCOUNT_SETTING_TAB_VALUES.some((value) => value === destination)
}
export const isIntegrationSettingDestination = (
destination: SettingsDestination | null,
): destination is (typeof INTEGRATION_SECTION_VALUES)[number] => {
return INTEGRATION_SECTION_VALUES.some((value) => value === destination)
}