-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat impl settings page #77
base: develop
Are you sure you want to change the base?
Changes from all commits
f442853
83b5d57
4889bd5
1b10279
6de1c23
941dc9c
5651830
44fdbcd
fd07f23
299642c
a6c1232
bdc85a8
dbdc721
9ab38db
29e8225
a0fab53
b32c187
eb648b7
a43663c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { Box, Divider, Tabs } from "@mui/material"; | ||
import { PageTab } from "../ui/PageTab"; | ||
import { useState, SyntheticEvent } from "react"; | ||
import { SettingsHeader } from "../ui/Settings/SettingsHeader"; | ||
import { SettingsHabilitationsCard } from "../ui/Settings/SettingsHabilitationsCard"; | ||
import { Breadcrumbs } from "../ui/Breadcrumbs.tsx"; | ||
|
||
enum Tab { | ||
Habilitations = "Habilitations", | ||
Communications = "Communications", | ||
NewSource = "NewSource", | ||
} | ||
|
||
const TabNames = { | ||
[Tab.Habilitations]: "Gestion des habilitations", | ||
[Tab.Communications]: "Communications", | ||
[Tab.NewSource]: "Nouvelle Source", | ||
}; | ||
|
||
export function SettingsPage() { | ||
const [currentTab, setCurrentTab] = useState(Tab.Habilitations); | ||
const handleChange = (_: SyntheticEvent, newValue: Tab) => { | ||
setCurrentTab(newValue); | ||
}; | ||
const breadcrumbs = [ | ||
{ href: "/", title: "Accueil" }, | ||
{ href: "/settings", title: "Réglages" }, | ||
TabNames[currentTab], | ||
]; | ||
return ( | ||
<> | ||
<SettingsHeader /> | ||
<Divider variant="fullWidth" /> | ||
<Tabs | ||
value={currentTab} | ||
onChange={handleChange} | ||
sx={{ | ||
px: 5, | ||
backgroundColor: "white", | ||
}} | ||
> | ||
{Object.keys(Tab).map(k => ( | ||
<PageTab | ||
sx={{ | ||
paddingX: 4, | ||
paddingY: 3, | ||
typography: "titleSmall", | ||
letterSpacing: 0.4, | ||
}} | ||
key={k} | ||
value={k} | ||
label={TabNames[k]} | ||
/> | ||
))} | ||
</Tabs> | ||
|
||
<Breadcrumbs items={breadcrumbs} /> | ||
|
||
<Box px={4}> | ||
<SettingsTab tab={currentTab} /> | ||
</Box> | ||
</> | ||
); | ||
} | ||
|
||
function SettingsTab({ tab }: { tab: Tab }) { | ||
if (tab === Tab.Habilitations) { | ||
return <SettingsHabilitationsCard />; | ||
} | ||
|
||
return; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,7 @@ | |
bodyLarge: CSSProperties; | ||
bodyMedium: CSSProperties; | ||
bodySmall: CSSProperties; | ||
robotoLarge: CSSProperties; | ||
} | ||
|
||
interface TypographyVariantsOptions { | ||
|
@@ -67,6 +68,7 @@ | |
bodyLarge?: CSSProperties; | ||
bodyMedium?: CSSProperties; | ||
bodySmall?: CSSProperties; | ||
robotoLarge?: CSSProperties; | ||
} | ||
} | ||
|
||
|
@@ -87,6 +89,7 @@ | |
bodyLarge: true; | ||
bodyMedium: true; | ||
bodySmall: true; | ||
robotoLarge: true; | ||
} | ||
} | ||
|
||
|
@@ -115,6 +118,11 @@ | |
disabled: true; | ||
} | ||
} | ||
declare module "@mui/material/Chip" { | ||
interface ChipPropsVariantOverrides { | ||
role: true; | ||
} | ||
} | ||
|
||
declare module "@mui/material/Tab" { | ||
interface TabPropsClassesOverrides { | ||
|
@@ -206,6 +214,13 @@ | |
lineHeight: "16px", | ||
letterSpacing: 0.4, | ||
}, | ||
robotoLarge: { | ||
lineHeight: "24px", | ||
fontSize: "16px", | ||
letterSpacing: "0.15px", | ||
fontWeight: 400, | ||
fontFamily: "Roboto", | ||
}, | ||
}; | ||
const palette = { | ||
background: { | ||
|
@@ -389,11 +404,27 @@ | |
}, | ||
MuiInputLabel: { | ||
styleOverrides: { | ||
sizeSmall: { | ||
...typography.bodyMedium, | ||
root: { | ||
...typography.bodyLarge, | ||
}, | ||
}, | ||
}, | ||
MuiChip: { | ||
variants: [ | ||
{ | ||
props: { variant: "role" }, | ||
style: { | ||
fontWeight: 600, | ||
lineHeight: "18px", | ||
letterSpacing: "0.1px", | ||
fontSize: "14px", | ||
Comment on lines
+417
to
+420
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Essaie d'utiliser une typography déjà existante |
||
textTransform: "capitalize", | ||
backgroundColor: "#EBEBEB", | ||
height: "34px", | ||
}, | ||
}, | ||
], | ||
}, | ||
MuiInputBase: { | ||
styleOverrides: { | ||
root: { | ||
|
@@ -436,7 +467,7 @@ | |
}, | ||
}, | ||
}, | ||
MuiChip: { | ||
Check failure on line 470 in src/theme.tsx GitHub Actions / Test with Node v16 on ubuntu-latest
Check failure on line 470 in src/theme.tsx GitHub Actions / Test with Node v18 on ubuntu-latest
Check failure on line 470 in src/theme.tsx GitHub Actions / Test with Node v16 on ubuntu-latest
|
||
styleOverrides: { | ||
colorError: { | ||
backgroundColor: "#FDDBC3", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,17 @@ export type APISchemas = { | |
/* Format: date-time */ | ||
timestamp?: string | ||
} | ||
UserDto: { identifier: string; role?: string } | ||
UserDto: { | ||
identifier: string | ||
role?: string | ||
name?: string | ||
firstName?: string | ||
organization?: string | ||
accreditedSources?: Array<string> | ||
/* Format: date-time */ | ||
creationDate?: string | ||
creationAuthor?: string | ||
} | ||
SurveyDto: { | ||
id: string | ||
sourceId: string | ||
|
@@ -340,17 +350,17 @@ export type APISchemas = { | |
} | ||
OnGoingDto: { ongoing?: boolean } | ||
PageableObject: { | ||
/* Format: int64 */ | ||
offset?: number | ||
sort?: APISchemas["SortObject"] | ||
/* Format: int32 */ | ||
pageNumber?: number | ||
/* Format: int32 */ | ||
pageSize?: number | ||
unpaged?: boolean | ||
/* Format: int64 */ | ||
offset?: number | ||
sort?: APISchemas["SortObject"] | ||
paged?: boolean | ||
unpaged?: boolean | ||
} | ||
SortObject: { empty?: boolean; sorted?: boolean; unsorted?: boolean } | ||
SortObject: { sorted?: boolean; empty?: boolean; unsorted?: boolean } | ||
UserPage: { | ||
content?: Array<APISchemas["UserDto"]> | ||
pageable?: APISchemas["PageableObject"] | ||
|
@@ -608,7 +618,7 @@ export type APISchemas = { | |
empty?: boolean | ||
} | ||
PeriodDto: { value?: string; label?: string; period?: string } | ||
PeriodicityDto: { value: string; label: string } | ||
PeriodicityDto: { value?: string; label?: string } | ||
EligibleDto: { eligible?: string } | ||
OwnerPage: { | ||
content?: Array<APISchemas["OwnerDto"]> | ||
|
@@ -748,6 +758,7 @@ export type APISchemas = { | |
totalPages?: number | ||
first?: boolean | ||
last?: boolean | ||
pageable?: APISchemas["PageableObject"] | ||
/* Format: int32 */ | ||
size?: number | ||
content?: Array<APISchemas["MoogSearchDto"]> | ||
|
@@ -756,7 +767,6 @@ export type APISchemas = { | |
sort?: APISchemas["SortObject"] | ||
/* Format: int32 */ | ||
numberOfElements?: number | ||
pageable?: APISchemas["PageableObject"] | ||
empty?: boolean | ||
} | ||
HealthcheckDto: { status?: string } | ||
|
@@ -779,7 +789,7 @@ export type APISchemas = { | |
empty?: boolean | ||
} | ||
ContactFirstLoginDto: { | ||
identifier: string | ||
identifier?: string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. identifier is required |
||
externalId?: string | ||
civility?: "Female" | "Male" | "Undefined" | ||
lastName?: string | ||
|
@@ -1107,7 +1117,7 @@ export type APIEndpoints = { | |
} | ||
} | ||
"/api/contacts/{id}": { | ||
responses: { get: APISchemas["ContactFirstLoginDto"]; put: APISchemas["ContactDto"]; delete: null } | ||
responses: { get: null; put: APISchemas["ContactDto"]; delete: null } | ||
Comment on lines
-1110
to
+1120
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. La réponse du get m'étonne There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. arf, c'est à nouveau le modéle openapi qui met du null. Tu avais remplacé avec du ContactFirstLoginDto à la mano...ennuyeux de devoir reprendre à chaque mise à jour des types/api..je corrigerai l'api en retour de congés |
||
requests: | ||
| { method?: "get"; urlParams: { id: string } } | ||
| { | ||
|
@@ -1240,6 +1250,10 @@ export type APIEndpoints = { | |
responses: { get: null } | ||
requests: { method?: "get"; urlParams: { id: string } } | ||
} | ||
"/api/users/v2": { | ||
responses: { get: Array<APISchemas["UserDto"]> } | ||
requests: { method?: "get" } | ||
} | ||
"/api/temp/moog/campaigns/{idCampaign}/monitoring/progress": { | ||
responses: { get: APISchemas["JSONCollectionWrapperMoogProgressDto"] } | ||
requests: { method?: "get"; urlParams: { idCampaign: string } } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Chip } from "@mui/material"; | ||
|
||
type Props = { | ||
role: string; | ||
}; | ||
|
||
export const roleColorsWidth = [ | ||
{ role: "administrateur", color: "#442F99", width: "145px" }, | ||
{ role: "responsable", color: "#0C8C87", width: "127px" }, | ||
{ role: "gestionnaire", color: "#3C75A2", width: "129px" }, | ||
{ role: "assistance", color: "#5A1741", width: "113px" }, | ||
]; | ||
|
||
export const RoleChip = ({ role }: Props) => { | ||
const color = role ? roleColorsWidth.find(r => r.role === role.toLowerCase())?.color : "black"; | ||
const width = role ? roleColorsWidth.find(r => r.role === role.toLowerCase())?.width : undefined; | ||
return ( | ||
<Chip | ||
label={role} | ||
variant={"role"} | ||
style={{ | ||
color: color, | ||
width: width, | ||
}} | ||
/> | ||
); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A retirer