Skip to content

Commit d6783b4

Browse files
committed
style: format with prettier
1 parent a799a2b commit d6783b4

File tree

3 files changed

+64
-23
lines changed

3 files changed

+64
-23
lines changed

src/components/account/AuthFormShared.tsx

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,64 @@
11
import { InputGroup, InputGroupProps2 } from '@blueprintjs/core'
2-
import { ControllerProps, FieldValues, UseControllerProps } from 'react-hook-form'
2+
3+
import {
4+
ControllerProps,
5+
FieldValues,
6+
UseControllerProps,
7+
} from 'react-hook-form'
38
import { useTranslation } from 'react-i18next'
9+
410
import { FormField, FormFieldProps } from 'components/FormField'
511
import { REGEX_EMAIL, REGEX_USERNAME } from 'utils/regexes'
612

713
export type RuleKeys = 'email' | 'password' | 'username' | 'registertoken'
814

9-
// Define rules with translation keys
1015
export const rule: Record<RuleKeys, UseControllerProps['rules']> = {
1116
email: {
1217
required: 'components.account.AuthFormShared.email_required',
13-
pattern: { value: REGEX_EMAIL, message: 'components.account.AuthFormShared.email_invalid' },
18+
pattern: {
19+
value: REGEX_EMAIL,
20+
message: 'components.account.AuthFormShared.email_invalid',
21+
},
1422
},
1523
password: {
1624
required: 'components.account.AuthFormShared.password_required',
17-
minLength: { value: 8, message: 'components.account.AuthFormShared.password_min_length' },
18-
maxLength: { value: 32, message: 'components.account.AuthFormShared.password_max_length' },
25+
minLength: {
26+
value: 8,
27+
message: 'components.account.AuthFormShared.password_min_length',
28+
},
29+
maxLength: {
30+
value: 32,
31+
message: 'components.account.AuthFormShared.password_max_length',
32+
},
1933
},
2034
username: {
2135
required: 'components.account.AuthFormShared.username_required',
22-
minLength: { value: 4, message: 'components.account.AuthFormShared.username_min_length' },
23-
maxLength: { value: 24, message: 'components.account.AuthFormShared.username_max_length' },
24-
pattern: { value: REGEX_USERNAME, message: 'components.account.AuthFormShared.username_pattern' },
36+
minLength: {
37+
value: 4,
38+
message: 'components.account.AuthFormShared.username_min_length',
39+
},
40+
maxLength: {
41+
value: 24,
42+
message: 'components.account.AuthFormShared.username_max_length',
43+
},
44+
pattern: {
45+
value: REGEX_USERNAME,
46+
message: 'components.account.AuthFormShared.username_pattern',
47+
},
2548
},
2649
registertoken: {
2750
required: 'components.account.AuthFormShared.token_required',
28-
minLength: { value: 6, message: 'components.account.AuthFormShared.token_length' },
29-
maxLength: { value: 6, message: 'components.account.AuthFormShared.token_length' },
51+
minLength: {
52+
value: 6,
53+
message: 'components.account.AuthFormShared.token_length',
54+
},
55+
maxLength: {
56+
value: 6,
57+
message: 'components.account.AuthFormShared.token_length',
58+
},
3059
},
3160
}
3261

33-
// Helper function that translates rule messages
3462
function useTranslatedRules() {
3563
const { t } = useTranslation()
3664

@@ -102,7 +130,9 @@ export const AuthFormEmailField = <T extends FieldValues>({
102130
),
103131
}}
104132
FormGroupProps={{
105-
helperText: register && t('components.account.AuthFormShared.email_verification_note'),
133+
helperText:
134+
register &&
135+
t('components.account.AuthFormShared.email_verification_note'),
106136
}}
107137
/>
108138
)
@@ -140,7 +170,9 @@ export const AuthRegistrationTokenField = <T extends FieldValues>({
140170
),
141171
}}
142172
FormGroupProps={{
143-
helperText: register && t('components.account.AuthFormShared.token_verification_note'),
173+
helperText:
174+
register &&
175+
t('components.account.AuthFormShared.token_verification_note'),
144176
}}
145177
/>
146178
)

src/hooks/useLinks.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useTranslation } from 'react-i18next'
2+
23
import { NAV_CONFIG, SOCIAL_CONFIG } from '../links'
34

45
export const useLinks = () => {
@@ -10,11 +11,13 @@ export const useLinks = () => {
1011
icon,
1112
}))
1213

13-
const SOCIAL_LINKS = SOCIAL_CONFIG.map(({ icon, href, labelKey, labelParams }) => ({
14-
icon,
15-
href,
16-
label: t(labelKey, labelParams),
17-
}))
14+
const SOCIAL_LINKS = SOCIAL_CONFIG.map(
15+
({ icon, href, labelKey, labelParams }) => ({
16+
icon,
17+
href,
18+
label: t(labelKey, labelParams),
19+
}),
20+
)
1821

1922
return { NAV_LINKS, SOCIAL_LINKS }
2023
}

src/links.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Icon as BlueprintIcon, IconName } from '@blueprintjs/core'
2-
import { Icon as IconifyIcon } from '@iconify/react'
32
import simpleIconsGitHub from '@iconify/icons-simple-icons/github'
43
import simpleIconsQQ from '@iconify/icons-simple-icons/tencentqq'
4+
import { Icon as IconifyIcon } from '@iconify/react'
55

66
export const NAV_CONFIG: {
77
to: string
@@ -22,7 +22,7 @@ export const NAV_CONFIG: {
2222
to: '/about',
2323
labelKey: 'links.about',
2424
icon: 'info-sign',
25-
}
25+
},
2626
]
2727

2828
export const SOCIAL_CONFIG = [
@@ -37,17 +37,23 @@ export const SOCIAL_CONFIG = [
3737
labelKey: 'links.feedback',
3838
},
3939
{
40-
icon: <IconifyIcon icon={simpleIconsGitHub} className="mr-2" fontSize="12px" />,
40+
icon: (
41+
<IconifyIcon icon={simpleIconsGitHub} className="mr-2" fontSize="12px" />
42+
),
4143
href: 'https://github.com/MaaAssistantArknights/MaaAssistantArknights',
4244
labelKey: 'links.maa_repo',
4345
},
4446
{
45-
icon: <IconifyIcon icon={simpleIconsGitHub} className="mr-2" fontSize="12px" />,
47+
icon: (
48+
<IconifyIcon icon={simpleIconsGitHub} className="mr-2" fontSize="12px" />
49+
),
4650
href: 'https://github.com/MaaAssistantArknights/maa-copilot-frontend',
4751
labelKey: 'links.frontend_repo',
4852
},
4953
{
50-
icon: <IconifyIcon icon={simpleIconsGitHub} className="mr-2" fontSize="12px" />,
54+
icon: (
55+
<IconifyIcon icon={simpleIconsGitHub} className="mr-2" fontSize="12px" />
56+
),
5157
href: 'https://github.com/MaaAssistantArknights/MaaBackendCenter',
5258
labelKey: 'links.backend_repo',
5359
},

0 commit comments

Comments
 (0)