Skip to content

Commit 3a32741

Browse files
committed
refactor: improve form layout and i18n configuration
- Replace Group with Stack in register form for better vertical alignment - Conditionally set i18n debug mode based on environment - Update ApiTokenCardWidget to correctly type forwardRef
1 parent 9d04331 commit 3a32741

File tree

3 files changed

+25
-24
lines changed

3 files changed

+25
-24
lines changed

src/app/i18n/i18n.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ i18n.use(initReactI18next)
88
.use(HttpApi)
99
.init({
1010
fallbackLng: 'en',
11-
debug: true,
11+
debug: process.env.NODE_ENV === 'development',
1212
defaultNS: ['remnawave'],
1313
ns: ['remnawave'],
1414
detection: {

src/features/auth/register-form/register-form.feature.tsx

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import {
22
Button,
33
Container,
4-
Group,
54
Paper,
65
PasswordInput,
6+
Stack,
77
Text,
88
TextInput,
99
Title
@@ -117,7 +117,7 @@ export const RegisterFormFeature = () => {
117117
{...form.getInputProps('username')}
118118
/>
119119

120-
<Group align="flex-end" mt="md">
120+
<Stack mt="md">
121121
<PasswordInput
122122
label={t('register-form.feature.password')}
123123
placeholder="soy_t5Px5`Gm4j0@Hf&Dd7iU"
@@ -126,27 +126,27 @@ export const RegisterFormFeature = () => {
126126
style={{ flex: 1 }}
127127
{...form.getInputProps('password')}
128128
/>
129-
</Group>
130129

131-
<PasswordInput
132-
label={t('register-form.feature.confirm-password')}
133-
mt="md"
134-
placeholder="soy_t5Px5`Gm4j0@Hf&Dd7iU"
135-
required
136-
size="md"
137-
{...form.getInputProps('confirmPassword')}
138-
/>
130+
<PasswordInput
131+
label={t('register-form.feature.confirm-password')}
132+
mt="md"
133+
placeholder="soy_t5Px5`Gm4j0@Hf&Dd7iU"
134+
required
135+
size="md"
136+
{...form.getInputProps('confirmPassword')}
137+
/>
139138

140-
<Button
141-
fullWidth
142-
leftSection={<PiShuffleDuotone size="1rem" />}
143-
mt="xl"
144-
onClick={handleGeneratePassword}
145-
size="md"
146-
variant="light"
147-
>
148-
{t('register-form.feature.generate')}
149-
</Button>
139+
<Button
140+
fullWidth
141+
leftSection={<PiShuffleDuotone size="1rem" />}
142+
mt="xl"
143+
onClick={handleGeneratePassword}
144+
size="md"
145+
variant="light"
146+
>
147+
{t('register-form.feature.generate')}
148+
</Button>
149+
</Stack>
150150

151151
<Button
152152
fullWidth

src/widgets/dashboard/api-tokens/api-token-card/api-token-card.widget.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { Badge, Button, Container, Group, Text } from '@mantine/core'
22
import { PiCheck, PiCopy, PiTrash } from 'react-icons/pi'
33
import { notifications } from '@mantine/notifications'
4+
import { ForwardedRef, forwardRef } from 'react'
45
import { useTranslation } from 'react-i18next'
56
import { useClipboard } from '@mantine/hooks'
67
import { motion } from 'framer-motion'
78
import ColorHash from 'color-hash'
8-
import { forwardRef } from 'react'
99
import dayjs from 'dayjs'
1010

1111
import { QueryKeys, useDeleteApiToken } from '@shared/api/hooks'
@@ -14,7 +14,7 @@ import { queryClient } from '@shared/api'
1414
import classes from './ApiTokenCard.module.css'
1515
import { IProps } from './interfaces'
1616

17-
export const ApiTokenCardWidget = forwardRef((props: IProps) => {
17+
export const ApiTokenCardWidget = forwardRef((props: IProps, ref: ForwardedRef<HTMLDivElement>) => {
1818
const { t } = useTranslation()
1919

2020
const { apiToken } = props
@@ -54,6 +54,7 @@ export const ApiTokenCardWidget = forwardRef((props: IProps) => {
5454
animate={{ opacity: 1, rotateX: 0, y: 0 }}
5555
exit={{ opacity: 0, rotateX: 80, y: 100 }}
5656
initial={{ opacity: 0, rotateX: -80, y: -100 }}
57+
ref={ref}
5758
style={{ perspective: 1000 }}
5859
transition={{
5960
duration: 0.4,

0 commit comments

Comments
 (0)