-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
75ef6e6
commit 9a828ab
Showing
17 changed files
with
289 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { Typography } from "@mui/material"; | ||
import React from "react"; | ||
|
||
export function ErrorLayout({message: message}) { | ||
return <Typography>{message}</Typography> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { createBrowserRouter } from "react-router-dom" | ||
import { CustomerRouterFactory } from "./customer/CustomerRouterFactory.tsx" | ||
import { ProducerRouterFactory } from "./producer/ProducerRouterFactory.tsx" | ||
import React from "react" | ||
import { ErrorLayout } from "./ErrorLayout.tsx" | ||
|
||
export class RouterFactory { | ||
|
||
producerRouterFactory: ProducerRouterFactory = new ProducerRouterFactory() | ||
customerRouterFactory: CustomerRouterFactory = new CustomerRouterFactory() | ||
|
||
getRouter() { | ||
if(process.env.REACT_APP_MODE === 'CUSTOMER') { | ||
return this.customerRouterFactory.getRouter() | ||
} | ||
if(process.env.REACT_APP_MODE === 'PRODUCER') { | ||
return this.producerRouterFactory.getRouter() | ||
} | ||
return createBrowserRouter([ | ||
{ | ||
path: "/", | ||
element: <ErrorLayout message='Configuration du mode client ou producteur absent ou non reconnu'/> | ||
} | ||
]) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { createTheme } from "@mui/material"; | ||
import { frFR } from '@mui/material/locale'; | ||
|
||
export class ThemeFactory { | ||
createTheme() { | ||
return createTheme({ | ||
palette: { | ||
//mode: 'dark', | ||
primary: { | ||
main: '#556b2f', | ||
} | ||
}, | ||
typography: { | ||
h1: { | ||
fontFamily: 'Acme', | ||
}, | ||
h2: { | ||
fontFamily: 'Acme', | ||
}, | ||
h3: { | ||
fontFamily: 'Acme', | ||
}, | ||
h4: { | ||
fontFamily: 'Acme', | ||
}, | ||
h5: { | ||
fontFamily: 'Acme', | ||
}, | ||
h6: { | ||
fontFamily: 'Acme', | ||
}, | ||
subtitle1: { | ||
fontWeight: 'bold' | ||
} | ||
} | ||
}, frFR); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
frontend/app/src/layouts/customer/CustomerRouterFactory.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React from "react"; | ||
|
||
import { createBrowserRouter } from "react-router-dom"; | ||
|
||
import PaymentLayout from "./PaymentLayout.tsx"; | ||
import CustomerLayout from "./CustomerLayout.tsx"; | ||
import CustomerOrderForm from "../../domains/sale/views/CustomerOrderForm.tsx"; | ||
import NotAuthorizedForProducers from "../../authentication/views/NotAuthorizedForProducers.tsx"; | ||
import Welcome from "../../domains/welcome/Welcome.tsx"; | ||
|
||
export class CustomerRouterFactory { | ||
getRouter() { | ||
return createBrowserRouter([ | ||
{ | ||
path: "/", | ||
element: <CustomerLayout/>, | ||
children: [ | ||
{ | ||
path: "/welcome", | ||
element: <Welcome/> | ||
}, | ||
{ | ||
path: "/order/creation", | ||
element: <CustomerOrderForm/> | ||
}, | ||
{ | ||
path: "/orders/:orderId/payment", | ||
element: <PaymentLayout/> | ||
} | ||
] | ||
}, | ||
{ | ||
path: "/unauthorized", | ||
element: <NotAuthorizedForProducers/> | ||
} | ||
]) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.