refactor: rename name→displayName across client

This commit is contained in:
Kirill
2026-05-20 11:00:28 +05:00
parent 8d9c250eb7
commit 00b74e56d7
7 changed files with 21 additions and 15 deletions
+1 -1
View File
@@ -81,7 +81,7 @@ export function MeLayoutPage() {
Кабинет
</Typography>
<Typography variant="body2" color="text.secondary">
{user.name?.trim() || user.email}
{user.displayName?.trim() || user.email}
</Typography>
</Box>
<Divider sx={{ my: 1 }} />
+5 -5
View File
@@ -38,8 +38,8 @@ export function MePage() {
mode: 'onChange',
})
const profileForm = useForm<{ name: string }>({
defaultValues: { name: user?.name ? String(user.name) : '' },
const profileForm = useForm<{ displayName: string }>({
defaultValues: { displayName: user?.displayName ? String(user.displayName) : '' },
mode: 'onChange',
})
@@ -80,15 +80,15 @@ export function MePage() {
label="Имя или ник"
helperText="До 40 символов"
slotProps={{ htmlInput: { maxLength: 40 } }}
{...profileForm.register('name')}
{...profileForm.register('displayName')}
/>
<Button
variant="contained"
disabled={pendingProfile}
onClick={() => {
const raw = profileForm.getValues('name')
const raw = profileForm.getValues('displayName')
const name = raw.trim()
updateProfileFx({ name: name.length ? name : null })
updateProfileFx({ displayName: name.length ? name : null })
}}
>
Сохранить имя
@@ -38,8 +38,11 @@ export function SettingsPage() {
mode: 'onChange',
})
const profileForm = useForm<{ name: string; phone: string }>({
defaultValues: { name: user?.name ? String(user.name) : '', phone: user?.phone ? String(user.phone) : '' },
const profileForm = useForm<{ displayName: string; phone: string }>({
defaultValues: {
displayName: user?.displayName ? String(user.displayName) : '',
phone: user?.phone ? String(user.phone) : '',
},
mode: 'onChange',
})
@@ -80,7 +83,7 @@ export function SettingsPage() {
label="Имя или ник"
helperText="До 40 символов"
slotProps={{ htmlInput: { maxLength: 40 } }}
{...profileForm.register('name')}
{...profileForm.register('displayName')}
/>
<TextField
label="Телефон"
@@ -91,11 +94,11 @@ export function SettingsPage() {
variant="contained"
disabled={pendingProfile}
onClick={() => {
const raw = profileForm.getValues('name')
const raw = profileForm.getValues('displayName')
const name = raw.trim()
const phoneRaw = profileForm.getValues('phone')
const phone = phoneRaw.trim()
updateProfileFx({ name: name.length ? name : null, phone: phone.length ? phone : null })
updateProfileFx({ displayName: name.length ? name : null, phone: phone.length ? phone : null })
}}
>
Сохранить