-
Notifications
You must be signed in to change notification settings - Fork 5
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
7bc3f92
commit 8543b60
Showing
14 changed files
with
292 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,59 @@ | ||
import { Typography } from "@mui/material"; | ||
import { useIntl } from "react-intl"; | ||
import { FollowSinglePageHeader } from "../ui/follow/FollowSinglePageHeader"; | ||
import { SyntheticEvent, useState } from "react"; | ||
import Tabs from "@mui/material/Tabs"; | ||
import Stack from "@mui/material/Stack"; | ||
import { PageTab } from "../ui/PageTab"; | ||
import { FollowCampaignProgress } from "../ui/follow/FollowCampaignProgress"; | ||
|
||
// TODO remove | ||
const labelMock = "Logement"; | ||
|
||
enum Tab { | ||
progress = "progress", | ||
collect = "collect", | ||
reminders = "reminders", | ||
provisionalStatus = "provisionalStatus", | ||
closedSU = "closedSU", | ||
terminatedSU = "terminatedSU", | ||
} | ||
|
||
export const FollowCampaignPage = () => { | ||
return <Typography>page suivre enquête</Typography>; | ||
const intl = useIntl(); | ||
const [currentTab, setCurrentTab] = useState(Tab.progress); | ||
const handleChange = (_: SyntheticEvent, newValue: Tab) => { | ||
setCurrentTab(newValue); | ||
}; | ||
|
||
const breadcrumbs = [ | ||
{ href: "/follow", title: "goToFollowPage" }, | ||
intl.formatMessage({ id: "followCampaignBreacrumb" }), | ||
labelMock, | ||
]; | ||
|
||
return ( | ||
<> | ||
<FollowSinglePageHeader category={"survey"} label={labelMock} breadcrumbs={breadcrumbs} /> | ||
<Tabs | ||
value={currentTab} | ||
onChange={handleChange} | ||
sx={{ | ||
px: 3, | ||
backgroundColor: "white", | ||
}} | ||
> | ||
{Object.keys(Tab).map(k => ( | ||
<PageTab key={k} value={k} label={intl.formatMessage({ id: k })} /> | ||
))} | ||
</Tabs> | ||
<Stack px={3} py={4}> | ||
{currentTab === Tab.progress && <FollowCampaignProgress />} | ||
{currentTab === Tab.collect && <>tab collecte</>} | ||
{currentTab === Tab.reminders && <>tab relances</>} | ||
{currentTab === Tab.provisionalStatus && <>tab statut provisoire</>} | ||
{currentTab === Tab.closedSU && <>tab UE cloturées</>} | ||
{currentTab === Tab.terminatedSU && <>tab UE terminées</>} | ||
</Stack> | ||
</> | ||
); | ||
}; |
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,53 @@ | ||
import MuiBreadcrumbs from "@mui/material/Breadcrumbs"; | ||
import Box from "@mui/material/Box"; | ||
import Link from "@mui/material/Link"; | ||
import { NavLink } from "react-router-dom"; | ||
import { useIntl } from "react-intl"; | ||
|
||
export type BreadcrumbsItem = { href: string; title: string } | string; | ||
|
||
type Props = { | ||
items: BreadcrumbsItem[]; | ||
}; | ||
|
||
export function Breadcrumbs({ items }: Readonly<Props>) { | ||
return ( | ||
<MuiBreadcrumbs | ||
aria-label="breadcrumb" | ||
sx={{ | ||
typography: "itemSmall", | ||
".MuiBreadcrumbs-separator": { | ||
color: "text.tertiary", | ||
}, | ||
}} | ||
> | ||
{items.map(item => ( | ||
<BreadcrumbsItem item={item} key={getKey(item)} /> | ||
))} | ||
</MuiBreadcrumbs> | ||
); | ||
} | ||
|
||
function getKey(item: BreadcrumbsItem) { | ||
if (typeof item === "string") { | ||
return item; | ||
} | ||
return item.href; | ||
} | ||
|
||
function BreadcrumbsItem({ item }: Readonly<{ item: BreadcrumbsItem }>) { | ||
const intl = useIntl(); | ||
if (typeof item === "string") { | ||
return ( | ||
<Box component="span" color="text.tertiary"> | ||
{item} | ||
</Box> | ||
); | ||
} | ||
|
||
return ( | ||
<Link component={NavLink} underline="hover" color="text.tertiary" to={item.href}> | ||
{intl.formatMessage({ id: item.title })} | ||
</Link> | ||
); | ||
} |
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,21 @@ | ||
import Tab, { TabProps } from "@mui/material/Tab"; | ||
|
||
type Props = { | ||
label: string; | ||
} & TabProps; | ||
|
||
export const PageTab = ({ label, ...props }: Props) => { | ||
return ( | ||
<Tab | ||
label={label} | ||
sx={{ | ||
px: 2, | ||
mx: 0.5, | ||
py: 2, | ||
typography: "titleSmall", | ||
letterSpacing: 0.4, | ||
}} | ||
{...props} | ||
/> | ||
); | ||
}; |
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,46 @@ | ||
import { useIntl } from "react-intl"; | ||
import { SyntheticEvent, useState } from "react"; | ||
import Tabs from "@mui/material/Tabs"; | ||
import Stack from "@mui/material/Stack"; | ||
import { SurveyGlobalFollow } from "./SurveyGlobalFollow"; | ||
import { Tab as MuiTab } from "@mui/material"; | ||
|
||
// TODO change tabs | ||
enum Tab { | ||
progress = "progress", | ||
collect = "collect", | ||
reminders = "reminders", | ||
provisionalStatus = "provisionalStatus", | ||
closedSU = "closedSU", | ||
} | ||
|
||
export const FollowCampaignProgress = () => { | ||
const intl = useIntl(); | ||
const [currentTab, setCurrentTab] = useState(Tab.progress); | ||
const handleChange = (_: SyntheticEvent, newValue: Tab) => { | ||
setCurrentTab(newValue); | ||
}; | ||
|
||
return ( | ||
<> | ||
<Tabs | ||
value={currentTab} | ||
onChange={handleChange} | ||
sx={{ ml: 5, ".MuiTabs-indicator": { backgroundColor: "white" } }} | ||
> | ||
{Object.keys(Tab).map(k => ( | ||
<MuiTab classes={"cardTab"} label={intl.formatMessage({ id: k })} key={k} value={k} /> | ||
))} | ||
</Tabs> | ||
|
||
<Stack> | ||
{/* todo changes components and tabs */} | ||
{currentTab === Tab.progress && <SurveyGlobalFollow />} | ||
{currentTab === Tab.collect && <SurveyGlobalFollow />} | ||
{currentTab === Tab.reminders && <SurveyGlobalFollow />} | ||
{currentTab === Tab.provisionalStatus && <SurveyGlobalFollow />} | ||
{currentTab === Tab.closedSU && <SurveyGlobalFollow />} | ||
</Stack> | ||
</> | ||
); | ||
}; |
2 changes: 1 addition & 1 deletion
2
src/ui/FollowCardHeader.tsx → src/ui/follow/FollowCardHeader.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
6 changes: 3 additions & 3 deletions
6
src/ui/FollowInterviewerCard.tsx → src/ui/follow/FollowInterviewerCard.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
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,39 @@ | ||
import { useNavigate } from "react-router-dom"; | ||
import { Row } from "../Row"; | ||
import Stack from "@mui/material/Stack"; | ||
import { Box, Divider, IconButton, Typography } from "@mui/material"; | ||
import ArrowBackIosNewIcon from "@mui/icons-material/ArrowBackIosNew"; | ||
import { Breadcrumbs, BreadcrumbsItem } from "../Breadcrumbs"; | ||
import { useIntl } from "react-intl"; | ||
|
||
type Props = { | ||
category: string; | ||
label: string; | ||
breadcrumbs: BreadcrumbsItem[]; | ||
}; | ||
|
||
export const FollowSinglePageHeader = ({ category, label, breadcrumbs }: Props) => { | ||
const navigate = useNavigate(); | ||
const intl = useIntl(); | ||
|
||
return ( | ||
<Stack bgcolor={"white"}> | ||
<Divider variant="fullWidth" /> | ||
<Row justifyContent={"space-between"} alignItems={"initial"} px={4} py={3}> | ||
<Row gap={4}> | ||
<IconButton sx={{ bgcolor: "background.default" }} onClick={() => navigate(-1)}> | ||
<ArrowBackIosNewIcon sx={{ color: "black.main" }} /> | ||
</IconButton> | ||
<Typography variant="headlineLarge"> | ||
<Box component={"span"}>{intl.formatMessage({ id: category })} - </Box> | ||
<Box component={"span"} sx={{ color: "text.tertiary" }}> | ||
{label} | ||
</Box> | ||
</Typography> | ||
</Row> | ||
<Breadcrumbs items={breadcrumbs} /> | ||
</Row> | ||
<Divider variant="fullWidth" /> | ||
</Stack> | ||
); | ||
}; |
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,11 @@ | ||
import { Card, Typography } from "@mui/material"; | ||
import { useIntl } from "react-intl"; | ||
|
||
export const SurveyGlobalFollow = () => { | ||
const intl = useIntl(); | ||
return ( | ||
<Card variant="general" sx={{ p: 4, zIndex: 3, boxShadow: "none" }}> | ||
<Typography variant="titleSmall">{intl.formatMessage({ id: "followSurvey" })}</Typography> | ||
</Card> | ||
); | ||
}; |