Skip to content
Snippets Groups Projects
Commit 4b5c8fb8 authored by Yoan VALLET's avatar Yoan VALLET
Browse files

feat: add GCU link in options

parent 55fecfaf
No related branches found
No related tags found
1 merge request!336Feature/cgu tutorials creation
Showing
with 294 additions and 37 deletions
import React from 'react' import React from 'react'
import { shallow } from 'enzyme' import { shallow } from 'enzyme'
import GCU from 'components/GCU/GCU' import GCUContent from 'components/GCU/GCUContent'
jest.mock('cozy-ui/transpiled/react/I18n', () => { jest.mock('cozy-ui/transpiled/react/I18n', () => {
return { return {
...@@ -12,9 +12,9 @@ jest.mock('cozy-ui/transpiled/react/I18n', () => { ...@@ -12,9 +12,9 @@ jest.mock('cozy-ui/transpiled/react/I18n', () => {
} }
}) })
describe('GCU component', () => { describe('GCUContent component', () => {
it('should be rendered correctly', () => { it('should be rendered correctly', () => {
const component = shallow(<GCU />).getElement() const component = shallow(<GCUContent />).getElement()
expect(component).toMatchSnapshot() expect(component).toMatchSnapshot()
}) })
}) })
import React from 'react' import React from 'react'
import './gcu.scss' import './gcuContent.scss'
import { useI18n } from 'cozy-ui/transpiled/react/I18n' import { useI18n } from 'cozy-ui/transpiled/react/I18n'
interface GCUProps { interface GCUContentProps {
fromOption?: boolean fromOption?: boolean
} }
const GCU: React.FC<GCUProps> = ({ fromOption = false }: GCUProps) => { const GCUContent: React.FC<GCUContentProps> = ({
fromOption = false,
}: GCUContentProps) => {
const { t } = useI18n() const { t } = useI18n()
return ( return (
<div className="gcu-root"> <div className="gcu-content-root">
<div className="gcu-content"> <div className="gcu-content-wrapper">
<h1 className="text-22-normal">{t('gcu.title')}</h1> <h1 className="text-22-normal">{t('gcu.title')}</h1>
{!fromOption && <h2 className="text-16-normal">{t('gcu.subtitle')}</h2>} {!fromOption && <h2 className="text-16-normal">{t('gcu.subtitle')}</h2>}
<div className="gcu-content-title">{t('gcu.content.title')}</div> <div className="gcu-content-title">{t('gcu.content.title')}</div>
...@@ -38,4 +40,4 @@ const GCU: React.FC<GCUProps> = ({ fromOption = false }: GCUProps) => { ...@@ -38,4 +40,4 @@ const GCU: React.FC<GCUProps> = ({ fromOption = false }: GCUProps) => {
) )
} }
export default GCU export default GCUContent
import React from 'react'
import { shallow } from 'enzyme'
import LegalNoticeLink from 'components/LegalNotice/LegalNoticeLink'
jest.mock('cozy-ui/transpiled/react/I18n', () => {
return {
useI18n: jest.fn(() => {
return {
t: (str: string) => str,
}
}),
}
})
describe('LegalNoticeLink component', () => {
it('should be rendered correctly', () => {
const component = shallow(<LegalNoticeLink />).getElement()
expect(component).toMatchSnapshot()
})
})
import React from 'react'
import './gcuLink.scss'
import Link from '@material-ui/core/Link'
import { Link as RouterLink } from 'react-router-dom'
import { useI18n } from 'cozy-ui/transpiled/react/I18n'
import StyledIcon from 'components/CommonKit/Icon/StyledIcon'
import LegalNoticeIcon from 'assets/icons/ico/legal-notice.svg'
const GCULink: React.FC = () => {
const { t } = useI18n()
return (
<div className="gcu-link-root">
<div className="gcu-link-content">
<div className="gcu-link-header text-16-normal-uppercase">
{t('gcu_option.title')}
</div>
<Link
className="gcu-link-card-link"
component={RouterLink}
to="options/gcu"
>
<div className="card">
<div className="gcu-link-card">
<div className="gcu-link-card-content">
<StyledIcon
className="gcu-link-card-content-icon"
icon={LegalNoticeIcon}
size={50}
/>
<div className="gcu-link-card-content-title">
{t('gcu_option.read_gcu')}
</div>
</div>
</div>
</div>
</Link>
</div>
</div>
)
}
export default GCULink
import React, { useCallback, useState } from 'react' import React, { useCallback, useState } from 'react'
import './gcumodal.scss' import './gcuModal.scss'
import { useI18n } from 'cozy-ui/transpiled/react/I18n' import { useI18n } from 'cozy-ui/transpiled/react/I18n'
import { useDispatch } from 'react-redux' import { useDispatch } from 'react-redux'
import { updateProfile } from 'store/profile/profile.actions' import { updateProfile } from 'store/profile/profile.actions'
import { Button, Dialog } from '@material-ui/core' import { Button, Dialog } from '@material-ui/core'
import GCU from 'components/GCU/GCU' import GCUContent from 'components/GCU/GCUContent'
import StyledIcon from 'components/CommonKit/Icon/StyledIcon' import StyledIcon from 'components/CommonKit/Icon/StyledIcon'
import arrowIcon from 'assets/icons/visu/gcu/gcu-arrow.svg' import arrowIcon from 'assets/icons/visu/gcu/gcu-arrow.svg'
import { DateTime } from 'luxon' import { DateTime } from 'luxon'
...@@ -51,7 +51,7 @@ const GCUModal: React.FC = () => { ...@@ -51,7 +51,7 @@ const GCUModal: React.FC = () => {
</div> </div>
<div className="gcu-modal-root"> <div className="gcu-modal-root">
<div className="gcu-modal-content" onScroll={handleScroll}> <div className="gcu-modal-content" onScroll={handleScroll}>
<GCU /> <GCUContent />
</div> </div>
<div className="gcu-modal-footer"> <div className="gcu-modal-footer">
{!isBottom && ( {!isBottom && (
......
import React from 'react'
import { shallow } from 'enzyme'
import GCUView from 'components/GCU/GCUView'
describe('GCUView component', () => {
it('should be rendered correctly', () => {
const component = shallow(<GCUView />).getElement()
expect(component).toMatchSnapshot()
})
})
import React, { useCallback, useState } from 'react'
import CozyBar from 'components/Header/CozyBar'
import Header from 'components/Header/Header'
import Content from 'components/Content/Content'
import GCUContent from 'components/GCU/GCUContent'
const GCUView: React.FC = () => {
const [headerHeight, setHeaderHeight] = useState<number>(0)
const defineHeaderHeight = useCallback((height: number) => {
setHeaderHeight(height)
}, [])
return (
<>
<CozyBar titleKey={'common.title_gcu'} displayBackArrow={true} />
<Header
setHeaderHeight={defineHeaderHeight}
desktopTitleKey={'common.title_gcu'}
displayBackArrow={true}
></Header>
<Content height={headerHeight}>
<GCUContent />
</Content>
</>
)
}
export default GCUView
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`GCU component should be rendered correctly 1`] = ` exports[`GCUContent component should be rendered correctly 1`] = `
<div <div
className="gcu-root" className="gcu-content-root"
> >
<div <div
className="gcu-content" className="gcu-content-wrapper"
> >
<h1 <h1
className="text-22-normal" className="text-22-normal"
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`LegalNoticeLink component should be rendered correctly 1`] = `
<div
className="legal-notice-root"
>
<div
className="legal-notice-content"
>
<div
className="legal-notice-header text-16-normal-uppercase"
>
legal.title_legal
</div>
<ForwardRef(WithStyles)
className="legal-notice-card-link"
component={
Object {
"$$typeof": Symbol(react.forward_ref),
"displayName": "Link",
"propTypes": Object {
"innerRef": [Function],
"onClick": [Function],
"replace": [Function],
"target": [Function],
"to": [Function],
},
"render": [Function],
}
}
to="options/legalnotice"
>
<div
className="card"
>
<div
className="legal-notice-card"
>
<div
className="legal-notice-card-content"
>
<StyledIcon
className="legal-notice-card-content-icon"
icon="test-file-stub"
size={50}
/>
<div
className="legal-notice-card-content-title"
>
legal.read_legal
</div>
</div>
</div>
</div>
</ForwardRef(WithStyles)>
</div>
</div>
`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`GCUView component should be rendered correctly 1`] = `
<React.Fragment>
<CozyBar
displayBackArrow={true}
titleKey="common.title_gcu"
/>
<Header
desktopTitleKey="common.title_gcu"
displayBackArrow={true}
setHeaderHeight={[Function]}
/>
<Content
height={0}
>
<GCUContent />
</Content>
</React.Fragment>
`;
.gcu-root{ @import 'src/styles/base/color';
.gcu-content-root{
height: 100%; height: 100%;
width: 100%; width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
text-align: center; text-align: center;
.gcu-content{ .gcu-content-wrapper{
color: $grey-bright;
margin: 2rem; margin: 2rem;
> div:last-child{ > div:last-child{
margin-bottom: 1rem; margin-bottom: 1rem;
......
@import 'src/styles/base/breakpoint';
@import 'src/styles/base/color';
.gcu-link-root {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: $white;
padding: 1rem 1.5rem 0;
margin-top: 1rem;
.gcu-link-header {
margin-bottom: 1.25rem;
}
.gcu-link-content {
p {
color: $white;
}
a {
color: $white;
text-decoration: none;
}
li {
margin: 1rem 0;
}
h2 {
color: $white;
}
h3 {
color: $white;
margin: 2.5rem 0 1rem;
}
.ln-contact {
color: $multi-color;
}
width: 45.75rem;
@media #{$large-phone} {
width: 100%;
}
}
}
.gcu-link-card-link {
color: black;
}
.gcu-link-card {
display: flex;
flex-direction: row;
margin: -0.75rem 0;
width: 100%;
@media #{$large-phone} {
width: 100%;
}
.gcu-link-card-content {
display: flex;
flex-direction: row;
.gcu-link-card-content-icon {
margin: 0.5rem 0;
}
.gcu-link-card-content-title {
margin: 0 1rem;
align-self: center;
}
}
}
import React from 'react' import React from 'react'
import { shallow } from 'enzyme' import { shallow } from 'enzyme'
import LegalNoticeLink from 'components/LegalNotice/LegalNoticeLink' import GCULink from 'components/GCU/GCULink'
jest.mock('cozy-ui/transpiled/react/I18n', () => { jest.mock('cozy-ui/transpiled/react/I18n', () => {
return { return {
useI18n: jest.fn(() => { useI18n: jest.fn(() => {
return { return {
t: (str: string) => str, t: (str: string) => str,
} }
}), }),
} }
}) })
describe('LegalNoticeView component', () => { describe('GCULink component', () => {
it('should be rendered correctly', () => { it('should be rendered correctly', () => {
const component = shallow(<LegalNoticeLink />).getElement() const component = shallow(<GCULink />).getElement()
expect(component).toMatchSnapshot() expect(component).toMatchSnapshot()
}) })
}) })
...@@ -6,6 +6,7 @@ import KonnectorViewerList from 'components/Konnector/KonnectorViewerList' ...@@ -6,6 +6,7 @@ import KonnectorViewerList from 'components/Konnector/KonnectorViewerList'
import ReportOptions from 'components/Options/ReportOptions' import ReportOptions from 'components/Options/ReportOptions'
import FAQLink from 'components/FAQ/FAQLink' import FAQLink from 'components/FAQ/FAQLink'
import LegalNoticeLink from 'components/LegalNotice/LegalNoticeLink' import LegalNoticeLink from 'components/LegalNotice/LegalNoticeLink'
import GCULink from 'components/GCU/GCULink'
import Version from 'components/Version/Version' import Version from 'components/Version/Version'
import ProfileTypeOptions from './ProfileTypeOptions' import ProfileTypeOptions from './ProfileTypeOptions'
...@@ -29,6 +30,7 @@ const OptionsView: React.FC = () => { ...@@ -29,6 +30,7 @@ const OptionsView: React.FC = () => {
<ReportOptions /> <ReportOptions />
<FAQLink /> <FAQLink />
<LegalNoticeLink /> <LegalNoticeLink />
<GCULink />
<div className="parameters-logos"> <div className="parameters-logos">
<img src={logos} alt="ensemble de logos" /> <img src={logos} alt="ensemble de logos" />
</div> </div>
......
...@@ -20,6 +20,7 @@ const FAQView = lazy(() => import('components/FAQ/FAQView')) ...@@ -20,6 +20,7 @@ const FAQView = lazy(() => import('components/FAQ/FAQView'))
const LegalNoticeView = lazy(() => const LegalNoticeView = lazy(() =>
import('components/LegalNotice/LegalNoticeView') import('components/LegalNotice/LegalNoticeView')
) )
const GCUView = lazy(() => import('components/GCU/GCUView'))
const AnalysisView = lazy(() => import('components/Analysis/AnalysisView')) const AnalysisView = lazy(() => import('components/Analysis/AnalysisView'))
const ProfileTypeView = lazy(() => const ProfileTypeView = lazy(() =>
import('components/ProfileType/ProfileTypeView') import('components/ProfileType/ProfileTypeView')
...@@ -68,6 +69,7 @@ const Routes = () => { ...@@ -68,6 +69,7 @@ const Routes = () => {
<Route path="/ecogestures" component={EcogestureView} /> <Route path="/ecogestures" component={EcogestureView} />
<Route path={'/options/FAQ'} component={FAQView} /> <Route path={'/options/FAQ'} component={FAQView} />
<Route path={`/options/legalnotice`} component={LegalNoticeView} /> <Route path={`/options/legalnotice`} component={LegalNoticeView} />
<Route path={`/options/gcu`} component={GCUView} />
<Route path={'/options/:connectParam'} exact component={OptionsView} /> <Route path={'/options/:connectParam'} exact component={OptionsView} />
<Route path={'/options'} exact component={OptionsView} /> <Route path={'/options'} exact component={OptionsView} />
<Route path="/analysis" component={AnalysisView} /> <Route path="/analysis" component={AnalysisView} />
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
"title_profiletype": "Ajuster mon profil", "title_profiletype": "Ajuster mon profil",
"title_faq": "FAQ", "title_faq": "FAQ",
"title_legal_notice": "Mentions légales", "title_legal_notice": "Mentions légales",
"title_gcu": "CGU",
"accessibility": { "accessibility": {
"loading": "Chargement" "loading": "Chargement"
} }
...@@ -402,6 +403,10 @@ ...@@ -402,6 +403,10 @@
"button_accept": "Accepter les conditions générales d'utilisation" "button_accept": "Accepter les conditions générales d'utilisation"
} }
}, },
"gcu_option": {
"title": "Conditions générales d’utilisation",
"read_gcu": "Lire les CGU"
},
"header": { "header": {
"accessibility": { "accessibility": {
"button_back": "Retour à la page précédente", "button_back": "Retour à la page précédente",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment