Skip to content

Commit 89c88f8

Browse files
Georgi2704Ruben van Leeuwen
authored andcommitted
prettier
1 parent ee2cd3d commit 89c88f8

File tree

18 files changed

+138
-96
lines changed

18 files changed

+138
-96
lines changed
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
2-
"footer": {
3-
"cancel": "Cancel CUSTOM",
4-
"send": "Send CUSTOM",
5-
"reset": "Reset CUSTOM",
6-
"notModifiedYet": "The form has not been modified yet CUSTOM",
7-
"notFilledYet": "The form has not been filled in yet CUSTOM"
8-
},
9-
"renderForm": {
10-
"loading": "Form is loading... CUSTOM",
11-
"successfullySent": "Your submission has been successfully received CUSTOM"
12-
}
2+
"footer": {
3+
"cancel": "Cancel CUSTOM",
4+
"send": "Send CUSTOM",
5+
"reset": "Reset CUSTOM",
6+
"notModifiedYet": "The form has not been modified yet CUSTOM",
7+
"notFilledYet": "The form has not been filled in yet CUSTOM"
8+
},
9+
"renderForm": {
10+
"loading": "Form is loading... CUSTOM",
11+
"successfullySent": "Your submission has been successfully received CUSTOM"
12+
}
1313
}
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
2-
"footer": {
3-
"cancel": "Annuleren CUSTOM",
4-
"send": "Verzenden CUSTOM",
5-
"reset": "Resetten CUSTOM",
6-
"notModifiedYet": "Het formulier is nog niet aangepast CUSTOM",
7-
"notFilledYet": "Het formulier is nog niet ingevuld CUSTOM"
8-
},
9-
"renderForm" : {
10-
"loading": "Formulier wordt geladen... CUSTOM",
11-
"successfullySent": "Je inzending is succesvol ontvangen CUSTOM"
12-
}
2+
"footer": {
3+
"cancel": "Annuleren CUSTOM",
4+
"send": "Verzenden CUSTOM",
5+
"reset": "Resetten CUSTOM",
6+
"notModifiedYet": "Het formulier is nog niet aangepast CUSTOM",
7+
"notFilledYet": "Het formulier is nog niet ingevuld CUSTOM"
8+
},
9+
"renderForm": {
10+
"loading": "Formulier wordt geladen... CUSTOM",
11+
"successfullySent": "Je inzending is succesvol ontvangen CUSTOM"
12+
}
1313
}

frontend/apps/example/next.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {NextConfig} from 'next';
1+
import { NextConfig } from 'next';
22
import createNextIntlPlugin from 'next-intl/plugin';
33

44
const nextConfig: NextConfig = {};

frontend/apps/example/src/app/[locale]/layout.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import type { Metadata } from 'next';
22
import localFont from 'next/font/local';
3+
4+
import { handleInvalidLocale } from '@/app/[locale]/useGetTranslationMessages';
5+
36
import '../globals.css';
4-
import {handleInvalidLocale} from "@/app/[locale]/useGetTranslationMessages";
57

