Skip to content

Commit

Permalink
add scrollToTop to several pages (#1254)
Browse files Browse the repository at this point in the history
  • Loading branch information
dxb committed Jul 26, 2023
1 parent d4b2275 commit e2357db
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 11 deletions.
3 changes: 2 additions & 1 deletion source/sites/publicodes/Actions.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import NorthstarBanner from '@/components/Feedback/NorthstarBanner'
import Title from '@/components/groupe/Title'
import Meta from '@/components/utils/Meta'
import { ScrollToTop } from '@/components/utils/Scroll'
import { Trans, useTranslation } from 'react-i18next'
import { Route, Routes } from 'react-router-dom'
import Action from './Action'
Expand All @@ -17,7 +18,7 @@ export default () => {
title={t("Passer à l'action")}
description={t('meta.pages.actions.description')}
/>

<ScrollToTop />
<Title title={<Trans>Agir</Trans>} />
<ScoreBar actionMode />
<NorthstarBanner type="SET_RATING_ACTION" />
Expand Down
3 changes: 2 additions & 1 deletion source/sites/publicodes/Contact.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Title from '@/components/groupe/Title'
import { ScrollToTop } from '@/components/utils/Scroll'
import { useState } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import Meta from '../../components/utils/Meta'
Expand Down Expand Up @@ -171,7 +172,7 @@ export default () => {
title={t('meta.publicodes.Contact.titre')}
description={t('meta.publicodes.Contact.description')}
></Meta>

<ScrollToTop />
<Title title={<Trans>Contact</Trans>} />
<h2>
🙋‍♀️{' '}
Expand Down
2 changes: 2 additions & 0 deletions source/sites/publicodes/Simulateur.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import Simulation from '@/components/Simulation'
import { useEngine } from '@/components/utils/EngineContext'
import { Markdown } from '@/components/utils/markdown'
import Meta from '@/components/utils/Meta'
import { ScrollToTop } from '@/components/utils/Scroll'
import { useMatomo } from '@/contexts/MatomoContext'
import { useGetCurrentSimulation } from '@/hooks/useGetCurrentSimulation'
import { useSetUserId } from '@/hooks/useSetUserId'
Expand Down Expand Up @@ -173,6 +174,7 @@ const SimulateurCore = ({ simulatorRootNameURL, simulatorRootRuleName }) => {
description={evaluation.rawNode?.description}
/>
<Title title={t('Votre bilan climat personnel')} />
<ScrollToTop />
<div>
{!displayTutorial && (
<motion.div
Expand Down
5 changes: 3 additions & 2 deletions source/sites/publicodes/conference/GroupSwitch.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import Title from '@/components/groupe/Title'
import Meta from '@/components/utils/Meta'
import { ScrollToTop } from '@/components/utils/Scroll'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import Meta from '../../../components/utils/Meta'
import Instructions from './Instructions'
import { generateRoomName } from './utils'

Expand All @@ -18,7 +19,7 @@ export default () => {
)}
/>
<Title data-cypress-id="group-title" title={t('Mode groupe')} />

<ScrollToTop />
<Instructions {...{ newRoom, setNewRoom }} />
</div>
)
Expand Down
12 changes: 6 additions & 6 deletions source/sites/publicodes/pages/GuideGroupe.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { getTitle, splitName } from 'Components/publicodesUtils'
import useFetchDocumentation from 'Components/useFetchDocumentation'
import { Markdown } from 'Components/utils/markdown'
import Meta from 'Components/utils/Meta'
import { ScrollToTop } from 'Components/utils/Scroll'
import { getTitle, splitName } from '@/components/publicodesUtils'
import useFetchDocumentation from '@/components/useFetchDocumentation'
import { Markdown } from '@/components/utils/markdown'
import Meta from '@/components/utils/Meta'
import { ScrollToTop } from '@/components/utils/Scroll'
import { utils } from 'publicodes'
import { Trans, useTranslation } from 'react-i18next'
import { useParams } from 'react-router'
Expand Down Expand Up @@ -50,12 +50,12 @@ export default () => {
return (
<GuideWrapper>
<Meta title={titre} />
<ScrollToTop />
<Link to={'/guide'}>
<button className="ui__ button simple">
<Trans>◀ Retour</Trans>
</button>
</Link>
<ScrollToTop />
<div>
<Markdown
children={
Expand Down
2 changes: 2 additions & 0 deletions source/sites/publicodes/pages/MarkdownPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Markdown } from '@/components/utils/markdown'
import { useTranslation } from 'react-i18next'

import Meta from '@/components/utils/Meta'
import { ScrollToTop } from '@/components/utils/Scroll'
import { getMarkdownInCurrentLang, Lang } from '@/locales/translation'

export type PageProps = {
Expand All @@ -23,6 +24,7 @@ export default ({ markdownFiles, title, description, image }: PageProps) => {
{title && description && (
<Meta title={title} description={description} image={image} />
)}
<ScrollToTop />
<Markdown children={content} />
</section>
)
Expand Down
4 changes: 3 additions & 1 deletion source/sites/publicodes/pages/Stats.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { QueryClient, QueryClientProvider } from 'react-query'

import StatsContent from 'Components/stats/StatsContent'
import StatsContent from '@/components/stats/StatsContent'
import { ScrollToTop } from '@/components/utils/Scroll'

const queryClient = new QueryClient({
defaultOptions: {
Expand All @@ -15,6 +16,7 @@ const queryClient = new QueryClient({
export default function Dashboard() {
return (
<QueryClientProvider client={queryClient}>
<ScrollToTop />
<StatsContent />
</QueryClientProvider>
)
Expand Down

0 comments on commit e2357db

Please sign in to comment.