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.

chore(web): improve Billing settings accessibility (#44487)

Joel2489f062949b
diff --git a/web/app/components/billing/plan/__tests__/index.spec.tsx b/web/app/components/billing/plan/__tests__/index.spec.tsx
index c7634d54d01..c416f6447ae 100644
--- a/web/app/components/billing/plan/__tests__/index.spec.tsx
+++ b/web/app/components/billing/plan/__tests__/index.spec.tsx
@@ -1,14 +1,20 @@
-import { screen } from '@testing-library/react'
+import { act, render, screen } from '@testing-library/react'
+import userEvent from '@testing-library/user-event'
import { createConsoleQueryWrapper } from '@/test/console/query-data'
-import { render } from '@/test/console/render'
import { createNuqsTestWrapper } from '@/test/nuqs-testing'
import PlanComp from '../index'
-vi.mock('@/context/workspace-state', async () => {
- const { createWorkspaceStateModuleMock } = await import('@/test/console/state-fixture')
- return createWorkspaceStateModuleMock(() => ({
- isCurrentWorkspaceManager: false,
- }))
+const getSubscription = vi.hoisted(() => vi.fn())
+
+vi.mock('@/service/console', async (importOriginal) => {
+ const actual = await importOriginal<typeof import('@/service/console')>()
+ const { withConsoleClientResponses } = await import('@/test/console/service-responses')
+ return {
+ ...actual,
+ consoleClient: withConsoleClientResponses(actual.consoleClient, {
+ 'billing.subscription.get': getSubscription,
+ }),
+ }
})
vi.mock('@/app/components/billing/usage-info', () => ({
@@ -25,10 +31,17 @@ vi.mock('../assets', () => ({
Team: () => null,
}))
-const renderPlan = (educationStatus = { allow_refresh: false, is_student: false }) => {
+const renderPlan = (
+ educationStatus = { allow_refresh: false, is_student: false },
+ role: 'normal' | 'owner' = 'normal',
+) => {
const { wrapper } = createConsoleQueryWrapper({
educationStatus,
- features: { education: { enabled: true } },
+ currentWorkspace: { role },
+ features: {
+ education: { enabled: true },
+ billing: { subscription: { plan: 'sandbox' } },
+ },
systemFeatures: { deployment_edition: 'CLOUD' },
})
@@ -41,7 +54,10 @@ const renderPlan = (educationStatus = { allow_refresh: false, is_student: false
)
}
-describe('PlanComp education verification entry', () => {
+beforeEach(() => getSubscription.mockReset())
+afterEach(() => vi.restoreAllMocks())
+
+describe('PlanComp education actions', () => {
it('links eligible accounts to education verification', () => {
renderPlan()
@@ -54,4 +70,37 @@ describe('PlanComp education verification entry', () => {
expect(screen.queryByRole('link', { name: 'education.toVerified' })).not.toBeInTheDocument()
})
+
+ it('starts yearly education checkout for a verified Sandbox owner without duplicate requests', async () => {
+ const user = userEvent.setup()
+ const checkoutUrl = 'https://checkout.example.com/education'
+ const navigate = vi.spyOn(window.location, 'href', 'set').mockImplementation(() => {})
+ let finishRequest = () => {}
+ const pendingRequest = new Promise<void>((resolve) => {
+ finishRequest = resolve
+ })
+ getSubscription.mockImplementation(async () => {
+ await pendingRequest
+ return { url: checkoutUrl }
+ })
+ renderPlan({ allow_refresh: false, is_student: true }, 'owner')
+
+ const discountButton = screen.getByRole('button', { name: 'education.useEducationDiscount' })
+ await user.click(discountButton)
+
+ expect(getSubscription).toHaveBeenCalledWith({
+ query: { plan: 'professional', interval: 'year' },
+ })
+ expect(discountButton).toBeDisabled()
+ await user.click(discountButton)
+ expect(getSubscription).toHaveBeenCalledTimes(1)
+
+ await act(async () => {
+ finishRequest()
+ await pendingRequest
+ })
+
+ expect(navigate).toHaveBeenCalledWith(checkoutUrl)
+ expect(discountButton).toBeEnabled()
+ })
})
diff --git a/web/app/components/billing/plan/assets/professional.tsx b/web/app/components/billing/plan/assets/professional.tsx
index 405da01d24a..1dc6c045ea8 100644
--- a/web/app/components/billing/plan/assets/professional.tsx
+++ b/web/app/components/billing/plan/assets/professional.tsx
@@ -1,6 +1,13 @@
const Professional = () => {
return (
- <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" fill="none">
+ <svg
+ aria-hidden="true"
+ xmlns="http://www.w3.org/2000/svg"
+ width="32"
+ height="32"
+ viewBox="0 0 32 32"
+ fill="none"
+ >
<rect
opacity="0.18"
x="4.5"
diff --git a/web/app/components/billing/plan/assets/sandbox.tsx b/web/app/components/billing/plan/assets/sandbox.tsx
index 71eec68d947..ca6264e368e 100644
--- a/web/app/components/billing/plan/assets/sandbox.tsx
+++ b/web/app/components/billing/plan/assets/sandbox.tsx
@@ -2,7 +2,14 @@ import * as React from 'react'
const Sandbox = () => {
return (
- <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" fill="none">
+ <svg
+ aria-hidden="true"
+ xmlns="http://www.w3.org/2000/svg"
+ width="32"
+ height="32"
+ viewBox="0 0 32 32"
+ fill="none"
+ >
<rect
opacity="0.18"
x="1"
diff --git a/web/app/components/billing/plan/assets/team.tsx b/web/app/components/billing/plan/assets/team.tsx
index f2a3853bc3c..d798582d5f2 100644
--- a/web/app/components/billing/plan/assets/team.tsx
+++ b/web/app/components/billing/plan/assets/team.tsx
@@ -1,6 +1,13 @@
const Team = () => {
return (
- <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" fill="none">
+ <svg
+ aria-hidden="true"
+ xmlns="http://www.w3.org/2000/svg"
+ width="32"
+ height="32"
+ viewBox="0 0 32 32"
+ fill="none"
+ >
<rect x="1" y="1" width="2" height="2" rx="1" fill="var(--color-saas-dify-blue-inverted)" />
<rect x="4.5" y="1" width="2" height="2" rx="1" fill="var(--color-saas-dify-blue-inverted)" />
<rect x="8" y="1" width="2" height="2" rx="1" fill="var(--color-saas-dify-blue-inverted)" />
diff --git a/web/app/components/billing/plan/index.tsx b/web/app/components/billing/plan/index.tsx
index 458a474ecd0..d675425224a 100644
--- a/web/app/components/billing/plan/index.tsx
+++ b/web/app/components/billing/plan/index.tsx
@@ -2,6 +2,7 @@
import type { EducationStatusResponse } from '@dify/contracts/api/console/account/types.gen'
import type { FC } from 'react'
import { Button, buttonVariants } from '@langgenius/dify-ui/button'
+import { cn } from '@langgenius/dify-ui/cn'
import { useQuery, useSuspenseQuery } from '@tanstack/react-query'
import { useAtomValue } from 'jotai'
import * as React from 'react'
@@ -62,26 +63,32 @@ const PlanComp: FC<Props> = ({ loc }) => {
const { handleEducationDiscount, isEducationDiscountLoading } = useEducationDiscount()
return (
- <div className="relative rounded-2xl border-[0.5px] border-effects-highlight-lightmode-off bg-background-section-burn">
+ <div className="@container/plan relative min-w-0 rounded-2xl border-[0.5px] border-effects-highlight-lightmode-off bg-background-section-burn">
<div className="p-6 pb-2">
{type === 'sandbox' && <Sandbox />}
{type === 'professional' && <Professional />}
{type === 'team' && <Team />}
- <div className="mt-1 flex items-center">
- <div className="grow">
+ <div className="mt-1 flex flex-col items-start gap-y-3 @min-[28rem]/plan:flex-row @min-[28rem]/plan:flex-wrap @min-[28rem]/plan:items-center">
+ <div className="max-w-full min-w-0 grow @min-[28rem]/plan:basis-52">
<div className="mb-1 flex items-center gap-1">
- <div className="system-md-semibold-uppercase text-text-primary">
+ <h4 className="system-md-semibold-uppercase wrap-anywhere text-text-primary">
{t(($) => $[`plans.${type}.name`], { ns: 'billing' })}
- </div>
+ </h4>
</div>
<div className="system-xs-regular text-util-colors-gray-gray-600">
{t(($) => $[`plans.${type}.for`], { ns: 'billing' })}
</div>
</div>
- <div className="flex shrink-0 items-center gap-1">
+ <div className="flex max-w-full shrink-0 flex-wrap items-center gap-1">
{isCloudEdition && enableEducationPlan && (!isEducationAccount || isAboutToExpire) && (
- <Link className={buttonVariants({ variant: 'ghost' })} href="/education/verify">
- <span className="i-ri-graduation-cap-line size-4" aria-hidden="true" />
+ <Link
+ className={cn(
+ buttonVariants({ variant: 'ghost' }),
+ 'h-auto min-h-8 max-w-full wrap-anywhere whitespace-normal',
+ )}
+ href="/education/verify"
+ >
+ <span className="i-ri-graduation-cap-line size-4 shrink-0" aria-hidden="true" />
{t(($) => $.toVerified, { ns: 'education' })}
</Link>
)}
@@ -92,10 +99,11 @@ const PlanComp: FC<Props> = ({ loc }) => {
isCurrentWorkspaceManager && (
<Button
variant="ghost"
+ className="h-auto min-h-8 max-w-full wrap-anywhere whitespace-normal"
onClick={handleEducationDiscount}
disabled={isEducationDiscountLoading}
>
- <span className="i-ri-graduation-cap-line size-4" aria-hidden="true" />
+ <span className="i-ri-graduation-cap-line size-4 shrink-0" aria-hidden="true" />
{t(($) => $.useEducationDiscount, { ns: 'education' })}
{isEducationDiscountLoading && (
<span
@@ -106,13 +114,18 @@ const PlanComp: FC<Props> = ({ loc }) => {
</Button>
)}
{isCloudEdition && (
- <UpgradeBtn className="shrink-0" isPlain={type === 'team'} isShort loc={loc} />
+ <UpgradeBtn
+ className="max-w-full shrink-0"
+ isPlain={type === 'team'}
+ isShort
+ loc={loc}
+ />
)}
</div>
</div>
</div>
{/* Plan detail */}
- <div className="grid grid-cols-3 content-start gap-1 p-2">
+ <div className="grid grid-cols-1 content-start gap-1 p-2 @min-[28rem]/plan:grid-cols-2 @min-[42rem]/plan:grid-cols-3">
<UsageInfo
iconClassName="i-ri-apps-2-line"
name={t(($) => $['usagePage.buildApps'], { ns: 'billing' })}
diff --git a/web/app/components/billing/usage-info/__tests__/index.spec.tsx b/web/app/components/billing/usage-info/__tests__/index.spec.tsx
new file mode 100644
index 00000000000..ca4cd43e54d
--- /dev/null
+++ b/web/app/components/billing/usage-info/__tests__/index.spec.tsx
@@ -0,0 +1,43 @@
+import { render, screen, within } from '@testing-library/react'
+import userEvent from '@testing-library/user-event'
+import UsageInfo from '../index'
+
+const storageProps = {
+ iconClassName: 'i-ri-hard-drive-3-line',
+ name: 'Knowledge Data Storage',
+ tooltip: 'High quality documents use storage.',
+ storageTooltip: 'Detailed usage is shown once storage exceeds 50 MB.',
+ usage: 20,
+ total: 50,
+ unit: 'MB',
+ storageMode: true,
+ isSandboxPlan: true,
+}
+
+describe('UsageInfo storage explanation', () => {
+ it('makes both storage explanations available from the keyboard help entry', async () => {
+ const user = userEvent.setup()
+ render(<UsageInfo {...storageProps} />)
+
+ await user.tab()
+ expect(screen.getByRole('button', { name: storageProps.name })).toHaveFocus()
+ await user.keyboard('{Enter}')
+
+ const explanation = await screen.findByRole('dialog', { name: storageProps.name })
+ expect(within(explanation).getByText(storageProps.tooltip)).toBeVisible()
+ expect(within(explanation).getByText(storageProps.storageTooltip)).toBeVisible()
+ })
+
+ it('keeps general storage help without a threshold claim when usage is unknown', async () => {
+ const user = userEvent.setup()
+ render(<UsageInfo {...storageProps} usageUnknown />)
+
+ await user.click(screen.getByRole('button', { name: storageProps.name }))
+
+ const explanation = await screen.findByRole('dialog', { name: storageProps.name })
+ expect(within(explanation).getByText(storageProps.tooltip)).toBeVisible()
+ expect(within(explanation).queryByText(storageProps.storageTooltip)).not.toBeInTheDocument()
+ expect(screen.getByText('--')).toBeVisible()
+ expect(screen.queryByRole('meter')).not.toBeInTheDocument()
+ })
+})
diff --git a/web/app/components/billing/usage-info/index.tsx b/web/app/components/billing/usage-info/index.tsx
index 9b7b5a399be..439a417dc91 100644
--- a/web/app/components/billing/usage-info/index.tsx
+++ b/web/app/components/billing/usage-info/index.tsx
@@ -4,7 +4,6 @@ import type { FC, ReactNode } from 'react'
import { cn } from '@langgenius/dify-ui/cn'
import { Infotip, InfotipContent, InfotipTrigger } from '@langgenius/dify-ui/infotip'
import { Meter, MeterIndicator, MeterTrack } from '@langgenius/dify-ui/meter'
-import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import { NUM_INFINITE } from '../config'
@@ -53,6 +52,7 @@ const UsageInfo: FC<Props> = ({
const isBelowThreshold = !usageUnknown && storageMode && usage < storageThreshold
const isSandboxFull = !usageUnknown && storageMode && isSandboxPlan && usage >= storageThreshold
+ const storageHelp = !usageUnknown && storageMode ? storageTooltip : undefined
// Zero count quotas have no remaining capacity; storage keeps its separate limit convention.
const isZeroQuota = !storageMode && total === 0
@@ -146,18 +146,6 @@ const UsageInfo: FC<Props> = ({
</Meter>
)
- const wrapWithStorageTooltip = (children: ReactNode) => {
- if (!usageUnknown && storageMode && storageTooltip) {
- return (
- <Tooltip>
- <TooltipTrigger render={<div className="cursor-default">{children}</div>} />
- <TooltipContent className="w-50 max-w-50">{storageTooltip}</TooltipContent>
- </Tooltip>
- )
- }
- return children
- }
-
return (
<div
role="group"
@@ -170,11 +158,12 @@ const UsageInfo: FC<Props> = ({
<dl className="flex flex-col gap-2">
<dt className="flex items-center gap-1 system-xs-medium text-text-tertiary">
<span id={labelId}>{name}</span>
- {tooltip && (
+ {(tooltip || storageHelp) && (
<Infotip>
<InfotipTrigger aria-labelledby={labelId} />
<InfotipContent aria-labelledby={labelId} className="w-45">
- {tooltip}
+ {tooltip && <p>{tooltip}</p>}
+ {storageHelp && <p>{storageHelp}</p>}
</InfotipContent>
</Infotip>
)}
@@ -183,11 +172,11 @@ const UsageInfo: FC<Props> = ({
data-testid="billing-quota-value"
className="flex items-center gap-1 system-md-semibold text-text-primary"
>
- {wrapWithStorageTooltip(usageDisplay)}
+ {usageDisplay}
{rightInfo}
</dd>
</dl>
- {!usageUnknown && wrapWithStorageTooltip(bar)}
+ {!usageUnknown && bar}
</div>
)
}
diff --git a/web/app/components/header/account-setting/__tests__/billing-browser-fixture.tsx b/web/app/components/header/account-setting/__tests__/billing-browser-fixture.tsx
new file mode 100644
index 00000000000..a936ef89e5b
--- /dev/null
+++ b/web/app/components/header/account-setting/__tests__/billing-browser-fixture.tsx
@@ -0,0 +1,78 @@
+import { NuqsTestingAdapter } from 'nuqs/adapters/testing'
+import { page, userEvent } from 'vite-plus/test/browser'
+import { render } from 'vitest-browser-react'
+import { consoleQuery } from '@/service/console'
+import { createConsoleQueryWrapper } from '@/test/console/query-data'
+import { QueryClientTestProvider } from '@/test/console/query-provider'
+import { ACCOUNT_SETTING_TAB } from '../constants'
+import AccountSetting from '../index'
+
+vi.mock('react-i18next', async (importOriginal) => {
+ const actual = await importOriginal<typeof import('react-i18next')>()
+ const { createReactI18nextMock } = await import('@/test/i18n-mock')
+ const namespaces = {
+ billing: (await import('@/i18n/locales/en-US/billing.json')).default,
+ common: (await import('@/i18n/locales/en-US/common.json')).default,
+ navigation: (await import('@/i18n/locales/en-US/navigation.json')).default,
+ custom: (await import('@/i18n/locales/en-US/custom.json')).default,
+ }
+ const translations = Object.fromEntries(
+ Object.entries(namespaces).flatMap(([namespace, messages]) =>
+ Object.entries(messages).map(([key, value]) => [`${namespace}.${key}`, value]),
+ ),
+ )
+ return { ...actual, ...createReactI18nextMock(translations) }
+})
+
+const unexpectedFetch = vi.fn(() => Promise.reject(new Error('Unexpected request')))
+beforeEach(() => vi.stubGlobal('fetch', unexpectedFetch))
+afterEach(() => {
+ expect(unexpectedFetch).not.toHaveBeenCalled()
+ vi.unstubAllGlobals()
+})
+
+export async function renderBillingSettings() {
+ await page.viewport(320, 800)
+ const { queryClient } = createConsoleQueryWrapper({
+ currentWorkspace: { role: 'normal' },
+ workspacePermissionKeys: [],
+ features: { billing: { subscription: { plan: 'team' } } },
+ systemFeatures: { deployment_edition: 'CLOUD', rbac_enabled: false },
+ })
+ queryClient.setQueryData(consoleQuery.features.vectorSpace.get.queryOptions().queryKey, {
+ size: 60,
+ limit: 1024,
+ usage_unknown: false,
+ })
+
+ const screen = await render(
+ <QueryClientTestProvider queryClient={queryClient}>
+ <NuqsTestingAdapter>
+ <AccountSetting
+ activeTab={ACCOUNT_SETTING_TAB.BILLING}
+ onCancelAction={vi.fn()}
+ onTabChangeAction={vi.fn()}
+ />
+ </NuqsTestingAdapter>
+ </QueryClientTestProvider>,
+ )
+ const dialog = screen.getByRole('dialog', { name: 'Settings' })
+ const viewPlan = dialog.getByRole('button', { name: 'View Plan' })
+ await expect.element(viewPlan).toBeInTheDocument()
+ await expect.element(dialog.getByRole('button', { name: 'Close' })).toHaveFocus()
+
+ // A regular member sees these destinations before the scrollable panel.
+ for (const name of ['Members', 'Billing', 'Customization', 'Preferences']) {
+ await userEvent.tab()
+ await expect.element(dialog.getByRole('button', { name })).toHaveFocus()
+ }
+ await userEvent.tab()
+
+ const viewport = document.activeElement
+ expect(viewport).toBeInstanceOf(HTMLElement)
+ const scrollable = viewport as HTMLElement
+ expect(scrollable.scrollHeight).toBeGreaterThan(scrollable.clientHeight)
+ expect(scrollable.contains(viewPlan.element())).toBe(true)
+
+ return { dialog, viewPlan, viewport: scrollable }
+}
diff --git a/web/app/components/header/account-setting/__tests__/billing-focus-obscured.browser.spec.tsx b/web/app/components/header/account-setting/__tests__/billing-focus-obscured.browser.spec.tsx
new file mode 100644
index 00000000000..133f480e847
--- /dev/null
+++ b/web/app/components/header/account-setting/__tests__/billing-focus-obscured.browser.spec.tsx
@@ -0,0 +1,29 @@
+import { userEvent } from 'vite-plus/test/browser'
+import { renderBillingSettings } from './billing-browser-fixture'
+
+it('keeps View Plan exposed when keyboard focus scrolls back from the bottom of Billing', async () => {
+ const { dialog, viewPlan, viewport } = await renderBillingSettings()
+
+ // Native scroll-on-focus previously placed View Plan underneath the sticky Billing heading.
+ // The unit tests cannot establish whether a focused control is actually covered.
+ await userEvent.keyboard('{End}')
+ await expect
+ .poll(() => viewport.scrollTop + viewport.clientHeight)
+ .toBeGreaterThanOrEqual(viewport.scrollHeight - 1)
+ await userEvent.tab()
+ await expect.element(viewPlan).toHaveFocus()
+
+ const description = dialog.getByText(
+ 'Only team owner and team admin can subscribe and view billing information',
+ )
+ await expect.element(description).toBeVisible()
+ const actionRect = viewPlan.element().getBoundingClientRect()
+ const descriptionRect = description.element().getBoundingClientRect()
+ expect(actionRect.top).toBeGreaterThanOrEqual(descriptionRect.bottom)
+ expect(actionRect.bottom).toBeLessThanOrEqual(window.innerHeight)
+ const hit = document.elementFromPoint(
+ actionRect.left + actionRect.width / 2,
+ actionRect.top + actionRect.height / 2,
+ )
+ expect(viewPlan.element().contains(hit)).toBe(true)
+})
diff --git a/web/app/components/header/account-setting/__tests__/settings-modal.spec.tsx b/web/app/components/header/account-setting/__tests__/settings-modal.spec.tsx
index 04aa1aae96b..299d47f0ac1 100644
--- a/web/app/components/header/account-setting/__tests__/settings-modal.spec.tsx
+++ b/web/app/components/header/account-setting/__tests__/settings-modal.spec.tsx
@@ -179,6 +179,12 @@ it('opens preferences from the URL control, switches real pages, and closes with
for (const { name, tab, content } of destinations) {
await user.click(within(dialog).getByRole('button', { name }))
expect(await within(dialog).findByText(content)).toBeInTheDocument()
+ if (tab === TAB.BILLING) {
+ expect(within(dialog).getByRole('heading', { name, level: 3 })).toBeInTheDocument()
+ expect(
+ within(dialog).getByRole('heading', { name: 'billing.plans.sandbox.name', level: 4 }),
+ ).toBeInTheDocument()
+ }
expect(within(dialog).getByRole('button', { current: 'page' })).toHaveAccessibleName(name)
await waitFor(() =>
expect(onUrlUpdate.mock.lastCall?.[0].searchParams.get('settings')).toBe(tab),
diff --git a/web/app/components/header/account-setting/index.tsx b/web/app/components/header/account-setting/index.tsx
index a68baaa3a9d..db8c25616e1 100644
--- a/web/app/components/header/account-setting/index.tsx
+++ b/web/app/components/header/account-setting/index.tsx
@@ -27,7 +27,6 @@ import {
import { env } from '@/env'
import { canReadNetworkAccessAtom } from '@/features/network-access/permissions'
import { systemFeaturesQueryOptions } from '@/features/system-features/client'
-import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
import { consoleQuery } from '@/service/console'
import { hasPermission } from '@/utils/permission'
import AccessRulesPage from './access-rules-page'
@@ -196,8 +195,6 @@ export default function AccountSetting({
.filter((item): item is GroupItem => Boolean(item))
})()
- const media = useBreakpoints()
- const isMobile = media === MediaType.mobile
const preferenceItem = settingItems.find((item) => item.key === ACCOUNT_SETTING_TAB.PREFERENCES)
const menuItems = [
@@ -228,8 +225,8 @@ export default function AccountSetting({
key={menuItem.key}
className={cn(menuItem.key === 'workspace-group' ? 'mb-2' : 'mt-2')}
>
- {menuItem.name && !isMobile && (
- <div className="flex h-7 items-center px-3 system-xs-medium-uppercase text-text-tertiary">
+ {menuItem.name && (
+ <div className="hidden h-7 items-center px-3 system-xs-medium-uppercase text-text-tertiary sm:flex">
{menuItem.name}
</div>
)}
@@ -256,7 +253,7 @@ export default function AccountSetting({
}}
>
{activeMenu === item.key ? item.activeIcon : item.icon}
- {!isMobile && <div className="truncate">{item.name}</div>}
+ <div className="hidden truncate sm:block">{item.name}</div>
</button>
))}
</div>
@@ -269,30 +266,30 @@ export default function AccountSetting({
aria-hidden
className="pointer-events-none absolute inset-y-0 left-full w-screen bg-components-panel-bg"
/>
- <ScrollArea className="h-full min-h-0 min-w-0 flex-1 bg-components-panel-bg">
+ <ScrollArea className="flex h-full min-h-0 min-w-0 flex-1 flex-col bg-components-panel-bg">
+ {activeMenu !== ACCOUNT_SETTING_TAB.IP_POLICIES && (
+ <div className="mx-4 flex min-h-15 shrink-0 items-end bg-components-panel-bg pt-8 pr-12 pb-2 sm:mx-8">
+ <div className="min-w-0 flex-1">
+ <h3 className="title-2xl-semi-bold text-text-primary">
+ {activeItem?.title ?? activeItem?.name}
+ </h3>
+ {activeItem?.description && (
+ <p className="mt-1 system-sm-regular wrap-break-word whitespace-normal text-text-tertiary">
+ {activeItem?.description}
+ </p>
+ )}
+ </div>
+ </div>
+ )}
<ScrollAreaViewport
ref={scrollContainerRef}
style={{ overflowX: 'hidden' }}
- className="overscroll-contain"
+ className="min-h-0 flex-1 overscroll-contain"
>
<ScrollAreaContent
style={{ minWidth: 0 }}
className="min-h-full w-full max-w-full pb-4"
>
- {activeMenu !== ACCOUNT_SETTING_TAB.IP_POLICIES && (
- <div className="sticky top-0 z-20 mx-8 flex min-h-15 items-end bg-components-panel-bg pt-8 pb-2">
- <div className="min-w-0 flex-1">
- <h3 className="title-2xl-semi-bold text-text-primary">
- {activeItem?.title ?? activeItem?.name}
- </h3>
- {activeItem?.description && (
- <div className="mt-1 system-sm-regular wrap-break-word whitespace-normal text-text-tertiary">
- {activeItem?.description}
- </div>
- )}
- </div>
- </div>
- )}
<div className="max-w-full min-w-0 px-4 pt-6 sm:px-8">
{/* First-use translations and queries must not suspend the dialog shell. */}
<Suspense fallback={<LoadingPlaceholder className="py-10" />}>