diff --git a/CHANGELOG.md b/CHANGELOG.md index acd0635..e5bbb5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to ### Added - ✨(backend) manage roles on domain admin view +- ✨(frontend) show version number in footer #369 ### Changed diff --git a/src/frontend/apps/desk/src/__tests__/pages.test.tsx b/src/frontend/apps/desk/src/__tests__/pages.test.tsx index 1713238..a6527c6 100644 --- a/src/frontend/apps/desk/src/__tests__/pages.test.tsx +++ b/src/frontend/apps/desk/src/__tests__/pages.test.tsx @@ -21,7 +21,7 @@ describe('Page', () => { it('checks Page rendering with team feature', () => { useConfigStore.setState({ - config: { FEATURES: { TEAMS: true }, LANGUAGES: [] }, + config: { RELEASE: '1.0.0', FEATURES: { TEAMS: true }, LANGUAGES: [] }, }); render(, { wrapper: AppWrapper }); @@ -31,7 +31,7 @@ describe('Page', () => { it('checks Page rendering without team feature', () => { useConfigStore.setState({ - config: { FEATURES: { TEAMS: false }, LANGUAGES: [] }, + config: { RELEASE: '1.0.0', FEATURES: { TEAMS: false }, LANGUAGES: [] }, }); render(, { wrapper: AppWrapper }); diff --git a/src/frontend/apps/desk/src/core/__tests__/MainLayout.test.tsx b/src/frontend/apps/desk/src/core/__tests__/MainLayout.test.tsx index a54b811..9ff038c 100644 --- a/src/frontend/apps/desk/src/core/__tests__/MainLayout.test.tsx +++ b/src/frontend/apps/desk/src/core/__tests__/MainLayout.test.tsx @@ -17,7 +17,7 @@ jest.mock('next/navigation', () => ({ describe('MainLayout', () => { it('checks menu rendering with team feature', () => { useConfigStore.setState({ - config: { FEATURES: { TEAMS: true }, LANGUAGES: [] }, + config: { RELEASE: '1.0.0', FEATURES: { TEAMS: true }, LANGUAGES: [] }, }); render(, { wrapper: AppWrapper }); @@ -37,7 +37,7 @@ describe('MainLayout', () => { it('checks menu rendering without team feature', () => { useConfigStore.setState({ - config: { FEATURES: { TEAMS: false }, LANGUAGES: [] }, + config: { RELEASE: '1.0.0', FEATURES: { TEAMS: false }, LANGUAGES: [] }, }); render(, { wrapper: AppWrapper }); diff --git a/src/frontend/apps/desk/src/core/config/types.ts b/src/frontend/apps/desk/src/core/config/types.ts index cc9a2e7..3e5ab93 100644 --- a/src/frontend/apps/desk/src/core/config/types.ts +++ b/src/frontend/apps/desk/src/core/config/types.ts @@ -1,5 +1,6 @@ export interface Config { LANGUAGES: [string, string][]; + RELEASE: string; FEATURES: { TEAMS: boolean; }; diff --git a/src/frontend/apps/desk/src/features/footer/Footer.tsx b/src/frontend/apps/desk/src/features/footer/Footer.tsx index 9d92364..95808c5 100644 --- a/src/frontend/apps/desk/src/features/footer/Footer.tsx +++ b/src/frontend/apps/desk/src/features/footer/Footer.tsx @@ -3,6 +3,7 @@ import { Trans, useTranslation } from 'react-i18next'; import styled from 'styled-components'; import { Box, LogoGouv, StyledLink, Text } from '@/components'; +import { useConfigStore } from '@/core'; import IconLink from './assets/external-link.svg'; @@ -16,6 +17,7 @@ const BlueStripe = styled.div` export const Footer = () => { const { t } = useTranslation(); + const { config } = useConfigStore(); return ( @@ -94,7 +96,7 @@ export const Footer = () => { $padding={{ top: 'tiny' }} $css=" flex-wrap: wrap; - border-top: 1px solid var(--c--theme--colors--greyscale-200); + border-top: 1px solid var(--c--theme--colors--greyscale-200); column-gap: 1rem; row-gap: .5rem; " @@ -138,6 +140,7 @@ export const Footer = () => { ))} + { $variation="600" $display="inline" > + {config?.RELEASE && ( + <> + {t(`Version: {{release}}`, { release: config?.RELEASE })} •  + + )} + Unless otherwise stated, all content on this site is under { await expect(page).toHaveURL(url); }); } + + test('check if the app version is visible', async ({ page }) => { + const footer = page.locator('footer').first(); + await expect( + footer.getByText( + 'Version: NA • Unless otherwise stated, all content on this site is under', + ), + ).toBeVisible(); + }); });