Skip to content

Commit

Permalink
Added translation and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
synnestokkevaag committed Jan 16, 2025
1 parent 6e37fe5 commit fc2f6cc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
6 changes: 3 additions & 3 deletions plugins/ros/src/components/riScInfo/RiScInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,17 @@ export const RiScInfo = ({ riSc, edit }: RiScInfoProps) => {
</InfoCard>
</Grid>
<Grid item xs={8} sm={4} md={4}>
<LastPublishedComponent
<RiScStatusComponent
selectedRiSc={riSc}
publishRiScFn={approveRiSc}
differenceFetchState={differenceFetchState}
setDifferenceFetchState={setDifferenceFetchState}
emptyDifferenceFetchState={emptyDifferenceFetchState}
/>
</Grid>
<Grid item xs={8} sm={4} md={4}>
<RiScStatusComponent
<LastPublishedComponent
selectedRiSc={riSc}
publishRiScFn={approveRiSc}
differenceFetchState={differenceFetchState}
setDifferenceFetchState={setDifferenceFetchState}
emptyDifferenceFetchState={emptyDifferenceFetchState}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { parseISO } from 'date-fns';
import { parseISO, differenceInDays } from 'date-fns';
import {
getAgeStatus,
parseISODateFromEncryptedROS,
Expand Down Expand Up @@ -81,32 +81,34 @@ export const LastPublishedComponent = ({
differenceFetchState.defaultLastModifiedDateString,
);

const lastModifiedDate =
formatedDateString && parseISO(formatedDateString).toLocaleDateString();
const lastModifiedDate = formatedDateString && parseISO(formatedDateString);
const daysSincePublication =
lastModifiedDate && differenceInDays(new Date(), lastModifiedDate);

const age = lastModifiedDate && getAgeStatus(lastModifiedDate);
const age =
lastModifiedDate && getAgeStatus(lastModifiedDate.toLocaleDateString());

return (
<InfoCard>
<Typography variant="h5">Publication status</Typography>
<Typography variant="h5">{t('rosStatus.lastPublished')}</Typography>
{differenceFetchState.isLoading ? (
<Box mt={1}>
<Skeleton variant="text" width="40%" height={26} />
<Skeleton variant="text" width="60%" height={26} />
<Skeleton variant="text" width="40%" height={26} />
</Box>
) : (
<>
{!lastModifiedDate && (
<Typography display="flex" gap={1} mt={1}>
<HighlightOffIcon color="error" />
No risk scorecard published
{t('rosStatus.notPublished')}
</Typography>
)}
{lastModifiedDate && (
<Typography display="flex" flexDirection="column" gap={1} mt={1}>
<Box display="flex" gap={1}>
<CheckCircleOutlineIcon color="success" />
Risk scorecard published
{t('rosStatus.published')}
</Box>
<Box display="flex" gap={1}>
{age === 'bad' && (
Expand All @@ -116,8 +118,8 @@ export const LastPublishedComponent = ({
{age === 'good' && (
<SentimentSatisfiedAltIcon color="success" />
)}
{t('rosStatus.difference.publishDate')}
{lastModifiedDate}
{daysSincePublication}
{t('rosStatus.publishDate')}
</Box>
</Typography>
)}
Expand Down
11 changes: 9 additions & 2 deletions plugins/ros/src/utils/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ export const pluginRiScTranslationRef = createTranslationRef({
},
difference: {
description: 'Summary of changes that will be approved by risk owner.',
publishDate: 'Last published changes: ',
fetching: 'Fetching changes',
error: 'Error while fetching changes',
newROS: 'No published Risk scorecards to compare with',
Expand All @@ -99,6 +98,10 @@ export const pluginRiScTranslationRef = createTranslationRef({
noneAdded: 'Nothing is added',
},
},
lastPublished: 'Last published',
published: 'Risk scorecard published',
notPublished: 'No risk scorecard published',
publishDate: ' days since last publish',
editing: 'You can now start editing',
approveButton: 'Accept risks', // Godkjenn ROS
prStatus: ' Merge the PR in ', // Avventer godkjenning av PR i Github
Expand Down Expand Up @@ -509,14 +512,18 @@ export const pluginRiScNorwegianTranslation = createTranslationResource({
'rosStatus.statusBadge.draft': 'Utkast',
'rosStatus.statusBadge.waiting': 'Avventer godkjenning',
'rosStatus.statusBadge.published': 'Publisert',
'rosStatus.lastPublished': 'Siste publisering',
'rosStatus.notPublished': 'Ingen ROS publisert',
'rosStatus.published': 'ROS publisert',
'rosStatus.publishDate': ' dager siden forrige publisering',
'rosStatus.editing': 'Du kan nå gjøre endringer',
'rosStatus.approveButton': 'Godkjenn ROS',
'rosStatus.prStatus': ' Merge pull requesten i ',
'rosStatus.prStatus2': " for å publisere ROS'en.",
'rosStatus.moreInformationButton': 'Mer informasjon',
'rosStatus.difference.description':
'Oppsummering av endringer som må godkjennes av risikoeier.',
'rosStatus.difference.publishDate': 'Siste publiserte endringer: ',

'rosStatus.difference.fetching': 'Henter endringer',
'rosStatus.difference.error': 'Feil med uthenting av endringer',
'rosStatus.difference.newROS':
Expand Down

0 comments on commit fc2f6cc

Please sign in to comment.