68
const geistSans = localFont({
79
src: '../fonts/GeistVF.woff',
@@ -21,12 +23,12 @@ export const metadata: Metadata = {
2123

2224
export default async function RootLayout({
2325
children,
24-
params
26+
params,
2527
}: Readonly<{
2628
children: React.ReactNode;
2729
params: Promise<{ locale: string }>;
2830
}>) {
29-
const {locale} = await params;
31+
const { locale } = await params;
3032
const validLocale = handleInvalidLocale(locale);
3133

3234
return (

frontend/apps/example/src/app/[locale]/page.tsx

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use client';
22

3+
<<<<<<< HEAD
34
<<<<<<< HEAD
45
import { useParams } from 'next/navigation';
56
import {
@@ -9,25 +10,39 @@ import {
910
} from 'pydantic-forms';
1011
=======
1112
>>>>>>> 6b4540b (Cleanup)
13+
=======
14+
import { useParams } from 'next/navigation';
15+
>>>>>>> 305eba5 (prettier)
1216
import type {
1317
PydanticComponentMatcher,
1418
PydanticFormApiProvider,
1519
PydanticFormCustomDataProvider,
1620
PydanticFormLabelProvider,
1721
} from 'pydantic-forms';
18-
import {PydanticForm, PydanticFormFieldFormat, PydanticFormFieldType,} from 'pydantic-forms';
22+
import {
23+
PydanticForm,
24+
PydanticFormFieldFormat,
25+
PydanticFormFieldType,
26+
} from 'pydantic-forms';
1927

28+
<<<<<<< HEAD
2029
<<<<<<< HEAD
2130
import { TextArea } from '@/fields';
2231

2332
import NLnl from '../../../messages/nl-NL.json';
2433
=======
2534
import {TextArea} from '@/fields';
2635
import {useParams} from "next/navigation";
36+
=======
37+
import {
38+
handleInvalidLocale,
39+
useGetTranslationMessages,
40+
} from '@/app/[locale]/useGetTranslationMessages';
41+
import { TextArea } from '@/fields';
42+
>>>>>>> 305eba5 (prettier)
2743

2844
>>>>>>> 6b4540b (Cleanup)
2945
import styles from '../page.module.css';
30-
import {handleInvalidLocale, useGetTranslationMessages} from "@/app/[locale]/useGetTranslationMessages";
3146

3247
<<<<<<< HEAD
3348
export default function Home({
@@ -39,7 +54,7 @@ export default function Home({
3954
const locale = params?.locale as string; // Get locale from URL params
4055
=======
4156
export default function Home() {
42-
const {locale} = useParams();
57+
const { locale } = useParams();
4358
const validLocale = handleInvalidLocale(locale);
4459
>>>>>>> 6b4540b (Cleanup)
4560

@@ -79,6 +94,17 @@ export default function Home() {
7994
});
8095
};
8196

97+
<<<<<<< HEAD
98+
=======
99+
const ResetButtonAlternative = () => (
100+
<button type="button">Alternative reset</button>
101+
);
102+
103+
const CancelButtonAlternative = () => (
104+
<button type="button">Alternative cancel</button>
105+
);
106+
107+
>>>>>>> 305eba5 (prettier)
82108
const componentMatcher = (
83109
currentMatchers: PydanticComponentMatcher[],
84110
): PydanticComponentMatcher[] => {
@@ -124,6 +150,7 @@ export default function Home() {
124150
customDataProvider: pydanticCustomDataProvider,
125151
componentMatcher: componentMatcher,
126152
<<<<<<< HEAD
153+
<<<<<<< HEAD
127154
<<<<<<< HEAD
128155
translations: NLnl,
129156
=======
@@ -133,6 +160,10 @@ export default function Home() {
133160
translations : useGetTranslationMessages(validLocale), //Comment this line for default translations
134161
locale: validLocale
135162
>>>>>>> 07848e9 (Some refactor)
163+
=======
164+
translations: useGetTranslationMessages(validLocale), //Comment this line for default translations
165+
locale: validLocale,
166+
>>>>>>> 305eba5 (prettier)
136167
}}
137168
/>
138169
</div>

frontend/apps/example/src/app/[locale]/useGetTranslationMessages.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
import {Locale, TranslationsJSON} from "pydantic-forms";
2-
import enGB from "../../../messages/en-GB.json";
3-
import nlNL from "../../../messages/nl-NL.json";
4-
import {hasLocale} from "next-intl";
5-
import {routing} from "@/i18n/routing";
6-
import {notFound} from "next/navigation";
7-
import {ParamValue} from "next/dist/server/request/params";
1+
import { hasLocale } from 'next-intl';
2+
import { ParamValue } from 'next/dist/server/request/params';
3+
import { notFound } from 'next/navigation';
4+
import { Locale, TranslationsJSON } from 'pydantic-forms';
5+
6+
import { routing } from '@/i18n/routing';
7+
8+
import enGB from '../../../messages/en-GB.json';
9+
import nlNL from '../../../messages/nl-NL.json';
810

911
export const handleInvalidLocale = (locale: ParamValue) => {
1012
if (!hasLocale(routing.locales, locale)) {
1113
notFound();
1214
}
1315
return locale;
14-
}
15-
16-
export const useGetTranslationMessages = (locale: string | undefined): TranslationsJSON => {
16+
};
1717

18+
export const useGetTranslationMessages = (
19+
locale: string | undefined,
20+
): TranslationsJSON => {
1821
const getLocalMessages = () => {
1922
switch (locale) {
2023
case Locale.enGB:
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import {createNavigation} from 'next-intl/navigation';
2-
import {routing} from './routing';
1+
import { createNavigation } from 'next-intl/navigation';
2+
3+
import { routing } from './routing';
34

45
// Lightweight wrappers around Next.js' navigation
56
// APIs that consider the routing configuration
6-
export const {Link, redirect, usePathname, useRouter, getPathname} =
7+
export const { Link, redirect, usePathname, useRouter, getPathname } =
78
createNavigation(routing);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import {defineRouting} from 'next-intl/routing';
1+
import { defineRouting } from 'next-intl/routing';
22

33
export const routing = defineRouting({
44
// A list of all locales that are supported
55
locales: ['en-GB', 'nl-NL'],
66

77
// Used when no locale matches
8-
defaultLocale: 'en-GB'
8+
defaultLocale: 'en-GB',
99
});
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import createMiddleware from 'next-intl/middleware';
2-
import {routing} from './i18n/routing';
2+
3+
import { routing } from './i18n/routing';
34

45
export default createMiddleware(routing);
56

67
export const config = {
78
// Match all pathnames except for
89
// - … if they start with `/api`, `/trpc`, `/_next` or `/_vercel`
910
// - … the ones containing a dot (e.g. `favicon.ico`)
10-
matcher: '/((?!api|trpc|_next|_vercel|.*\\..*).*)'
11+
matcher: '/((?!api|trpc|_next|_vercel|.*\\..*).*)',
1112
};

frontend/packages/pydantic-forms/src/PydanticForm.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import React from 'react';
1010

1111
import RenderForm from '@/components/render/RenderForm';
1212
import PydanticFormContextProvider from '@/core/PydanticFormContextProvider';
13+
import { TranslationsProvider } from '@/messages/translationsProvider';
1314
import type {
1415
PydanticFormInitialContextProps,
1516
PydanticFormMetaData,
1617
} from '@/types';
17-
import {TranslationsProvider} from "@/messages/translationsProvider";
1818

1919
export interface PydanticFormProps
2020
extends Omit<PydanticFormInitialContextProps, 'formKey' | 'children'> {
@@ -27,7 +27,10 @@ export const PydanticForm = ({
2727
metaData,
2828
...contextProps
2929
}: PydanticFormProps) => (
30-
<TranslationsProvider translations={contextProps.config.translations} locale={contextProps.config.locale}>
30+
<TranslationsProvider
31+
translations={contextProps.config.translations}
32+
locale={contextProps.config.locale}
33+
>
3134
<PydanticFormContextProvider
3235
{...contextProps}
3336
formKey={id}

0 commit comments

Comments
 (0)