diff --git a/services/madoc-ts/src/frontend/shared/components/TermsPopup.tsx b/services/madoc-ts/src/frontend/shared/components/TermsPopup.tsx index 8046f2e4e..567e74ab4 100644 --- a/services/madoc-ts/src/frontend/shared/components/TermsPopup.tsx +++ b/services/madoc-ts/src/frontend/shared/components/TermsPopup.tsx @@ -2,11 +2,14 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; import { useSite, useUser } from '../hooks/use-site'; import { HrefLink } from '../utility/href-link'; +import { useLocation } from 'react-router-dom'; export function TermsPopup() { const user = useUser(); const site = useSite(); const { t } = useTranslation(); + const location = useLocation(); + const [closed, setClosed] = React.useState(false); if (!user || !site.latestTerms) { return null; @@ -34,6 +37,14 @@ export function TermsPopup() { return null; } + if (location.pathname === '/terms') { + return null; + } + + if (closed) { + return null; + } + return (
+
+ +
{newTerms ? (

{t('You have not yet accepted the terms of use for this site.')}

) : (

{t('The terms of use for this site have changed since you last accepted them.')}

)} - + {termsMessage}
diff --git a/services/madoc-ts/src/frontend/shared/navigation/Button.tsx b/services/madoc-ts/src/frontend/shared/navigation/Button.tsx index c2a69794c..12be27b0f 100644 --- a/services/madoc-ts/src/frontend/shared/navigation/Button.tsx +++ b/services/madoc-ts/src/frontend/shared/navigation/Button.tsx @@ -44,6 +44,10 @@ export const Button = styled.button<{ background: linear-gradient(180deg, #fafbfc 0%, #eff3f6 90%); border: 1px solid rgba(27, 31, 35, 0.15); color: #333; + + &[type="submit"] { + background: linear-gradient(180deg, #fafbfc 0%, #eff3f6 90%); + } ${props => @@ -97,6 +101,10 @@ export const Button = styled.button<{ background: #4265e9; color: #fff; border: 1px solid #4265e9; + + &[type='submit'] { + background: #4265e9; + } &:active { box-shadow: inset 0 2px 8px 0 rgba(39, 75, 155, 0.8); } diff --git a/services/madoc-ts/src/frontend/site/blocks/ProjectStatistics.tsx b/services/madoc-ts/src/frontend/site/blocks/ProjectStatistics.tsx index bd7691c8c..9cc366d51 100644 --- a/services/madoc-ts/src/frontend/site/blocks/ProjectStatistics.tsx +++ b/services/madoc-ts/src/frontend/site/blocks/ProjectStatistics.tsx @@ -46,7 +46,7 @@ export const ProjectStatistics: React.FC = () => { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - const total = Object.values(project?.statistics).reduce((a, b) => Math.max(a, 0) + Math.max(b, 0)); + const total = Object.values(project?.statistics || {}).reduce((a, b) => Math.max(a, 0) + Math.max(b, 0), 0); if (hideStatistics || !project) { return null; diff --git a/services/madoc-ts/src/frontend/site/pages/user/login-page.tsx b/services/madoc-ts/src/frontend/site/pages/user/login-page.tsx index 8e1e9357d..c6bb80bad 100644 --- a/services/madoc-ts/src/frontend/site/pages/user/login-page.tsx +++ b/services/madoc-ts/src/frontend/site/pages/user/login-page.tsx @@ -49,9 +49,9 @@ export const LoginPage: React.FC = () => {
) : null} - +
{t('Forgot password?')} - +
diff --git a/services/madoc-ts/src/frontend/site/pages/user/register.tsx b/services/madoc-ts/src/frontend/site/pages/user/register.tsx index 8e7654fe8..6c3dfe359 100644 --- a/services/madoc-ts/src/frontend/site/pages/user/register.tsx +++ b/services/madoc-ts/src/frontend/site/pages/user/register.tsx @@ -69,7 +69,7 @@ export const Register: React.FC = () => { } const acceptTerms = site.latestTerms ? ( -
+

{t('By registering you agree to the ')} @@ -139,9 +139,9 @@ export const Register: React.FC = () => { ) : null} - +

{t('Already have an account?')} {t('Login')} - +
diff --git a/services/madoc-ts/src/frontend/site/pages/view-project.tsx b/services/madoc-ts/src/frontend/site/pages/view-project.tsx index 98e18c191..91811c4dc 100644 --- a/services/madoc-ts/src/frontend/site/pages/view-project.tsx +++ b/services/madoc-ts/src/frontend/site/pages/view-project.tsx @@ -28,6 +28,7 @@ import { useProject } from '../hooks/use-project'; export const ViewProject: React.FC = () => { const { t } = useTranslation(); const user = useUser(); + const isAdmin = (user?.scope || []).includes('site.admin'); const { data: project } = useProject(); const available = ( @@ -56,24 +57,24 @@ export const ViewProject: React.FC = () => { {available} - + - {available} + - + -