Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1476 from navikt/korrigere-nedtelling-for-session…
Browse files Browse the repository at this point in the history
…-utlop

Korrigerer minuttvisning av gjenstående session
  • Loading branch information
terjeofnorway authored Aug 28, 2023
2 parents a0daf00 + 594efa0 commit 88714f3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/komponenter/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ export const Header = () => {
{useSimpleHeader ? <HeaderSimple /> : <HeaderRegular />}
</header>
<Driftsmeldinger />
{PARAMS.LOGOUT_WARNING && <LogoutWarning />}
{(PARAMS.LOGOUT_WARNING || ENV === 'dev') && <LogoutWarning />}
{(breadcrumbs.length > 0 || availableLanguages.length > 0) && (
// Klassen "decorator-utils-container" brukes av appene til å sette bakgrunn
<div
Expand Down
5 changes: 3 additions & 2 deletions src/komponenter/header/logoutWarning/LogoutWarning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import { LangKey } from 'tekster/ledetekster';
import styles from './LogoutWarning.module.scss';

export const LogoutWarning = () => {
const { refreshTokenHandler, logoutHandler, isTokenExpiring, isSessionExpiring, secondsToSessionExpires } = useLoginStatus();
const { refreshTokenHandler, logoutHandler, isTokenExpiring, isSessionExpiring, secondsToSessionExpires } =
useLoginStatus();
const [isOpen, setIsOpen] = React.useState(false);
const { language } = useSelector((state: AppState) => state.language);

Expand All @@ -38,7 +39,7 @@ export const LogoutWarning = () => {
const titleId: LangKey = isSessionExpiring ? 'snart-session-logget-ut-tittel' : 'snart-token-logget-ut-tittel';
const textBodyId: LangKey = isSessionExpiring ? 'snart-session-logget-ut-body' : 'snart-token-logget-ut-body';

const minutesToSessionEnd = Math.floor(secondsToSessionExpires / 60);
const minutesToSessionEnd = Math.ceil(secondsToSessionExpires / 60);

return (
<Modal
Expand Down
11 changes: 8 additions & 3 deletions src/tekster/ledetekster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,14 @@ export const ledetekster = {
'snart-token-logget-ut-body': 'Vil du fortsatt være innlogget?',
'snart-token-logget-ut-body-en': 'Would you like to stay logged in?',
'snart-token-logget-ut-body-se': 'Vil du fortsatt være innlogget?',
'snart-session-logget-ut-tittel': (input: string) => `Du blir logget ut automatisk om ${input} ${Number.parseInt(input, 10) === 1 ? 'minutt' : 'minutter'}`,
'snart-session-logget-ut-tittel-en': (input: string) => `You will be logged out automatically in ${input} ${Number.parseInt(input, 10) === 1 ? 'minute' : 'minutes'}`,
'snart-session-logget-ut-tittel-se': (input: string) => `Du blir logget ut automatisk om ${input} ${Number.parseInt(input, 10) === 1 ? 'minutt' : 'minutter'}`,
'snart-session-logget-ut-tittel': (input: string) =>
`Du blir logget ut automatisk om ca ${input} ${Number.parseInt(input, 10) === 1 ? 'minutt' : 'minutter'}`,
'snart-session-logget-ut-tittel-en': (input: string) =>
`You will be logged out automatically in about ${input} ${
Number.parseInt(input, 10) === 1 ? 'minute' : 'minutes'
}`,
'snart-session-logget-ut-tittel-se': (input: string) =>
`Du blir logget ut automatisk om ca ${input} ${Number.parseInt(input, 10) === 1 ? 'minutt' : 'minutter'}`,
'snart-session-logget-ut-body': 'Avslutt det du jobber med og logg inn igjen.',
'snart-session-logget-ut-body-en': 'Please wrap up what you are doing and log in again.',
'snart-session-logget-ut-body-se': 'Avslutt det du jobber med og logg inn igjen.',
Expand Down

0 comments on commit 88714f3

Please sign in to comment.