fix(desktop): wrap activity profile names

This commit is contained in:
程序员阿江(Relakkes)
2026-09-27 14:08:12 +08:00
parent 700f7b9dcc
commit d4e53a9fab
2 changed files with 9 additions and 5 deletions
+7 -3
View File
@@ -324,17 +324,21 @@ describe('ActivitySettings', () => {
fireEvent.click(screen.getByRole('button', { name: '编辑个人资料' }))
const input = screen.getByLabelText('显示名称')
fireEvent.change(input, { target: { value: '本地舰长' } })
const displayName = '大厂程序员阿江的 Token 活动统计展示'
fireEvent.change(input, { target: { value: displayName } })
fireEvent.change(screen.getByLabelText('第二行'), { target: { value: 'relakkes.dev' } })
fireEvent.click(screen.getByRole('button', { name: '保存' }))
await flushActivityLoad()
expect(updateProfilePreferencesMock).toHaveBeenCalledWith({
displayName: '本地舰长',
displayName,
subtitle: 'relakkes.dev',
})
expect(screen.getByText('本地舰长')).toBeInTheDocument()
const heading = screen.getByRole('heading', { name: displayName })
expect(heading).toHaveClass('break-words')
expect(heading).not.toHaveClass('truncate')
expect(heading.parentElement).toHaveClass('w-full')
expect(screen.getByRole('link', { name: 'relakkes.dev' })).toHaveAttribute('href', 'https://relakkes.dev')
})
+2 -2
View File
@@ -784,8 +784,8 @@ export function ActivitySettings() {
}}
/>
</div>
<div className="group/activity-profile mt-4 flex max-w-full items-center justify-center gap-2">
<h1 className="max-w-[min(720px,calc(100%-2.25rem))] truncate text-[26px] font-semibold text-[var(--color-text-primary)] sm:text-[31px]" style={{ fontFamily: 'var(--font-headline)' }}>{profile.displayName}</h1>
<div className="group/activity-profile mt-4 flex w-full max-w-[756px] items-start justify-center gap-2">
<h1 className="min-w-0 max-w-[720px] whitespace-normal break-words text-[26px] font-semibold text-[var(--color-text-primary)] sm:text-[31px]" style={{ fontFamily: 'var(--font-headline)' }}>{profile.displayName}</h1>
<button
type="button"
aria-label={t('settings.activity.editProfile')}