Skip to content

Commit 1eed5d3

Browse files
chore: change prettier printWidth (#710)
* chore: change prettier printWidth from default 80 to 100 * chore: reformat with prettier
1 parent d0ad426 commit 1eed5d3

File tree

518 files changed

+3416
-9216
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

518 files changed

+3416
-9216
lines changed

packages/app-builder/scripts/generateRoutes.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ function getRoutesPaths(routes: readonly Route[], prefix?: string): string[] {
3232
: '';
3333

3434
return Array.from(
35-
new Set([
36-
joinedPath || '/',
37-
...getRoutesPaths(route.children ?? [], joinedPath),
38-
]),
35+
new Set([joinedPath || '/', ...getRoutesPaths(route.children ?? [], joinedPath)]),
3936
);
4037
});
4138
}

packages/app-builder/src/components/Auth/AuthError.tsx

+2-11
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,11 @@ const errorLabels: Record<AuthErrors, ParseKeys<typeof authI18n>> = {
1212
BackendUnavailable: 'common:errors.backend_unvailable',
1313
};
1414

15-
export function AuthError({
16-
error,
17-
className,
18-
}: {
19-
error: AuthErrors;
20-
className?: string;
21-
}) {
15+
export function AuthError({ error, className }: { error: AuthErrors; className?: string }) {
2216
const { t } = useTranslation(authI18n);
2317
return (
2418
<p
25-
className={clsx(
26-
'text-m bg-red-95 text-red-47 w-full rounded-sm p-2 font-normal',
27-
className,
28-
)}
19+
className={clsx('text-m bg-red-95 text-red-47 w-full rounded-sm p-2 font-normal', className)}
2920
>
3021
{t(errorLabels[error])}
3122
</p>

packages/app-builder/src/components/Auth/PopupBlockedError.tsx

+2-7
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,14 @@ export function PopupBlockedError() {
2020

2121
const hrefMap = {
2222
Safari: 'https://support.apple.com/guide/safari/sfri40696/mac',
23-
Firefox:
24-
'https://support.mozilla.org/en-US/kb/pop-blocker-settings-exceptions-troubleshooting',
23+
Firefox: 'https://support.mozilla.org/en-US/kb/pop-blocker-settings-exceptions-troubleshooting',
2524
Chrome: 'https://support.google.com/chrome/answer/95472',
2625
};
2726

2827
function EnablePopup({ children }: { children?: React.ReactNode }) {
2928
const browser = getCurrentBrowser(navigator.userAgent);
3029
if (browser in hrefMap) {
31-
return (
32-
<ExternalLink href={hrefMap[browser as keyof typeof hrefMap]}>
33-
{children}
34-
</ExternalLink>
35-
);
30+
return <ExternalLink href={hrefMap[browser as keyof typeof hrefMap]}>{children}</ExternalLink>;
3631
}
3732
return <span>{children}</span>;
3833
}

packages/app-builder/src/components/Auth/SendEmailVerification.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,7 @@ function ClientSendEmailVerificationDescription() {
109109
export function SendEmailVerificationDescription() {
110110
const { t } = useTranslation(['auth']);
111111
return (
112-
<ClientOnly
113-
fallback={<Trans t={t} i18nKey="auth:email-verification.description" />}
114-
>
112+
<ClientOnly fallback={<Trans t={t} i18nKey="auth:email-verification.description" />}>
115113
{() => <ClientSendEmailVerificationDescription />}
116114
</ClientOnly>
117115
);

packages/app-builder/src/components/Auth/SignInWithEmailAndPassword.tsx

+44-63
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,8 @@ export function SignInWithEmailAndPassword({
5555

5656
return (
5757
<FormProvider {...formMethods}>
58-
<ClientOnly
59-
fallback={<SignInWithEmailAndPasswordForm loading={loading} />}
60-
>
61-
{() => (
62-
<ClientSignInWithEmailAndPasswordForm
63-
loading={loading}
64-
signIn={signIn}
65-
/>
66-
)}
58+
<ClientOnly fallback={<SignInWithEmailAndPasswordForm loading={loading} />}>
59+
{() => <ClientSignInWithEmailAndPasswordForm loading={loading} signIn={signIn} />}
6760
</ClientOnly>
6861
</FormProvider>
6962
);
@@ -87,12 +80,7 @@ function SignInWithEmailAndPasswordForm({
8780
<FormItem className="flex flex-col items-start gap-2">
8881
<FormLabel>{t('auth:sign_in.email')}</FormLabel>
8982
<FormControl>
90-
<Input
91-
disabled={!hydrated}
92-
className="w-full"
93-
type="email"
94-
{...field}
95-
/>
83+
<Input disabled={!hydrated} className="w-full" type="email" {...field} />
9684
</FormControl>
9785
<FormError />
9886
</FormItem>
@@ -117,11 +105,7 @@ function SignInWithEmailAndPasswordForm({
117105
</FormItem>
118106
)}
119107
/>
120-
<FormField
121-
control={control}
122-
name="credentials"
123-
render={() => <FormError />}
124-
/>
108+
<FormField control={control} name="credentials" render={() => <FormError />} />
125109
<Button type="submit" disabled={!hydrated}>
126110
{loading ? <Spinner className="size-4" /> : t('auth:sign_in')}
127111
</Button>
@@ -142,53 +126,50 @@ function ClientSignInWithEmailAndPasswordForm({
142126
clientServices.authenticationClientService,
143127
);
144128

145-
const { handleSubmit, setError, formState } =
146-
useFormContext<EmailAndPasswordFormValues>();
129+
const { handleSubmit, setError, formState } = useFormContext<EmailAndPasswordFormValues>();
147130
const navigate = useNavigate();
148131

149-
const handleEmailSignIn = handleSubmit(
150-
async ({ credentials: { email, password } }) => {
151-
try {
152-
const result = await emailAndPasswordSignIn(email, password);
132+
const handleEmailSignIn = handleSubmit(async ({ credentials: { email, password } }) => {
133+
try {
134+
const result = await emailAndPasswordSignIn(email, password);
153135

154-
if (!result) return;
155-
const { idToken, csrf } = result;
156-
if (!idToken) return;
157-
signIn({ type: 'email', idToken, csrf });
158-
// Hack to wait for the form to be submitted, otherwise the loading spinner will be flickering
159-
await sleep(1000);
160-
} catch (error) {
161-
if (error instanceof EmailUnverified) {
162-
navigate(getRoute('/email-verification'));
163-
} else if (error instanceof UserNotFoundError) {
164-
setError(
165-
'credentials.email',
166-
{
167-
message: t('auth:sign_in.errors.user_not_found'),
168-
},
169-
{ shouldFocus: true },
170-
);
171-
} else if (error instanceof WrongPasswordError) {
172-
setError(
173-
'credentials.password',
174-
{
175-
message: t('auth:sign_in.errors.wrong_password_error'),
176-
},
177-
{ shouldFocus: true },
178-
);
179-
} else if (error instanceof InvalidLoginCredentials) {
180-
setError('credentials', {
181-
message: t('auth:sign_in.errors.invalid_login_credentials'),
182-
});
183-
} else if (error instanceof NetworkRequestFailed) {
184-
toast.error(t('common:errors.firebase_network_error'));
185-
} else {
186-
Sentry.captureException(error);
187-
toast.error(t('common:errors.unknown'));
188-
}
136+
if (!result) return;
137+
const { idToken, csrf } = result;
138+
if (!idToken) return;
139+
signIn({ type: 'email', idToken, csrf });
140+
// Hack to wait for the form to be submitted, otherwise the loading spinner will be flickering
141+
await sleep(1000);
142+
} catch (error) {
143+
if (error instanceof EmailUnverified) {
144+
navigate(getRoute('/email-verification'));
145+
} else if (error instanceof UserNotFoundError) {
146+
setError(
147+
'credentials.email',
148+
{
149+
message: t('auth:sign_in.errors.user_not_found'),
150+
},
151+
{ shouldFocus: true },
152+
);
153+
} else if (error instanceof WrongPasswordError) {
154+
setError(
155+
'credentials.password',
156+
{
157+
message: t('auth:sign_in.errors.wrong_password_error'),
158+
},
159+
{ shouldFocus: true },
160+
);
161+
} else if (error instanceof InvalidLoginCredentials) {
162+
setError('credentials', {
163+
message: t('auth:sign_in.errors.invalid_login_credentials'),
164+
});
165+
} else if (error instanceof NetworkRequestFailed) {
166+
toast.error(t('common:errors.firebase_network_error'));
167+
} else {
168+
Sentry.captureException(error);
169+
toast.error(t('common:errors.unknown'));
189170
}
190-
},
191-
);
171+
}
172+
});
192173

193174
return (
194175
<SignInWithEmailAndPasswordForm

packages/app-builder/src/components/Auth/SignInWithGoogle.tsx

+3-13
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,7 @@ import { Logo } from 'ui-icons';
1717
import { Spinner } from '../Spinner';
1818
import { PopupBlockedError } from './PopupBlockedError';
1919

20-
function SignInWithGoogleButton({
21-
onClick,
22-
loading,
23-
}: {
24-
onClick?: () => void;
25-
loading?: boolean;
26-
}) {
20+
function SignInWithGoogleButton({ onClick, loading }: { onClick?: () => void; loading?: boolean }) {
2721
const { t } = useTranslation(['auth']);
2822

2923
return (
@@ -53,9 +47,7 @@ function ClientSignInWithGoogle({
5347
loading?: boolean;
5448
}) {
5549
const { t } = useTranslation(['common', 'auth']);
56-
const googleSignIn = useGoogleSignIn(
57-
clientServices.authenticationClientService,
58-
);
50+
const googleSignIn = useGoogleSignIn(clientServices.authenticationClientService);
5951

6052
const [handleGoogleSignIn, _state] = useAsync(async () => {
6153
try {
@@ -66,9 +58,7 @@ function ClientSignInWithGoogle({
6658
signIn({ type: 'google', idToken, csrf });
6759
} catch (error) {
6860
if (error instanceof AccountExistsWithDifferentCredential) {
69-
toast.error(
70-
t('common:errors.account_exists_with_different_credential'),
71-
);
61+
toast.error(t('common:errors.account_exists_with_different_credential'));
7262
} else if (error instanceof PopupBlockedByClient) {
7363
toast.error(<PopupBlockedError />);
7464
} else if (error instanceof NetworkRequestFailed) {

packages/app-builder/src/components/Auth/SignInWithMicrosoft.tsx

+2-6
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ function ClientSignInWithMicrosoft({
5555
loading?: boolean;
5656
}) {
5757
const { t } = useTranslation(['common', 'auth']);
58-
const microsoftSignIn = useMicrosoftSignIn(
59-
clientServices.authenticationClientService,
60-
);
58+
const microsoftSignIn = useMicrosoftSignIn(clientServices.authenticationClientService);
6159

6260
const [handleMicrosoftSignIn, _state] = useAsync(async () => {
6361
try {
@@ -68,9 +66,7 @@ function ClientSignInWithMicrosoft({
6866
signIn({ type: 'microsoft', idToken, csrf });
6967
} catch (error) {
7068
if (error instanceof AccountExistsWithDifferentCredential) {
71-
toast.error(
72-
t('common:errors.account_exists_with_different_credential'),
73-
);
69+
toast.error(t('common:errors.account_exists_with_different_credential'));
7470
} else if (error instanceof PopupBlockedByClient) {
7571
toast.error(<PopupBlockedError />);
7672
} else if (error instanceof NetworkRequestFailed) {

packages/app-builder/src/components/Auth/SignUpWithEmailAndPassword.tsx

+35-53
Original file line numberDiff line numberDiff line change
@@ -63,34 +63,21 @@ export function SignUpWithEmailAndPassword({ signUp }: { signUp: () => void }) {
6363
<FormItem className="flex flex-col items-start gap-2">
6464
<FormLabel>{t('auth:sign_in.password')}</FormLabel>
6565
<FormControl>
66-
<Input
67-
className="w-full"
68-
type="password"
69-
autoComplete="new-password"
70-
{...field}
71-
/>
66+
<Input className="w-full" type="password" autoComplete="new-password" {...field} />
7267
</FormControl>
7368
<FormError />
7469
</FormItem>
7570
)}
7671
/>
77-
<FormField
78-
control={control}
79-
name="credentials"
80-
render={() => <FormError />}
81-
/>
72+
<FormField control={control} name="credentials" render={() => <FormError />} />
8273
<Button type="submit">{t('auth:sign_up')}</Button>
8374
</>
8475
);
8576

8677
return (
8778
<FormProvider {...formMethods}>
8879
<ClientOnly
89-
fallback={
90-
<SignUpWithEmailAndPasswordForm>
91-
{children}
92-
</SignUpWithEmailAndPasswordForm>
93-
}
80+
fallback={<SignUpWithEmailAndPasswordForm>{children}</SignUpWithEmailAndPasswordForm>}
9481
>
9582
{() => (
9683
<ClientSignUpWithEmailAndPasswordForm signUp={signUp}>
@@ -102,9 +89,7 @@ export function SignUpWithEmailAndPassword({ signUp }: { signUp: () => void }) {
10289
);
10390
}
10491

105-
function SignUpWithEmailAndPasswordForm(
106-
props: React.ComponentPropsWithoutRef<'form'>,
107-
) {
92+
function SignUpWithEmailAndPasswordForm(props: React.ComponentPropsWithoutRef<'form'>) {
10893
return <form noValidate className="flex w-full flex-col gap-4" {...props} />;
10994
}
11095

@@ -121,42 +106,39 @@ function ClientSignUpWithEmailAndPasswordForm({
121106
clientServices.authenticationClientService,
122107
);
123108

124-
const { handleSubmit, setError } =
125-
useFormContext<EmailAndPasswordFormValues>();
109+
const { handleSubmit, setError } = useFormContext<EmailAndPasswordFormValues>();
126110

127-
const handleEmailSignIn = handleSubmit(
128-
async ({ credentials: { email, password } }) => {
129-
try {
130-
await emailAndPasswordSignUp(email, password);
131-
signUp();
132-
} catch (error) {
133-
if (error instanceof EmailExistsError) {
134-
setError(
135-
'credentials.email',
136-
{
137-
message: t('auth:sign_up.errors.email_already_exists'),
138-
},
139-
{ shouldFocus: true },
140-
);
141-
} else if (error instanceof WeakPasswordError) {
142-
setError(
143-
'credentials.password',
144-
{
145-
message: t('auth:sign_up.errors.weak_password_error'),
146-
},
147-
{ shouldFocus: true },
148-
);
149-
} else if (error instanceof NetworkRequestFailed) {
150-
toast.error(t('common:errors.firebase_network_error'));
151-
} else if (error instanceof TooManyRequest) {
152-
toast.error(t('common:errors.too_many_requests'));
153-
} else {
154-
Sentry.captureException(error);
155-
toast.error(t('common:errors.unknown'));
156-
}
111+
const handleEmailSignIn = handleSubmit(async ({ credentials: { email, password } }) => {
112+
try {
113+
await emailAndPasswordSignUp(email, password);
114+
signUp();
115+
} catch (error) {
116+
if (error instanceof EmailExistsError) {
117+
setError(
118+
'credentials.email',
119+
{
120+
message: t('auth:sign_up.errors.email_already_exists'),
121+
},
122+
{ shouldFocus: true },
123+
);
124+
} else if (error instanceof WeakPasswordError) {
125+
setError(
126+
'credentials.password',
127+
{
128+
message: t('auth:sign_up.errors.weak_password_error'),
129+
},
130+
{ shouldFocus: true },
131+
);
132+
} else if (error instanceof NetworkRequestFailed) {
133+
toast.error(t('common:errors.firebase_network_error'));
134+
} else if (error instanceof TooManyRequest) {
135+
toast.error(t('common:errors.too_many_requests'));
136+
} else {
137+
Sentry.captureException(error);
138+
toast.error(t('common:errors.unknown'));
157139
}
158-
},
159-
);
140+
}
141+
});
160142

161143
return (
162144
<SignUpWithEmailAndPasswordForm

0 commit comments

Comments
 (0)