Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

feat(web): add searchable timezone selection to preferences (#43944)

yyh74425108b39c
diff --git a/web/app/components/header/account-setting/preference-page/__tests__/index.spec.tsx b/web/app/components/header/account-setting/preference-page/__tests__/index.spec.tsx
index b7f5a88e5fb..d1272d6750f 100644
--- a/web/app/components/header/account-setting/preference-page/__tests__/index.spec.tsx
+++ b/web/app/components/header/account-setting/preference-page/__tests__/index.spec.tsx
@@ -1,8 +1,9 @@
import type { GetAccountProfileResponse } from '@dify/contracts/api/console/account/types.gen'
import { QueryClientProvider } from '@tanstack/react-query'
-import { screen, waitFor, within } from '@testing-library/react'
+import { act, screen, waitFor } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { AppToastHost } from '@/app/notifications/host'
+import { setLocaleOnClient } from '@/i18n/client'
import { languages } from '@/i18n/language'
import { createAccountProfileQueryClient } from '@/test/console/account-profile'
import { render } from '@/test/console/render'
@@ -58,17 +59,9 @@ const renderPage = () => {
)
}
-const getSectionByLabel = (sectionLabel: string) => {
- const label = screen.getByText(sectionLabel)
- const section = label.closest('div')?.parentElement
- if (!section) throw new Error(`Missing select section: ${sectionLabel}`)
- return section
-}
-
const selectOption = async (sectionLabel: string, optionName: string) => {
const user = userEvent.setup()
- const section = getSectionByLabel(sectionLabel)
- await user.click(within(section).getByRole('combobox'))
+ await user.click(screen.getByRole('combobox', { name: sectionLabel }))
await user.click(await screen.findByRole('option', { name: optionName }))
}
@@ -84,17 +77,38 @@ const getTimezoneOption = (value: string) => {
return option
}
+const createDeferred = <T,>() => {
+ let resolve!: (value: T) => void
+ const promise = new Promise<T>((resolvePromise) => {
+ resolve = resolvePromise
+ })
+ return { promise, resolve }
+}
+
+const mockProfileFailure = async (message: string) => {
+ const { request } = await vi.importActual<typeof import('@/service/base')>('@/service/base')
+ mockRequest.mockImplementationOnce(request)
+ vi.spyOn(globalThis, 'fetch').mockResolvedValueOnce(
+ new Response(JSON.stringify({ message, code: 'invalid_param' }), {
+ status: 400,
+ headers: { 'content-type': 'application/json' },
+ }),
+ )
+}
+
beforeEach(() => {
vi.useRealTimers()
+ vi.restoreAllMocks()
vi.clearAllMocks()
+ vi.mocked(setLocaleOnClient).mockReset().mockResolvedValue(undefined)
mockLocale = 'en-US'
mockUserProfile = createUserProfile()
const profileResponse = () =>
new Response(JSON.stringify(mockUserProfile), {
headers: { 'content-type': 'application/json' },
})
- mockGet.mockImplementation(async () => profileResponse())
- mockRequest.mockImplementation(async () => profileResponse())
+ mockGet.mockReset().mockImplementation(async () => profileResponse())
+ mockRequest.mockReset().mockImplementation(async () => profileResponse())
})
// Rendering
@@ -113,11 +127,11 @@ describe('PreferencePage - Rendering', () => {
expect(screen.getByText('common.language.displayLanguage')).toBeInTheDocument()
expect(screen.getByText('common.language.timezone')).toBeInTheDocument()
expect(
- within(getSectionByLabel('common.language.displayLanguage')).getByRole('combobox'),
+ screen.getByRole('combobox', { name: 'common.language.displayLanguage' }),
).toHaveTextContent(english.name)
- expect(
- within(getSectionByLabel('common.language.timezone')).getByRole('combobox'),
- ).toHaveTextContent(niueTimezone.name)
+ expect(screen.getByRole('combobox', { name: 'common.language.timezone' })).toHaveTextContent(
+ niueTimezone.name,
+ )
})
it('should render placeholders when the current locale or timezone is unsupported', () => {
@@ -130,50 +144,188 @@ describe('PreferencePage - Rendering', () => {
renderPage()
expect(
- within(getSectionByLabel('common.language.displayLanguage')).getByRole('combobox'),
- ).toHaveTextContent('common.placeholder.select')
- expect(
- within(getSectionByLabel('common.language.timezone')).getByRole('combobox'),
+ screen.getByRole('combobox', { name: 'common.language.displayLanguage' }),
).toHaveTextContent('common.placeholder.select')
+ expect(screen.getByRole('combobox', { name: 'common.language.timezone' })).toHaveTextContent(
+ 'common.placeholder.select',
+ )
})
})
// Interactions
describe('PreferencePage - Interactions', () => {
- it('should save the selected language', async () => {
+ it('should focus the timezone trigger without opening or saving when its label is clicked', async () => {
+ const user = userEvent.setup()
+ renderPage()
+
+ await user.click(screen.getByText('common.language.timezone'))
+
+ const trigger = screen.getByRole('combobox', { name: 'common.language.timezone' })
+ expect(trigger).toHaveFocus()
+ expect(trigger).toHaveAttribute('aria-expanded', 'false')
+ expect(mockRequest).not.toHaveBeenCalled()
+ })
+
+ it.each([' bEiJiNg ', 'Asia/Shanghai', '+08:00'])(
+ 'should filter timezones by %s without saving a preference',
+ async (query) => {
+ const user = userEvent.setup()
+ renderPage()
+
+ await user.click(screen.getByRole('combobox', { name: 'common.language.timezone' }))
+ await user.type(
+ screen.getByRole('combobox', { name: 'accountSettings.account.timezoneSearchPlaceholder' }),
+ query,
+ )
+
+ expect(
+ await screen.findByRole('option', { name: getTimezoneOption('Asia/Shanghai').name }),
+ ).toBeInTheDocument()
+ expect(
+ screen.queryByRole('option', { name: getTimezoneOption('Pacific/Niue').name }),
+ ).not.toBeInTheDocument()
+ expect(mockRequest).not.toHaveBeenCalled()
+ },
+ )
+
+ it('should preserve the saved timezone after an empty search is dismissed', async () => {
+ const user = userEvent.setup()
+ renderPage()
+ const trigger = screen.getByRole('combobox', { name: 'common.language.timezone' })
+
+ await user.click(trigger)
+ await user.type(
+ screen.getByRole('combobox', { name: 'accountSettings.account.timezoneSearchPlaceholder' }),
+ 'no-such-timezone',
+ )
+ expect(await screen.findByText('accountSettings.account.timezoneNoResults')).toBeInTheDocument()
+ expect(screen.queryByRole('option')).not.toBeInTheDocument()
+ await user.keyboard('{Escape}')
+
+ expect(trigger).toHaveTextContent(getTimezoneOption('Pacific/Niue').name)
+ expect(mockRequest).not.toHaveBeenCalled()
+ await user.click(trigger)
+ expect(
+ screen.getByRole('combobox', { name: 'accountSettings.account.timezoneSearchPlaceholder' }),
+ ).toHaveValue('')
+ expect(
+ await screen.findByRole('option', { name: getTimezoneOption('Pacific/Niue').name }),
+ ).toBeInTheDocument()
+ })
+
+ it('should keep profile controls disabled until saving, refetching, and changing language finish', async () => {
const chinese = getLanguageOption('zh-Hans')
mockUserProfile = createUserProfile({ interface_language: 'en-US' })
+ const save = createDeferred<Response>()
+ const refetch = createDeferred<Response>()
+ const changeLanguage = createDeferred<void>()
+ mockRequest.mockReturnValueOnce(save.promise)
+ mockGet.mockReturnValueOnce(refetch.promise)
+ vi.mocked(setLocaleOnClient).mockReturnValueOnce(changeLanguage.promise)
renderPage()
+ const language = screen.getByRole('combobox', { name: 'common.language.displayLanguage' })
+ const timezone = screen.getByRole('combobox', { name: 'common.language.timezone' })
+ const appearance = screen.getByRole('combobox', {
+ name: 'accountSettings.account.appearanceLabel',
+ })
await selectOption('common.language.displayLanguage', chinese.name)
- await waitFor(() => {
- expect(mockRequest).toHaveBeenCalled()
- })
+ expect(language).toBeDisabled()
+ expect(timezone).toBeDisabled()
+ expect(appearance).toBeEnabled()
+ await waitFor(() => expect(mockRequest).toHaveBeenCalledOnce())
+ expect(language).toHaveFocus()
expect(mockRequest.mock.calls[0]?.[0]).toEqual(expect.stringContaining('/account/profile'))
const request = mockRequest.mock.calls[0]?.[2]?.request as Request
expect(request.method).toBe('PATCH')
await expect(request.json()).resolves.toEqual({ interface_language: chinese.value })
+
+ const savedProfile = createUserProfile({ interface_language: chinese.value })
+ const response = () =>
+ new Response(JSON.stringify(savedProfile), {
+ headers: { 'content-type': 'application/json' },
+ })
+ await act(async () => save.resolve(response()))
+ await waitFor(() => expect(mockGet).toHaveBeenCalled())
+ await waitFor(() => expect(setLocaleOnClient).toHaveBeenCalledWith(chinese.value, false))
+ expect(language).toBeDisabled()
+ expect(timezone).toBeDisabled()
+ expect(mockRefresh).not.toHaveBeenCalled()
+
+ await act(async () => {
+ mockLocale = chinese.value
+ changeLanguage.resolve()
+ })
+ await waitFor(() => expect(mockRefresh).toHaveBeenCalledOnce())
+ expect(language).toBeDisabled()
+ expect(timezone).toBeDisabled()
+
+ await act(async () => refetch.resolve(response()))
+ await waitFor(() => expect(language).toBeEnabled())
+ expect(timezone).toBeEnabled()
+ expect(language).toHaveTextContent(chinese.name)
+ expect(mockRefresh).toHaveBeenCalledOnce()
})
- it('should show error toast when language update fails', async () => {
+ it('should show one request-layer error and restore controls when language saving fails', async () => {
const chinese = getLanguageOption('zh-Hans')
- mockRequest.mockRejectedValueOnce(new Error('Update failed'))
+ await mockProfileFailure('Update failed')
renderPage()
await selectOption('common.language.displayLanguage', chinese.name)
- expect(await screen.findByText('Update failed')).toBeInTheDocument()
+ expect(await screen.findAllByText('Update failed')).toHaveLength(1)
+ await waitFor(() =>
+ expect(
+ screen.getByRole('combobox', { name: 'common.language.displayLanguage' }),
+ ).toBeEnabled(),
+ )
+ expect(screen.getByRole('combobox', { name: 'common.language.displayLanguage' })).toBeEnabled()
+ expect(screen.getByRole('combobox', { name: 'common.language.timezone' })).toBeEnabled()
+ expect(setLocaleOnClient).not.toHaveBeenCalled()
+ expect(mockRefresh).not.toHaveBeenCalled()
+ expect(screen.getAllByText('Update failed')).toHaveLength(1)
})
- it('should save the selected timezone', async () => {
- const midwayTimezone = getTimezoneOption('Pacific/Midway')
+ it('should report client-side language failures without repeating the saved request', async () => {
+ vi.mocked(setLocaleOnClient).mockRejectedValueOnce(new Error('Language resources unavailable'))
+ renderPage()
+ await selectOption('common.language.displayLanguage', getLanguageOption('zh-Hans').name)
+
+ expect(await screen.findAllByText('Language resources unavailable')).toHaveLength(1)
+ await waitFor(() =>
+ expect(
+ screen.getByRole('combobox', { name: 'common.language.displayLanguage' }),
+ ).toBeEnabled(),
+ )
+ expect(mockRequest).toHaveBeenCalledOnce()
+ expect(mockRefresh).not.toHaveBeenCalled()
+ })
+
+ it('should save a filtered timezone selected with the keyboard and display the saved value', async () => {
+ const user = userEvent.setup()
+ const midwayTimezone = getTimezoneOption('Pacific/Midway')
+ mockRequest.mockImplementationOnce(async () => {
+ mockUserProfile = createUserProfile({ timezone: midwayTimezone.value })
+ return new Response(JSON.stringify(mockUserProfile), {
+ headers: { 'content-type': 'application/json' },
+ })
+ })
renderPage()
- await selectOption('common.language.timezone', midwayTimezone.name)
+ const trigger = screen.getByRole('combobox', { name: 'common.language.timezone' })
+ await user.click(trigger)
+ await user.type(
+ screen.getByRole('combobox', { name: 'accountSettings.account.timezoneSearchPlaceholder' }),
+ midwayTimezone.value,
+ )
+ await screen.findByRole('option', { name: midwayTimezone.name })
+ await user.keyboard('{ArrowDown}')
+ await user.keyboard('{Enter}')
await waitFor(() => {
expect(mockRequest).toHaveBeenCalled()
@@ -182,16 +334,26 @@ describe('PreferencePage - Interactions', () => {
const request = mockRequest.mock.calls[0]?.[2]?.request as Request
expect(request.method).toBe('PATCH')
await expect(request.json()).resolves.toEqual({ timezone: midwayTimezone.value })
+ await waitFor(() => expect(trigger).toHaveTextContent(midwayTimezone.name))
}, 15000)
- it('should show error toast when timezone update fails', async () => {
+ it('should show one request-layer error and preserve the saved timezone on failure', async () => {
const midwayTimezone = getTimezoneOption('Pacific/Midway')
- mockRequest.mockRejectedValueOnce(new Error('Timezone failed'))
+ await mockProfileFailure('Timezone failed')
renderPage()
await selectOption('common.language.timezone', midwayTimezone.name)
- expect(await screen.findByText('Timezone failed')).toBeInTheDocument()
+ expect(await screen.findAllByText('Timezone failed')).toHaveLength(1)
+ await waitFor(() =>
+ expect(screen.getByRole('combobox', { name: 'common.language.timezone' })).toBeEnabled(),
+ )
+ expect(screen.getByRole('combobox', { name: 'common.language.timezone' })).toHaveTextContent(
+ getTimezoneOption('Pacific/Niue').name,
+ )
+ expect(screen.getByRole('combobox', { name: 'common.language.timezone' })).toBeEnabled()
+ expect(screen.getByRole('combobox', { name: 'common.language.displayLanguage' })).toBeEnabled()
+ expect(screen.getAllByText('Timezone failed')).toHaveLength(1)
}, 15000)
})
diff --git a/web/app/components/header/account-setting/preference-page/index.tsx b/web/app/components/header/account-setting/preference-page/index.tsx
index 2e2a91505cc..f83393bfa5b 100644
--- a/web/app/components/header/account-setting/preference-page/index.tsx
+++ b/web/app/components/header/account-setting/preference-page/index.tsx
@@ -1,16 +1,37 @@
'use client'
import type { Locale } from '@/i18n'
+import {
+ Combobox,
+ ComboboxEmpty,
+ ComboboxIcon,
+ ComboboxInput,
+ ComboboxInputGroup,
+ ComboboxItem,
+ ComboboxItemIndicator,
+ ComboboxItemText,
+ ComboboxLabel,
+ ComboboxList,
+ ComboboxPopup,
+ ComboboxPortal,
+ ComboboxPositioner,
+ ComboboxTrigger,
+ ComboboxValue,
+ createComboboxItems,
+ useComboboxFilter,
+} from '@langgenius/dify-ui/combobox'
import {
Select,
SelectContent,
SelectItem,
SelectItemIndicator,
SelectItemText,
+ SelectLabel,
SelectTrigger,
+ SelectValue,
} from '@langgenius/dify-ui/select'
import { useMutation, useSuspenseQuery } from '@tanstack/react-query'
import { useTheme } from 'next-themes'
-import { useState } from 'react'
+import { useId } from 'react'
import { useTranslation } from 'react-i18next'
import { useLocale } from '#i18n'
import { toast } from '@/app/notifications'
@@ -21,154 +42,181 @@ import { useRouter } from '@/next/navigation'
import { consoleQuery } from '@/service/console'
import { timezones } from '@/utils/timezone'
-type SelectOption = {
- value: string
- name: string
-}
+type TimezoneOption = (typeof timezones)[number]
+type TimezoneValue = TimezoneOption['value']
+type ThemeValue = 'system' | 'light' | 'dark'
-type TimezoneOption = {
- value: string
- name: string
-}
+const languageItems = languages
+ .filter((item) => item.supported)
+ .map((item) => ({ value: item.value, label: item.name }))
-const titleClassName = `
- mb-1 system-sm-medium text-text-secondary
-`
-const themes = ['system', 'light', 'dark'] as const
-type ThemeOption = (typeof themes)[number]
+const profileMutationOptions = consoleQuery.account.profile.patch.mutationOptions()
-const isThemeOption = (value: string): value is ThemeOption => {
- return (themes as readonly string[]).includes(value)
-}
+const timezoneItems = createComboboxItems(timezones, {
+ getValue: (item) => item.value,
+ getLabel: (item) => item.name,
+})
export default function PreferencePage() {
const locale = useLocale()
+ const timezoneLabelId = useId()
+ const { contains } = useComboboxFilter({ sensitivity: 'base' })
const { data: userProfile } = useSuspenseQuery({
...userProfileQueryOptions(),
select: (data) => data.profile,
})
- const updateProfile = useMutation(consoleQuery.account.profile.patch.mutationOptions())
- const [editing, setEditing] = useState(false)
const { t } = useTranslation(['common', 'accountSettings'])
const router = useRouter()
const { theme, setTheme } = useTheme()
- const languageOptions: SelectOption[] = languages.filter((item) => item.supported)
- const themeOptions: SelectOption[] = [
+ const updateProfile = useMutation(
+ consoleQuery.account.profile.patch.mutationOptions({
+ onSuccess: async (data, variables, onMutateResult, context) => {
+ const language = variables.body.interface_language
+ await Promise.all([
+ profileMutationOptions.onSuccess?.(data, variables, onMutateResult, context),
+ language
+ ? setLocaleOnClient(language, false).then(
+ () => router.refresh(),
+ (error: unknown) => {
+ toast.error(
+ error instanceof Error
+ ? error.message
+ : t(($) => $['api.actionFailed'], { ns: 'common' }),
+ )
+ },
+ )
+ : undefined,
+ ])
+ },
+ }),
+ )
+ const themeItems = [
{
value: 'system',
- name: t(($) => $['account.appearanceFollowSystem'], { ns: 'accountSettings' }),
+ label: t(($) => $['account.appearanceFollowSystem'], { ns: 'accountSettings' }),
},
- { value: 'light', name: t(($) => $['account.appearanceLight'], { ns: 'accountSettings' }) },
- { value: 'dark', name: t(($) => $['account.appearanceDark'], { ns: 'accountSettings' }) },
- ]
- const selectedLanguage = languageOptions.find(
+ { value: 'light', label: t(($) => $['account.appearanceLight'], { ns: 'accountSettings' }) },
+ { value: 'dark', label: t(($) => $['account.appearanceDark'], { ns: 'accountSettings' }) },
+ ] satisfies { value: ThemeValue; label: string }[]
+ const selectedLanguage = languageItems.find(
(item) => item.value === (locale || userProfile.interface_language),
)
- const selectedTheme = themeOptions.find((item) => item.value === (theme || 'system'))
+ const selectedTheme = themeItems.find((item) => item.value === theme)?.value ?? 'system'
const selectedTimezone = timezones.find((item) => item.value === userProfile.timezone)
- const handleSelectTheme = (item: SelectOption) => {
- if (isThemeOption(item.value)) setTheme(item.value)
- }
- const handleSelectLanguage = async (item: SelectOption) => {
- setEditing(true)
- try {
- await updateProfile.mutateAsync({ body: { interface_language: item.value } })
- setLocaleOnClient(item.value.toString() as Locale, false)
- router.refresh()
- } catch (e) {
- toast.error((e as Error).message)
- } finally {
- setEditing(false)
- }
- }
- const handleSelectTimezone = async (item: TimezoneOption) => {
- setEditing(true)
- try {
- await updateProfile.mutateAsync({ body: { timezone: item.value } })
- } catch (e) {
- toast.error((e as Error).message)
- } finally {
- setEditing(false)
- }
- }
return (
- <>
- <div className="mb-6">
- <div className={titleClassName}>
- {t(($) => $['account.appearanceLabel'], { ns: 'accountSettings' })}
- </div>
- <Select
- value={selectedTheme?.value ?? 'system'}
+ <div className="grid gap-6 pt-1 pb-4">
+ <div className="grid min-w-0 gap-1">
+ <Select<ThemeValue>
+ items={themeItems}
+ value={selectedTheme}
onValueChange={(nextValue) => {
- if (!nextValue) return
- const nextItem = themeOptions.find((item) => item.value === nextValue)
- if (nextItem) handleSelectTheme(nextItem)
+ if (nextValue === null || nextValue === selectedTheme) return
+ setTheme(nextValue)
}}
>
+ <SelectLabel>
+ {t(($) => $['account.appearanceLabel'], { ns: 'accountSettings' })}
+ </SelectLabel>
<SelectTrigger size="medium">
- {selectedTheme?.name ??
- t(($) => $['account.appearanceFollowSystem'], { ns: 'accountSettings' })}
+ <SelectValue<ThemeValue> />
</SelectTrigger>
<SelectContent>
- {themeOptions.map((item) => (
- <SelectItem key={item.value} value={item.value}>
- <SelectItemText>{item.name}</SelectItemText>
+ {themeItems.map((item) => (
+ <SelectItem<ThemeValue> key={item.value} value={item.value}>
+ <SelectItemText>{item.label}</SelectItemText>
<SelectItemIndicator />
</SelectItem>
))}
</SelectContent>
</Select>
</div>
- <div className="mb-6">
- <div className={titleClassName}>
- {t(($) => $['language.displayLanguage'], { ns: 'common' })}
- </div>
- <Select
+ <div className="grid min-w-0 gap-1">
+ <Select<Locale>
+ items={languageItems}
value={selectedLanguage?.value ?? null}
- disabled={editing}
+ disabled={updateProfile.isPending}
onValueChange={(nextValue) => {
- if (nextValue == null) return
- const nextItem = languageOptions.find((item) => item.value === nextValue)
- if (nextItem) handleSelectLanguage(nextItem)
+ if (nextValue === null || nextValue === selectedLanguage?.value) return
+ updateProfile.mutate({ body: { interface_language: nextValue } })
}}
>
+ <SelectLabel>{t(($) => $['language.displayLanguage'], { ns: 'common' })}</SelectLabel>
<SelectTrigger size="medium">
- {selectedLanguage?.name ?? t(($) => $['placeholder.select'], { ns: 'common' })}
+ <SelectValue<Locale>
+ placeholder={t(($) => $['placeholder.select'], { ns: 'common' })}
+ />
</SelectTrigger>
<SelectContent>
- {languageOptions.map((item) => (
- <SelectItem key={item.value} value={item.value}>
- <SelectItemText>{item.name}</SelectItemText>
+ {languageItems.map((item) => (
+ <SelectItem<Locale> key={item.value} value={item.value}>
+ <SelectItemText>{item.label}</SelectItemText>
<SelectItemIndicator />
</SelectItem>
))}
</SelectContent>
</Select>
</div>
- <div className="mb-6">
- <div className={titleClassName}>{t(($) => $['language.timezone'], { ns: 'common' })}</div>
- <Select
+ <div className="grid min-w-0 gap-1">
+ <Combobox<TimezoneValue, false, TimezoneOption>
+ items={timezoneItems}
value={selectedTimezone?.value ?? null}
- disabled={editing}
+ disabled={updateProfile.isPending}
+ filter={(item, query) => {
+ const search = query.trim()
+ return contains(item.name, search) || contains(item.value, search)
+ }}
onValueChange={(nextValue) => {
- if (!nextValue) return
- const nextItem = timezones.find((item) => item.value === nextValue)
- if (nextItem) handleSelectTimezone(nextItem)
+ if (nextValue === null || nextValue === userProfile.timezone) return
+ updateProfile.mutate({ body: { timezone: nextValue } })
}}
>
- <SelectTrigger size="medium">
- {selectedTimezone?.name ?? t(($) => $['placeholder.select'], { ns: 'common' })}
- </SelectTrigger>
- <SelectContent>
- {timezones.map((item) => (
- <SelectItem key={item.value} value={item.value}>
- <SelectItemText>{item.name}</SelectItemText>
- <SelectItemIndicator />
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
+ <ComboboxLabel>
+ <span id={timezoneLabelId}>{t(($) => $['language.timezone'], { ns: 'common' })}</span>
+ </ComboboxLabel>
+ <ComboboxTrigger className="group/timezone-trigger flex h-8 w-full min-w-0 items-center gap-0.5 rounded-lg border-0 bg-components-input-bg-normal py-2 pr-2 pl-3 text-start system-sm-regular text-components-input-text-filled hover:bg-state-base-hover-alt focus-visible:bg-state-base-hover-alt data-disabled:cursor-not-allowed data-disabled:bg-components-input-bg-disabled data-disabled:text-components-input-text-filled-disabled data-disabled:hover:bg-components-input-bg-disabled data-placeholder:text-components-input-text-placeholder data-disabled:data-placeholder:text-components-input-text-disabled data-popup-open:bg-state-base-hover-alt">
+ <span className="min-w-0 grow truncate">
+ <ComboboxValue<TimezoneValue>
+ placeholder={t(($) => $['placeholder.select'], { ns: 'common' })}
+ />
+ </span>
+ <ComboboxIcon className="text-text-quaternary transition-colors group-data-popup-open/timezone-trigger:text-text-secondary group-[:hover:not([data-disabled])]/timezone-trigger:text-text-secondary" />
+ </ComboboxTrigger>
+ <ComboboxPortal>
+ <ComboboxPositioner>
+ <ComboboxPopup
+ aria-labelledby={timezoneLabelId}
+ className="max-w-(--available-width)"
+ >
+ <ComboboxInputGroup>
+ <span
+ className="i-ri-search-line size-4 shrink-0 text-text-quaternary"
+ aria-hidden="true"
+ />
+ <ComboboxInput
+ aria-label={t(($) => $['account.timezoneSearchPlaceholder'], {
+ ns: 'accountSettings',
+ })}
+ placeholder={t(($) => $['account.timezoneSearchPlaceholder'], {
+ ns: 'accountSettings',
+ })}
+ />
+ </ComboboxInputGroup>
+ <ComboboxEmpty>
+ {t(($) => $['account.timezoneNoResults'], { ns: 'accountSettings' })}
+ </ComboboxEmpty>
+ <ComboboxList<TimezoneOption>>
+ {(item) => (
+ <ComboboxItem<TimezoneValue> key={item.value} value={item.value}>
+ <ComboboxItemText>{item.name}</ComboboxItemText>
+ <ComboboxItemIndicator />
+ </ComboboxItem>
+ )}
+ </ComboboxList>
+ </ComboboxPopup>
+ </ComboboxPositioner>
+ </ComboboxPortal>
+ </Combobox>
</div>
- </>
+ </div>
)
}
diff --git a/web/i18n/locales/ar-TN/account-settings.json b/web/i18n/locales/ar-TN/account-settings.json
index a03cbbf7ecc..f460ae42783 100644
--- a/web/i18n/locales/ar-TN/account-settings.json
+++ b/web/i18n/locales/ar-TN/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "إرسال رمز التحقق",
"account.setPassword": "تعيين كلمة مرور",
"account.showAppLength": "عرض {{length}} تطبيقات",
+ "account.timezoneNoResults": "لم يتم العثور على مناطق زمنية مطابقة",
+ "account.timezoneSearchPlaceholder": "ابحث عن مدن أو مناطق زمنية…",
"account.verificationLabel": "رمز التحقق",
"account.verificationPlaceholder": "الصق الرمز المكون من 6 أرقام",
"account.workspaceName": "اسم مساحة العمل",
diff --git a/web/i18n/locales/az-AZ/account-settings.json b/web/i18n/locales/az-AZ/account-settings.json
index fa50ee3ae64..4659269ba4e 100644
--- a/web/i18n/locales/az-AZ/account-settings.json
+++ b/web/i18n/locales/az-AZ/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "Doğrulama kodunu göndər",
"account.setPassword": "Parol təyin et",
"account.showAppLength": "{{length}} tətbiq göstər",
+ "account.timezoneNoResults": "Uyğun saat qurşağı tapılmadı",
+ "account.timezoneSearchPlaceholder": "Şəhər və ya saat qurşağı axtarın…",
"account.verificationLabel": "Doğrulama kodu",
"account.verificationPlaceholder": "6 rəqəmli kodu yapışdır",
"account.workspaceName": "İş sahəsinin adı",
diff --git a/web/i18n/locales/de-DE/account-settings.json b/web/i18n/locales/de-DE/account-settings.json
index 64a6e2f23a1..f6850104067 100644
--- a/web/i18n/locales/de-DE/account-settings.json
+++ b/web/i18n/locales/de-DE/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "Verifizierungscode senden",
"account.setPassword": "Ein Passwort festlegen",
"account.showAppLength": "{{length}} Apps anzeigen",
+ "account.timezoneNoResults": "Keine passenden Zeitzonen gefunden",
+ "account.timezoneSearchPlaceholder": "Städte oder Zeitzonen suchen…",
"account.verificationLabel": "Verifizierungs-Code",
"account.verificationPlaceholder": "Fügen Sie den 6-stelligen Code ein",
"account.workspaceName": "Arbeitsbereichsname",
diff --git a/web/i18n/locales/en-US/account-settings.json b/web/i18n/locales/en-US/account-settings.json
index 8823619d198..1dd5db563ae 100644
--- a/web/i18n/locales/en-US/account-settings.json
+++ b/web/i18n/locales/en-US/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "Send Verification Code",
"account.setPassword": "Set a password",
"account.showAppLength": "Show {{length}} apps",
+ "account.timezoneNoResults": "No matching time zones found",
+ "account.timezoneSearchPlaceholder": "Search cities or time zones...",
"account.verificationLabel": "Verification Code",
"account.verificationPlaceholder": "Paste the 6-digit code",
"account.workspaceName": "Workspace Name",
diff --git a/web/i18n/locales/es-ES/account-settings.json b/web/i18n/locales/es-ES/account-settings.json
index 1c5fb6de8dc..5fc3299ac93 100644
--- a/web/i18n/locales/es-ES/account-settings.json
+++ b/web/i18n/locales/es-ES/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "Enviar código de verificación",
"account.setPassword": "Establecer una contraseña",
"account.showAppLength": "Mostrar {{length}} apps",
+ "account.timezoneNoResults": "No se encontraron zonas horarias coincidentes",
+ "account.timezoneSearchPlaceholder": "Buscar ciudades o zonas horarias...",
"account.verificationLabel": "Código de verificación",
"account.verificationPlaceholder": "Pega el código de 6 dígitos",
"account.workspaceName": "Nombre del espacio de trabajo",
diff --git a/web/i18n/locales/fa-IR/account-settings.json b/web/i18n/locales/fa-IR/account-settings.json
index 56a79472dd1..d94a83503e8 100644
--- a/web/i18n/locales/fa-IR/account-settings.json
+++ b/web/i18n/locales/fa-IR/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "ارسال کد تأیید",
"account.setPassword": "تنظیم رمز عبور",
"account.showAppLength": "نمایش {{length}} برنامه",
+ "account.timezoneNoResults": "هیچ منطقهٔ زمانی مطابقی یافت نشد",
+ "account.timezoneSearchPlaceholder": "جستجوی شهر یا منطقهٔ زمانی…",
"account.verificationLabel": "کد تأیید",
"account.verificationPlaceholder": "کد 6 رقمی را جایگذاری کنید",
"account.workspaceName": "نام فضای کاری",
diff --git a/web/i18n/locales/fr-FR/account-settings.json b/web/i18n/locales/fr-FR/account-settings.json
index 3d891a2850a..c1e112838d1 100644
--- a/web/i18n/locales/fr-FR/account-settings.json
+++ b/web/i18n/locales/fr-FR/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "Envoyer le code de vérification",
"account.setPassword": "Définir un mot de passe",
"account.showAppLength": "Afficher {{length}} applications",
+ "account.timezoneNoResults": "Aucun fuseau horaire correspondant trouvé",
+ "account.timezoneSearchPlaceholder": "Rechercher des villes ou des fuseaux horaires…",
"account.verificationLabel": "Code de vérification",
"account.verificationPlaceholder": "Collez le code à 6 chiffres",
"account.workspaceName": "Nom de l'espace de travail",
diff --git a/web/i18n/locales/hi-IN/account-settings.json b/web/i18n/locales/hi-IN/account-settings.json
index 24b509100ba..44c41597694 100644
--- a/web/i18n/locales/hi-IN/account-settings.json
+++ b/web/i18n/locales/hi-IN/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "पुष्टि कोड भेजें",
"account.setPassword": "पासवर्ड सेट करें",
"account.showAppLength": "{{length}} ऐप्स दिखाएं",
+ "account.timezoneNoResults": "कोई मेल खाने वाला समय क्षेत्र नहीं मिला",
+ "account.timezoneSearchPlaceholder": "शहर या समय क्षेत्र खोजें…",
"account.verificationLabel": "सत्यापन कोड",
"account.verificationPlaceholder": "6-अंकीय कोड पेस्ट करें",
"account.workspaceName": "कार्यस्थल का नाम",
diff --git a/web/i18n/locales/id-ID/account-settings.json b/web/i18n/locales/id-ID/account-settings.json
index e797f7c17fe..2c802b611c6 100644
--- a/web/i18n/locales/id-ID/account-settings.json
+++ b/web/i18n/locales/id-ID/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "Kirim Kode Verifikasi",
"account.setPassword": "Menetapkan kata sandi",
"account.showAppLength": "Tampilkan {{length}} aplikasi",
+ "account.timezoneNoResults": "Tidak ditemukan zona waktu yang cocok",
+ "account.timezoneSearchPlaceholder": "Cari kota atau zona waktu...",
"account.verificationLabel": "Kode Verifikasi",
"account.verificationPlaceholder": "Tempel kode 6 digit",
"account.workspaceName": "Nama Ruang Kerja",
diff --git a/web/i18n/locales/it-IT/account-settings.json b/web/i18n/locales/it-IT/account-settings.json
index c378762acde..0a37d86eb40 100644
--- a/web/i18n/locales/it-IT/account-settings.json
+++ b/web/i18n/locales/it-IT/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "Invia codice di verifica",
"account.setPassword": "Imposta una password",
"account.showAppLength": "Mostra {{length}} app",
+ "account.timezoneNoResults": "Nessun fuso orario corrispondente trovato",
+ "account.timezoneSearchPlaceholder": "Cerca città o fusi orari...",
"account.verificationLabel": "Codice di verifica",
"account.verificationPlaceholder": "Incolla il codice a 6 cifre",
"account.workspaceName": "Nome del Workspace",
diff --git a/web/i18n/locales/ja-JP/account-settings.json b/web/i18n/locales/ja-JP/account-settings.json
index ccb78a9f268..66be5c8c068 100644
--- a/web/i18n/locales/ja-JP/account-settings.json
+++ b/web/i18n/locales/ja-JP/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "確認コードの送信",
"account.setPassword": "パスワードを設定",
"account.showAppLength": "{{length}}アプリを表示",
+ "account.timezoneNoResults": "一致するタイムゾーンが見つかりません",
+ "account.timezoneSearchPlaceholder": "都市またはタイムゾーンを検索…",
"account.verificationLabel": "認証コード",
"account.verificationPlaceholder": "6 桁のコードを貼り付けます",
"account.workspaceName": "ワークスペース名",
diff --git a/web/i18n/locales/ko-KR/account-settings.json b/web/i18n/locales/ko-KR/account-settings.json
index 804b33a55ce..6bb57f66f64 100644
--- a/web/i18n/locales/ko-KR/account-settings.json
+++ b/web/i18n/locales/ko-KR/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "인증 코드 보내기",
"account.setPassword": "비밀번호 설정",
"account.showAppLength": "{{length}}개의 앱 표시",
+ "account.timezoneNoResults": "일치하는 시간대가 없습니다",
+ "account.timezoneSearchPlaceholder": "도시 또는 시간대 검색…",
"account.verificationLabel": "인증 코드",
"account.verificationPlaceholder": "6 자리 코드를 붙여넣습니다.",
"account.workspaceName": "작업 공간 이름",
diff --git a/web/i18n/locales/lo-LA/account-settings.json b/web/i18n/locales/lo-LA/account-settings.json
index 9bcff72fccf..9ff8b96f7c7 100644
--- a/web/i18n/locales/lo-LA/account-settings.json
+++ b/web/i18n/locales/lo-LA/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "ສົ່ງລະຫັດຢືນຢັນ",
"account.setPassword": "ຕັ້ງລະຫັດຜ່ານ",
"account.showAppLength": "ສະແດງ {{length}} ແອັບ",
+ "account.timezoneNoResults": "ບໍ່ພົບເຂດເວລາທີ່ກົງກັນ",
+ "account.timezoneSearchPlaceholder": "ຄົ້ນຫາເມືອງ ຫຼື ເຂດເວລາ…",
"account.verificationLabel": "ລະຫັດຢືນຢັນ",
"account.verificationPlaceholder": "ວາງລະຫັດ 6 ຫຼັກ",
"account.workspaceName": "ຊື່ພື້ນທີ່ເຮັດວຽກ",
diff --git a/web/i18n/locales/nl-NL/account-settings.json b/web/i18n/locales/nl-NL/account-settings.json
index 0e9960db94e..b696d4978e3 100644
--- a/web/i18n/locales/nl-NL/account-settings.json
+++ b/web/i18n/locales/nl-NL/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "Send Verification Code",
"account.setPassword": "Set a password",
"account.showAppLength": "Show {{length}} apps",
+ "account.timezoneNoResults": "Geen overeenkomende tijdzones gevonden",
+ "account.timezoneSearchPlaceholder": "Zoek steden of tijdzones...",
"account.verificationLabel": "Verification Code",
"account.verificationPlaceholder": "Paste the 6-digit code",
"account.workspaceName": "Workspace Name",
diff --git a/web/i18n/locales/pl-PL/account-settings.json b/web/i18n/locales/pl-PL/account-settings.json
index 1b5f48fb6c5..9a3a6d8dc9c 100644
--- a/web/i18n/locales/pl-PL/account-settings.json
+++ b/web/i18n/locales/pl-PL/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "Wyślij kod weryfikacyjny",
"account.setPassword": "Ustaw hasło",
"account.showAppLength": "Pokaż {{length}} aplikacje",
+ "account.timezoneNoResults": "Nie znaleziono pasujących stref czasowych",
+ "account.timezoneSearchPlaceholder": "Szukaj miast lub stref czasowych…",
"account.verificationLabel": "Kod weryfikacyjny",
"account.verificationPlaceholder": "Wklej 6-cyfrowy kod",
"account.workspaceName": "Nazwa miejsca pracy",
diff --git a/web/i18n/locales/pt-BR/account-settings.json b/web/i18n/locales/pt-BR/account-settings.json
index f23894bc3ca..f8829031448 100644
--- a/web/i18n/locales/pt-BR/account-settings.json
+++ b/web/i18n/locales/pt-BR/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "Enviar código de verificação",
"account.setPassword": "Definir uma senha",
"account.showAppLength": "Mostrar {{length}} apps",
+ "account.timezoneNoResults": "Nenhum fuso horário correspondente encontrado",
+ "account.timezoneSearchPlaceholder": "Pesquisar cidades ou fusos horários...",
"account.verificationLabel": "Código de verificação",
"account.verificationPlaceholder": "Cole o código de 6 dígitos",
"account.workspaceName": "Nome do Espaço de Trabalho",
diff --git a/web/i18n/locales/ro-RO/account-settings.json b/web/i18n/locales/ro-RO/account-settings.json
index bdc119deb83..7183dc82dfa 100644
--- a/web/i18n/locales/ro-RO/account-settings.json
+++ b/web/i18n/locales/ro-RO/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "Trimiteți codul de verificare",
"account.setPassword": "Setează o parolă",
"account.showAppLength": "Afișează {{length}} aplicații",
+ "account.timezoneNoResults": "Nu s-au găsit fusuri orare potrivite",
+ "account.timezoneSearchPlaceholder": "Caută orașe sau fusuri orare...",
"account.verificationLabel": "Cod de verificare",
"account.verificationPlaceholder": "Lipiți codul din 6 cifre",
"account.workspaceName": "Numele spațiului de lucru",
diff --git a/web/i18n/locales/ru-RU/account-settings.json b/web/i18n/locales/ru-RU/account-settings.json
index 97aa85c059a..f3e9161550c 100644
--- a/web/i18n/locales/ru-RU/account-settings.json
+++ b/web/i18n/locales/ru-RU/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "Отправить код подтверждения",
"account.setPassword": "Установить пароль",
"account.showAppLength": "Показать {{length}} приложений",
+ "account.timezoneNoResults": "Подходящие часовые пояса не найдены",
+ "account.timezoneSearchPlaceholder": "Поиск городов или часовых поясов…",
"account.verificationLabel": "Проверочный код",
"account.verificationPlaceholder": "Вставьте 6-значный код",
"account.workspaceName": "Название рабочего пространства",
diff --git a/web/i18n/locales/sl-SI/account-settings.json b/web/i18n/locales/sl-SI/account-settings.json
index d8deb78fe0c..13aa967d908 100644
--- a/web/i18n/locales/sl-SI/account-settings.json
+++ b/web/i18n/locales/sl-SI/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "Pošlji kodo za preverjanje",
"account.setPassword": "Nastavi geslo",
"account.showAppLength": "Prikaz {{length}} aplikacij",
+ "account.timezoneNoResults": "Ni ustreznih časovnih pasov",
+ "account.timezoneSearchPlaceholder": "Poiščite mesta ali časovne pasove…",
"account.verificationLabel": "Koda za preverjanje",
"account.verificationPlaceholder": "Prilepite 6-mestno kodo",
"account.workspaceName": "Ime delovnega prostora",
diff --git a/web/i18n/locales/th-TH/account-settings.json b/web/i18n/locales/th-TH/account-settings.json
index fc811d74144..f98525fda0b 100644
--- a/web/i18n/locales/th-TH/account-settings.json
+++ b/web/i18n/locales/th-TH/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "ส่งรหัสยืนยัน",
"account.setPassword": "ตั้งรหัสผ่าน",
"account.showAppLength": "แสดง {{length}} แอป",
+ "account.timezoneNoResults": "ไม่พบเขตเวลาที่ตรงกัน",
+ "account.timezoneSearchPlaceholder": "ค้นหาเมืองหรือเขตเวลา…",
"account.verificationLabel": "รหัสยืนยัน",
"account.verificationPlaceholder": "วางรหัส 6 หลัก",
"account.workspaceName": "ชื่อพื้นที่ทำงาน",
diff --git a/web/i18n/locales/tr-TR/account-settings.json b/web/i18n/locales/tr-TR/account-settings.json
index c300c8a7baa..d17745cfbd2 100644
--- a/web/i18n/locales/tr-TR/account-settings.json
+++ b/web/i18n/locales/tr-TR/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "Doğrulama Kodu Gönder",
"account.setPassword": "Şifre Ayarla",
"account.showAppLength": "{{length}} uygulamayı göster",
+ "account.timezoneNoResults": "Eşleşen saat dilimi bulunamadı",
+ "account.timezoneSearchPlaceholder": "Şehir veya saat dilimi ara…",
"account.verificationLabel": "Doğrulama Kodu",
"account.verificationPlaceholder": "6 haneli kodu yapıştırın",
"account.workspaceName": "Çalışma Alanı Adı",
diff --git a/web/i18n/locales/uk-UA/account-settings.json b/web/i18n/locales/uk-UA/account-settings.json
index 32d3c93f773..0cd208ede95 100644
--- a/web/i18n/locales/uk-UA/account-settings.json
+++ b/web/i18n/locales/uk-UA/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "Надішліть код підтвердження",
"account.setPassword": "Встановити пароль",
"account.showAppLength": "Показати {{length}} програм",
+ "account.timezoneNoResults": "Відповідних часових поясів не знайдено",
+ "account.timezoneSearchPlaceholder": "Пошук міст або часових поясів…",
"account.verificationLabel": "Код підтвердження",
"account.verificationPlaceholder": "Вставте 6-значний код",
"account.workspaceName": "Назва робочого простору",
diff --git a/web/i18n/locales/vi-VN/account-settings.json b/web/i18n/locales/vi-VN/account-settings.json
index 103360c4faf..e57baf9a4cb 100644
--- a/web/i18n/locales/vi-VN/account-settings.json
+++ b/web/i18n/locales/vi-VN/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "Gửi mã xác minh",
"account.setPassword": "Đặt mật khẩu",
"account.showAppLength": "Hiển thị {{length}} ứng dụng",
+ "account.timezoneNoResults": "Không tìm thấy múi giờ phù hợp",
+ "account.timezoneSearchPlaceholder": "Tìm thành phố hoặc múi giờ...",
"account.verificationLabel": "Mã xác minh",
"account.verificationPlaceholder": "Dán mã gồm 6 chữ số",
"account.workspaceName": "Tên không gian làm việc",
diff --git a/web/i18n/locales/zh-Hans/account-settings.json b/web/i18n/locales/zh-Hans/account-settings.json
index a894ef862ed..2d55fac9b34 100644
--- a/web/i18n/locales/zh-Hans/account-settings.json
+++ b/web/i18n/locales/zh-Hans/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "发送验证码",
"account.setPassword": "设置密码",
"account.showAppLength": "显示 {{length}} 个应用",
+ "account.timezoneNoResults": "未找到匹配的时区",
+ "account.timezoneSearchPlaceholder": "搜索城市或时区…",
"account.verificationLabel": "验证码",
"account.verificationPlaceholder": "输入 6 位数字验证码",
"account.workspaceName": "工作空间名称",
diff --git a/web/i18n/locales/zh-Hant/account-settings.json b/web/i18n/locales/zh-Hant/account-settings.json
index 04d2cbc820a..1d7406c8de8 100644
--- a/web/i18n/locales/zh-Hant/account-settings.json
+++ b/web/i18n/locales/zh-Hant/account-settings.json
@@ -55,6 +55,8 @@
"account.sendVerificationButton": "發送驗證碼",
"account.setPassword": "設定密碼",
"account.showAppLength": "顯示 {{length}} 個應用",
+ "account.timezoneNoResults": "找不到符合的時區",
+ "account.timezoneSearchPlaceholder": "搜尋城市或時區…",
"account.verificationLabel": "驗證碼",
"account.verificationPlaceholder": "粘貼 6 位代碼",
"account.workspaceName": "工作區名稱",
diff --git a/web/i18n/resources.generated.d.ts b/web/i18n/resources.generated.d.ts
index e2841328ab6..1ecf2c535e8 100644
--- a/web/i18n/resources.generated.d.ts
+++ b/web/i18n/resources.generated.d.ts
@@ -58,6 +58,8 @@ export default interface Resources {
'account.sendVerificationButton': 'Send Verification Code'
'account.setPassword': 'Set a password'
'account.showAppLength': 'Show {{length}} apps'
+ 'account.timezoneNoResults': 'No matching time zones found'
+ 'account.timezoneSearchPlaceholder': 'Search cities or time zones...'
'account.verificationLabel': 'Verification Code'
'account.verificationPlaceholder': 'Paste the 6-digit code'
'account.workspaceName': 'Workspace Name'