Skip to content

Commit

Permalink
add FollowInterviewerCard
Browse files Browse the repository at this point in the history
  • Loading branch information
RenauxLeaInsee committed Apr 24, 2024
1 parent d4fd326 commit 5b8c1b0
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/i18n-en.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,10 @@ export const messagesEn = {
statesFilterLabel: 'States...',
closingCauseFilterLabel: 'Closing cause...',
priorityFilterLabel: 'Priority...',
searchInterviewer: 'an interviewer...',
searchOrganizationUnit: "an organization unit...",
chooseSurvey: "Choose a survey :",
chooseInterviewer: "Choose an interviewer :",
chooseOrganizationUnit: "Choose an organization unit :",
followInterviewer: "Follow an interviewer",
}
7 changes: 7 additions & 0 deletions src/i18n-fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,11 @@ export const messagesFr = {
statesFilterLabel: 'Etat...',
closingCauseFilterLabel: 'Bilan agrégé...',
priorityFilterLabel: 'Prioritaire...',
searchInterviewer: 'un enquêteur...',
searchOrganizationUnit: "un site...",
chooseSurvey: "Choisissez une enquête :",
chooseInterviewer: "Choisissez un enquêteur / une enquêtrice :",
chooseOrganizationUnit: "Choisissez un site :",
followInterviewer: "Suivre un enquêteur",

}
26 changes: 24 additions & 2 deletions src/pages/FollowPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
import { Typography } from "@mui/material";
import { Row } from "../ui/Row";
import { FollowInterviewerCard } from "../ui/FollowInterviewerCard";

export const FollowPage = () => {
return <Typography>Page suivre</Typography>;
// TODO use real condition
const isNationalProfile = true;

const gridTemplateColumns = isNationalProfile
? { gridTemplateColumns: "1fr 1fr 1fr" }
: { gridTemplateColumns: "1fr 1fr" };

return (
<Row
style={{
...{
display: "grid",
...gridTemplateColumns,
},
}}
gap={3}
px={4}
py={3}
>
<FollowInterviewerCard />
</Row>
);
};
86 changes: 86 additions & 0 deletions src/ui/FollowInterviewerCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import { useIntl } from "react-intl";
import { useDebouncedState } from "../hooks/useDebouncedState";
import Card from "@mui/material/Card";
import Stack from "@mui/material/Stack";
import Typography from "@mui/material/Typography";
import { SearchField } from "./SearchField";
import TableContainer from "@mui/material/TableContainer";
import Table from "@mui/material/Table";
import TableHead from "@mui/material/TableHead";
import { TableBody, TableCell, TableRow } from "@mui/material";

const interviewersMock = [
{
id: "1",
interviewerFirstName: "John",
interviewerLastName: "Doe",
},
{
id: "2",
interviewerFirstName: "Marion",
interviewerLastName: "Cotillard",
},
{
id: "3",
interviewerFirstName: "Johnny",
interviewerLastName: "Depp",
},
{
id: "4",
interviewerFirstName: "Romain",
interviewerLastName: "Duris",
},
{
id: "5",
interviewerFirstName: "Angélina",
interviewerLastName: "Jolie",
},
];

export const FollowInterviewerCard = () => {
const intl = useIntl();
const [search, setSearch] = useDebouncedState("", 500);

Check failure on line 42 in src/ui/FollowInterviewerCard.tsx

View workflow job for this annotation

GitHub Actions / test_lint

'search' is assigned a value but never used
// const [page, setPage] = useState(0);

// const handleChangePage = (_: React.MouseEvent<HTMLButtonElement> | null, newPage: number) => {
// setPage(newPage);
// };

return (
<Card variant="general" sx={{ height: "calc(100vh - 140px)", py: 4, px: 3 }}>
<Stack gap={3}>
<Typography variant="headlineLarge">
{intl.formatMessage({ id: "followInterviewer" })}
</Typography>
<SearchField
onChange={e => setSearch(e.target.value)}
label={intl.formatMessage({ id: "toSearchLabel" })}
placeholder={intl.formatMessage({ id: "searchInterviewer" })}
/>

<TableContainer>
<Table aria-label="interviewer list" size="small" sx={{ typography: "bodyMedium" }}>
<TableHead>
<TableRow>
<TableCell sx={{ color: "text.tertiary" }}>
{intl.formatMessage({ id: "chooseInterviewer" })}
</TableCell>
</TableRow>
</TableHead>
<TableBody>
{interviewersMock.map(interviewer => (
<TableRow key={interviewer.id}>
<TableCell>
{interviewer.interviewerLastName.toLocaleUpperCase()}{" "}
{interviewer.interviewerFirstName}
</TableCell>
</TableRow>
))}
</TableBody>
{/* TODO use TableFooter */}
</Table>
</TableContainer>
</Stack>
</Card>
);
};

0 comments on commit 5b8c1b0

Please sign in to comment.