Skip to content
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

Dev #700

Merged
merged 45 commits into from
Oct 4, 2023
Merged

Dev #700

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
ceb3cb6
refactor login header style in .login__header and keepRatio first chi…
SimNed Sep 8, 2023
0ac2cb1
add height props to {children} first parent in keepRatio component
SimNed Sep 8, 2023
55d0f7f
add .flex-responsive for change flex-direction behaviour depands on m…
SimNed Sep 8, 2023
c8375fb
change height, minHeight, backgroudAttachment and overflow of .bg-gra…
SimNed Sep 8, 2023
05eb725
fix login style bug by nested class in .login__container .text-center…
SimNed Sep 8, 2023
2664d36
feat: allow json to be converted and export in csv
SimNed Sep 14, 2023
51ec47c
fix: delete all comma in headers and datas to avoid csv join conflicts
SimNed Sep 14, 2023
835b156
feature: add exportToCsv button
SimNed Sep 14, 2023
633d0ec
fix: add 'utilisateurs' in csv file name
SimNed Sep 14, 2023
ec5f6c0
fix: disable export csv button when there is no filtered users
SimNed Sep 15, 2023
d92db77
fix: escaping specials characters instead of delete comma in exportTo…
SimNed Sep 15, 2023
ac6f76a
feature: add dynamic filename to users csv file
SimNed Sep 15, 2023
e03b27f
fix: update csv header value
SimNed Sep 15, 2023
00f5e1e
fix: modify input and subheader components to autocomplete component
SimNed Sep 16, 2023
d2218c3
fix: remove unused LanguagesToRemove function
SimNed Sep 16, 2023
6d22cd3
feature: add isRequired field on PanelInput
SimNed Sep 16, 2023
30ba42a
fix: update PanelInputs as isRequired
SimNed Sep 16, 2023
4b63459
feature: add normalizeString func in isNormalizedStringEqual utils
SimNed Sep 17, 2023
06d6024
fix: type event any to synthetic event
SimNed Sep 17, 2023
c476f5a
add hasError
charlinedev Sep 27, 2023
9bd4a80
Change pseudo to firstName lastName
charlinedev Sep 27, 2023
4266398
Merge branch 'dev-asterix-in-required-fields-first-phase-pages' of ht…
charlinedev Sep 27, 2023
2033990
Merge branch 'dev-autocomplete-country-input' of https://github.com/p…
charlinedev Sep 27, 2023
a8fcec2
lastModif
charlinedev Sep 27, 2023
ea5a635
comment label
charlinedev Sep 28, 2023
706a4b5
Merge branch 'dev-styles' of https://github.com/parlemonde/1village i…
charlinedev Sep 28, 2023
cad2d8c
Remove label
charlinedev Sep 28, 2023
5cd2e1f
fix: remove isRequired field to input "Nom affiché"
SimNed Oct 2, 2023
6d04388
Merge branch 'dev-csv-defiLingAutocomplete-IndexAsterix' of https://g…
SimNed Oct 3, 2023
d4030ee
fix: change login video src with new video src
SimNed Oct 3, 2023
9afa08b
Fix import position
charlinedev Oct 3, 2023
d5ad90f
update V2Node files yml
charlinedev Oct 3, 2023
862ac22
Fix import activityContext
charlinedev Oct 4, 2023
0a32408
fix: add isRequired Props to PanelInputProps Interface
SimNed Oct 4, 2023
660d315
Merge branch 'dev' of https://github.com/parlemonde/1village into dev
SimNed Oct 4, 2023
6eb20b6
fix Eslint errors
MelissaOlas Oct 4, 2023
28afdcf
"fix Eslint errorsBis"
MelissaOlas Oct 4, 2023
1dea850
fix eslint errors ter
MelissaOlas Oct 4, 2023
b2fbf4a
fix eslint errors4
MelissaOlas Oct 4, 2023
1cd8a25
Merge pull request #701 from parlemonde/fixEsLintErrors0410
charlinedev Oct 4, 2023
c18e28c
Fix Import Editor
charlinedev Oct 4, 2023
19e2d39
Fix Import order
charlinedev Oct 4, 2023
51c7a41
Fix Import
charlinedev Oct 4, 2023
e4dbabb
Fix import ss exten
charlinedev Oct 4, 2023
574c0fe
Fixxx import ss exte - command yarn lint
charlinedev Oct 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

# [2] get node.
- name: Use Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: '16.15.1'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

# [2] get node.
- name: Use Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: '16.15.1'

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

# [2] get node.
- name: Use Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: '16.15.1'

Expand All @@ -33,7 +33,7 @@ jobs:

