-
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.
Merge pull request #58 from Opetushallitus/OK-674-henkilo-suorita-val…
…intalaskenta OK-674: Henkilöittäin-näkymän valintalaskenta
- Loading branch information
Showing
55 changed files
with
2,148 additions
and
1,104 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
VIRKAILIJA_URL=https://virkailija.untuvaopintopolku.fi | ||
NEXT_TELEMETRY_DISABLED=1 |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,79 @@ | ||
'use client'; | ||
|
||
import { | ||
Accordion, | ||
AccordionDetails, | ||
AccordionSummary, | ||
Alert, | ||
Box, | ||
Typography, | ||
} from '@mui/material'; | ||
import { useTranslations } from '@/app/hooks/useTranslations'; | ||
import { useState } from 'react'; | ||
import { styled } from '@/app/lib/theme'; | ||
import { ArrowRight } from '@mui/icons-material'; | ||
|
||
const StyledAccordionSummary = styled(AccordionSummary)({ | ||
flexDirection: 'row-reverse', | ||
padding: 0, | ||
'.Mui-expanded .custom-expand-icon': { | ||
transform: 'rotate(-90deg)', | ||
}, | ||
}); | ||
|
||
const ErrorContent = ({ | ||
message, | ||
}: { | ||
message: string | Array<string> | undefined; | ||
}) => { | ||
return message | ||
? (Array.isArray(message) ? message : [message]).map((msg, index) => { | ||
return ( | ||
<Typography variant="body2" key={`error-message-${index}`}> | ||
{msg} | ||
</Typography> | ||
); | ||
}) | ||
: null; | ||
}; | ||
|
||
export const ErrorAlert = ({ | ||
title, | ||
message, | ||
hasAccordion = false, | ||
}: { | ||
title: string; | ||
message: string | Array<string> | undefined; | ||
hasAccordion?: boolean; | ||
}) => { | ||
const [errorVisible, setErrorVisible] = useState(false); | ||
const { t } = useTranslations(); | ||
|
||
return ( | ||
<Alert severity="error"> | ||
<Typography color="error">{title}</Typography> | ||
<Box sx={{ marginTop: 1 }}> | ||
{hasAccordion ? ( | ||
<Accordion sx={{ backgroundColor: 'transparent' }}> | ||
<StyledAccordionSummary | ||
expandIcon={<ArrowRight className="custom-expand-icon" />} | ||
sx={{ flexDirection: 'row-reverse', padding: 0 }} | ||
onClick={() => setErrorVisible(!errorVisible)} | ||
> | ||
<Typography> | ||
{errorVisible | ||
? t('valinnanhallinta.piilotavirhe') | ||
: t('valinnanhallinta.naytavirhe')} | ||
</Typography> | ||
</StyledAccordionSummary> | ||
<AccordionDetails sx={{ paddingLeft: 0 }}> | ||
<ErrorContent message={message} /> | ||
</AccordionDetails> | ||
</Accordion> | ||
) : ( | ||
<ErrorContent message={message} /> | ||
)} | ||
</Box> | ||
</Alert> | ||
); | ||
}; |
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,19 @@ | ||
import { ErrorOutline } from '@mui/icons-material'; | ||
import { Box, SvgIconProps } from '@mui/material'; | ||
|
||
export const ErrorWithIcon = ({ | ||
children, | ||
color, | ||
}: { | ||
children: React.ReactNode; | ||
color?: SvgIconProps['color']; | ||
}) => { | ||
return ( | ||
<Box sx={{ display: 'flex', alignItems: 'flex-start' }}> | ||
<ErrorOutline color={color ?? 'error'} /> | ||
<Box component="span" sx={{ paddingLeft: 1 }}> | ||
{children} | ||
</Box> | ||
</Box> | ||
); | ||
}; |
This file was deleted.
Oops, something went wrong.
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,47 @@ | ||
import { Box } from '@mui/material'; | ||
import { ophColors } from '@opetushallitus/oph-design-system'; | ||
import { TRANSITION_DURATION } from '@/app/lib/constants'; | ||
|
||
const PROGRESSBAR_HEIGHT = '42px'; | ||
|
||
export const ProgressBar = ({ value }: { value: number }) => { | ||
const valuePercent = `${value}%`; | ||
return ( | ||
<Box | ||
role="progressbar" | ||
aria-valuenow={value} | ||
aria-valuetext={valuePercent} | ||
aria-valuemin={0} | ||
aria-valuemax={100} | ||
sx={{ | ||
position: 'relative', | ||
display: 'block', | ||
height: PROGRESSBAR_HEIGHT, | ||
border: `1px solid ${ophColors.grey300}`, | ||
maxWidth: '700px', | ||
borderRadius: '2px', | ||
'&:before, &:after': { | ||
position: 'absolute', | ||
whiteSpace: 'nowrap', | ||
overflow: 'hidden', | ||
content: `"${valuePercent}"`, | ||
height: '100%', | ||
lineHeight: PROGRESSBAR_HEIGHT, | ||
textIndent: (theme) => theme.spacing(2), | ||
userSelect: 'none', | ||
}, | ||
'&:before': { | ||
backgroundColor: ophColors.white, | ||
color: ophColors.grey900, | ||
width: '100%', | ||
}, | ||
'&:after': { | ||
backgroundColor: ophColors.cyan1, | ||
color: ophColors.white, | ||
width: valuePercent, | ||
transition: `${TRANSITION_DURATION} width linear`, | ||
}, | ||
}} | ||
/> | ||
); | ||
}; |
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.