# [2] get node.
- name: Use Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: '16.15.1'

Expand All @@ -53,7 +53,7 @@ jobs:

# [2] get node.
- name: Use Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: '16.15.1'

Expand Down
4 changes: 3 additions & 1 deletion src/components/KeepRatio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import React from 'react';
interface KeepRatioProps {
ratio: number;
width?: string | number;
height?: string | number;
maxWidth?: string | number;
minHeight?: string | number;
className?: string;
}

export const KeepRatio = ({
width = '100%',
height = '100%',
maxWidth = '100%',
minHeight = 0,
ratio,
Expand All @@ -20,7 +22,7 @@ export const KeepRatio = ({
<div style={{ width: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
<div style={{ width, maxWidth }}>
<div style={{ width: '100%', paddingBottom: `${ratio * 100}%`, minHeight, position: 'relative' }}>
<div className={className} style={{ position: 'absolute', top: '0', left: '0', width: '100%', height: '100%' }}>
<div className={className} style={{ position: 'absolute', top: '0', left: '0', width: '100%', height }}>
{children}
</div>
</div>
Expand Down
21 changes: 14 additions & 7 deletions src/components/WelcomeModal/FirstPhase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,52 +272,59 @@ export const FirstPhase = () => {
<PanelInput
value={newUser.school || ''}
defaultValue={'non renseignée'}
label="École :"
placeholder="Nom de votre école"
label="École : "
placeholder="Nom de votre école : "
hasError={!newUser.school}
isEditMode
isRequired
onChange={(school) => {
setNewUser((u) => ({ ...u, school }));
}}
/>
<PanelInput
value={newUser.level || ''}
defaultValue={'non renseigné'}
label="Niveau de la classe :"
label="Niveau de la classe : "
placeholder="Niveau de votre classe"
hasError={!newUser.level}
isEditMode
isRequired
onChange={(level) => {
setNewUser((u) => ({ ...u, level }));
}}
/>
<PanelInput
value={newUser.address || ''}
defaultValue={'non renseigné'}
label="Adresse de l'école :"
label="Adresse de l'école : "
placeholder="Adresse"
hasError={!newUser.address}
isEditMode
isRequired
onChange={(address) => {
setNewUser((u) => ({ ...u, address }));
}}
/>
<PanelInput
value={newUser.city || ''}
defaultValue={'non renseigné'}
label="Ville :"
label="Ville : "
placeholder="Ville"
hasError={!newUser.city}
isEditMode
isRequired
onChange={(city) => {
setNewUser((u) => ({ ...u, city }));
}}
/>
<PanelInput
value={newUser.postalCode || ''}
defaultValue={'non renseigné'}
label="Code postal :"
label="Code postal : "
placeholder="Code postal"
hasError={!newUser.postalCode}
isEditMode
isRequired
onChange={(postalCode) => {
setNewUser((u) => ({ ...u, postalCode }));
}}
Expand All @@ -329,7 +336,7 @@ export const FirstPhase = () => {
style={{ marginTop: '2rem' }}
value={newUser.displayName || ''}
defaultValue={'non renseigné'}
label="Nom affiché :"
label="Nom affiché : "
placeholder={getUserDisplayName({ ...user, ...newUser, type: user?.type }, false)}
isEditMode
onChange={(displayName) => {
Expand Down
18 changes: 3 additions & 15 deletions src/components/accueil/NewHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,12 @@ export const NewHome = () => {
return (
<div className="bg-gradiant" style={{ display: 'flex', flexDirection: 'column' }}>
<>
<div
style={{
display: 'grid',
gridTemplateColumns: 'repeat(3, 1fr)',
gap: '10px',
background: 'white',
width: '95%',
height: '50px',
maxWidth: '1200px',
borderRadius: '10px',
marginBottom: '2rem',
}}
>
<div className="login__header">
<Logo style={{ width: '25%', height: 'auto', margin: '0 10px', alignSelf: 'center' }} />
<h1 style={{ placeSelf: 'center' }}>Vous êtes...</h1>
</div>
<KeepRatio ratio={0.45} width="95%" maxWidth="1200px" minHeight="400px" className="login__container">
<div className="text-center" style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: '2rem', placeItems: 'center' }}>
<KeepRatio ratio={0.45} width="95%" maxWidth="1200px" height="fit-content" minHeight="400px" className="login__container">
<div className="flex-responsive text-center">
{/* Block Teacher */}
<div style={{ display: 'flex', flexDirection: 'column', height: '300px' }}>
<h2>Professeur des écoles</h2>
Expand Down
3 changes: 3 additions & 0 deletions src/components/mon-compte/PanelInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface PanelInputProps {
defaultValue?: string;
label: string;
placeholder?: string;
isRequired?: boolean;
isEditMode?: boolean;
errorMsg?: string;
helperText?: string;
Expand All @@ -23,6 +24,7 @@ export const PanelInput = ({
defaultValue = '',
label,
placeholder = '',
isRequired = false,
isEditMode = true,
errorMsg,
helperText,
Expand All @@ -36,6 +38,7 @@ export const PanelInput = ({
<div style={{ margin: '0.5rem', display: 'inline-flex', alignItems: 'flex-start', ...style }}>
<label className="text text--bold" style={{ flexShrink: 0 }}>
{label}
{isRequired && <span style={{ color: 'red' }}>*</span>}
</label>
{isEditMode ? (
<TextField
Expand Down
52 changes: 49 additions & 3 deletions src/pages/admin/users/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React, { useCallback, useMemo, useState } from 'react';

import AddCircleIcon from '@mui/icons-material/AddCircle';
import DeleteIcon from '@mui/icons-material/Delete';
import DownloadIcon from '@mui/icons-material/Download';
import EditIcon from '@mui/icons-material/Edit';
import type { SelectChangeEvent } from '@mui/material';
import { FormControl, InputLabel, MenuItem, Select, TextField, Typography } from '@mui/material';
Expand All @@ -22,6 +23,7 @@ import { useUsers, useUserRequests } from 'src/services/useUsers';
import { useVillages } from 'src/services/useVillages';
import { defaultContainedButtonStyle } from 'src/styles/variables.const';
import { countryToFlag } from 'src/utils';
import { exportJsonToCsv } from 'src/utils/csv-export';
import { userTypeNames } from 'types/user.type';
import type { Village } from 'types/village.type';

Expand Down Expand Up @@ -64,6 +66,35 @@ const Users = () => {
setUserTypeFilter(e.target.value);
}, []);

const handleExportToCSV = () => {
if (filteredUsers.length < 1) return;

const datasToExport = filteredUsers.map((user) => {
return {
firstname: user.firstname,
lastname: user.lastname,
email: user.email,
school: user.school ? user.school : 'Non renseignee',
village: user.villageId ? villageMap[user.villageId]?.name : 'Non renseigne',
country: user.country ? user.country.name : 'Non renseigne',
};
});

const headers = ['Prenom', 'Nom', 'Email', 'Ecole', 'Village', 'Pays'];

let userLabel = 'liste-utilisateurs-';

for (const [key, value] of Object.entries(userTypeNames)) {
if (key === userTypeFilter) {
userLabel = 'liste-' + value.toLowerCase().replaceAll(' ', '-') + 's-';
}
}
const todayDate = new Date().toLocaleDateString('fr-FR').replaceAll('/', '-');
const fileName = userLabel + todayDate;

exportJsonToCsv(fileName, headers, datasToExport);
};

const actions = (id: number) => (
<>
<Tooltip title="Modifier">
Expand Down Expand Up @@ -157,14 +188,27 @@ const Users = () => {
))}
</Select>
</FormControl>
<Button
color="inherit"
sx={defaultContainedButtonStyle}
component="a"
onClick={handleExportToCSV}
variant="contained"
style={{ flexShrink: 0, marginLeft: '1rem' }}
startIcon={<DownloadIcon />}
disabled={filteredUsers.length === 0}
>
Exporter en CSV
</Button>
</div>
<AdminTable
emptyPlaceholder="Vous n'avez pas encore d'utilisateur !"
data={filteredUsers.map((u) =>
u.country
? {
id: u.id,
pseudo: u.pseudo,
firstname: u.firstname,
lastname: u.lastname,
email: u.email,
school: u.school || <span style={{ color: 'grey' }}>Non renseignée</span>,
country: `${countryToFlag(u.country?.isoCode)} ${u.country?.name}`,
Expand All @@ -177,7 +221,8 @@ const Users = () => {
}
: {
id: u.id,
pseudo: u.pseudo,
firstname: u.firstname,
lastname: u.lastname,
email: u.email,
school: u.school || <span style={{ color: 'grey' }}>Non renseignée</span>,
village: u.villageId ? (
Expand All @@ -189,7 +234,8 @@ const Users = () => {
},
)}
columns={[
{ key: 'pseudo', label: 'Pseudo', sortable: true },
{ key: 'firstname', label: 'Prénom', sortable: true },
{ key: 'lastname', label: 'Nom', sortable: true },
{ key: 'email', label: 'Email', sortable: true },
{ key: 'school', label: 'École', sortable: true },
{ key: 'village', label: 'Village', sortable: true },
Expand Down
Loading
Loading