From 89f95370bc662f2a5e830c79884762deb2cb73b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Arnar=20=C3=86gisson?= Date: Tue, 18 Jun 2024 10:30:34 +0000 Subject: [PATCH] feat(consultation-portal): KAM-2522: PowerBI report added (#15251) --- .../components/Layout/Layout.json | 4 ++ .../Menu/components/MenuItems/MenuItems.ts | 10 ++-- .../components/PowerBI/PowerBI.tsx | 31 +++++++++++++ .../components/PowerBI/index.ts | 5 ++ apps/consultation-portal/pages/tolfraedi.tsx | 23 ---------- .../pages/tolfraedi/index.tsx | 5 ++ .../pages/user/link-expired/index.tsx | 7 +++ .../pages/user/not-found/index.tsx | 7 +++ .../screens/EmailVerified/EmailVerified.json | 20 ++++++++ .../screens/EmailVerified/LinkExpired.tsx | 46 +++++++++++++++++++ .../screens/EmailVerified/NotFound.tsx | 46 +++++++++++++++++++ .../screens/Statistics/Statistics.json | 19 ++++++++ .../screens/Statistics/Statistics.tsx | 32 +++++++++++++ 13 files changed, 227 insertions(+), 28 deletions(-) create mode 100644 apps/consultation-portal/components/PowerBI/PowerBI.tsx create mode 100644 apps/consultation-portal/components/PowerBI/index.ts delete mode 100644 apps/consultation-portal/pages/tolfraedi.tsx create mode 100644 apps/consultation-portal/pages/tolfraedi/index.tsx create mode 100644 apps/consultation-portal/pages/user/link-expired/index.tsx create mode 100644 apps/consultation-portal/pages/user/not-found/index.tsx create mode 100644 apps/consultation-portal/screens/EmailVerified/LinkExpired.tsx create mode 100644 apps/consultation-portal/screens/EmailVerified/NotFound.tsx create mode 100644 apps/consultation-portal/screens/Statistics/Statistics.json create mode 100644 apps/consultation-portal/screens/Statistics/Statistics.tsx diff --git a/apps/consultation-portal/components/Layout/Layout.json b/apps/consultation-portal/components/Layout/Layout.json index b49cfe4a6045..963248ac7337 100644 --- a/apps/consultation-portal/components/Layout/Layout.json +++ b/apps/consultation-portal/components/Layout/Layout.json @@ -16,6 +16,10 @@ "label": "Áskriftir", "href": "/askriftir" }, + { + "label": "Tölfræði", + "href": "/tolfraedi" + }, { "label": "Mínar umsagnir", "href": "/umsagnir" diff --git a/apps/consultation-portal/components/Layout/components/Menu/components/MenuItems/MenuItems.ts b/apps/consultation-portal/components/Layout/components/Menu/components/MenuItems/MenuItems.ts index 9b2b6c77bcfc..04db232a20fb 100644 --- a/apps/consultation-portal/components/Layout/components/Menu/components/MenuItems/MenuItems.ts +++ b/apps/consultation-portal/components/Layout/components/Menu/components/MenuItems/MenuItems.ts @@ -13,14 +13,14 @@ export const menuItems = [ href: loc[1].href, testId: 'subscriptions-btn', }, - // Tölfræði is hidden until PowerBI - // { - // label: 'Tölfræði', - // href: '/tolfraedi', - // }, { label: loc[2].label, href: loc[2].href, + testId: 'statistics-btn', + }, + { + label: loc[3].label, + href: loc[3].href, testId: 'advices-btn', }, ] diff --git a/apps/consultation-portal/components/PowerBI/PowerBI.tsx b/apps/consultation-portal/components/PowerBI/PowerBI.tsx new file mode 100644 index 000000000000..7abb922eada5 --- /dev/null +++ b/apps/consultation-portal/components/PowerBI/PowerBI.tsx @@ -0,0 +1,31 @@ +import { useRef } from 'react' +import { PowerBIEmbed } from 'powerbi-client-react' +import { type Embed, models } from 'powerbi-client' + +export const PowerBI = () => { + const embedRef = useRef(null) + + const getEmbeddedComponent = (embed: Embed) => { + embed.element.style.height = '700px' + embed.element.style.width = '100%' + embed.iframe.style.border = 'none' + embedRef.current = embed + } + + return ( + + ) +} + +export default PowerBI diff --git a/apps/consultation-portal/components/PowerBI/index.ts b/apps/consultation-portal/components/PowerBI/index.ts new file mode 100644 index 000000000000..a8748281fdc6 --- /dev/null +++ b/apps/consultation-portal/components/PowerBI/index.ts @@ -0,0 +1,5 @@ +import dynamic from 'next/dynamic' + +export const PowerBIComponent = dynamic(() => import('./PowerBI'), { + ssr: false, +}) diff --git a/apps/consultation-portal/pages/tolfraedi.tsx b/apps/consultation-portal/pages/tolfraedi.tsx deleted file mode 100644 index 9bb43ab068c4..000000000000 --- a/apps/consultation-portal/pages/tolfraedi.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { Layout } from '../components' -import { Box, GridColumn, GridRow } from '@island.is/island-ui/core' -const Statistics = () => { - return ( - - - - - {/* */} - - - - - ) -} - -export default Statistics diff --git a/apps/consultation-portal/pages/tolfraedi/index.tsx b/apps/consultation-portal/pages/tolfraedi/index.tsx new file mode 100644 index 000000000000..1ec2bae64598 --- /dev/null +++ b/apps/consultation-portal/pages/tolfraedi/index.tsx @@ -0,0 +1,5 @@ +import { StatisticsScreen } from '../../screens/Statistics/Statistics' + +export const Index = () => + +export default Index diff --git a/apps/consultation-portal/pages/user/link-expired/index.tsx b/apps/consultation-portal/pages/user/link-expired/index.tsx new file mode 100644 index 000000000000..43b9a6aeba0d --- /dev/null +++ b/apps/consultation-portal/pages/user/link-expired/index.tsx @@ -0,0 +1,7 @@ +import LinkExpiredScreen from '../../../screens/EmailVerified/LinkExpired' + +export const Index = () => { + return +} + +export default Index diff --git a/apps/consultation-portal/pages/user/not-found/index.tsx b/apps/consultation-portal/pages/user/not-found/index.tsx new file mode 100644 index 000000000000..e8fb87a89a4a --- /dev/null +++ b/apps/consultation-portal/pages/user/not-found/index.tsx @@ -0,0 +1,7 @@ +import NotFoundScreen from '../../../screens/EmailVerified/NotFound' + +export const Index = () => { + return +} + +export default Index diff --git a/apps/consultation-portal/screens/EmailVerified/EmailVerified.json b/apps/consultation-portal/screens/EmailVerified/EmailVerified.json index bec3b37792d6..d1525f11c973 100644 --- a/apps/consultation-portal/screens/EmailVerified/EmailVerified.json +++ b/apps/consultation-portal/screens/EmailVerified/EmailVerified.json @@ -8,5 +8,25 @@ "emailVerifiedText": "Netfang staðfest", "text": "Nú geturðu skráð þig í áskrift að málum, hægt er að velja um nokkrar leiðir.", "arrowLinkText": "Aftur á forsíðu" + }, + "linkExpired": { + "seo": { + "title": "Hlekkur útrunninn", + "url": "/user/link-expired" + }, + "failText": "Aðgerð tókst ekki", + "linkExpiredText": "Hlekkur útrunninn", + "text": "Hlekkur er útrunninn, vinsamlegast athugaðu að hlekkur sé ekki eldri en 24 klukkustundir. Vinsamlegast sláðu inn netfang aftur og fáðu nýjan hlekk.", + "arrowLinkText": "Aftur á forsíðu" + }, + "notFound": { + "seo": { + "title": "Eitthvað fór úrskeiðis", + "url": "/user/not-found" + }, + "failText": "Aðgerð tókst ekki", + "notFoundText": "Eitthvað fór úrskeiðis", + "text": "Reyndu aftur eða hafðu samband.", + "arrowLinkText": "Aftur á forsíðu" } } diff --git a/apps/consultation-portal/screens/EmailVerified/LinkExpired.tsx b/apps/consultation-portal/screens/EmailVerified/LinkExpired.tsx new file mode 100644 index 000000000000..f1033d5ee92d --- /dev/null +++ b/apps/consultation-portal/screens/EmailVerified/LinkExpired.tsx @@ -0,0 +1,46 @@ +import { + ArrowLink, + Box, + GridColumn, + GridContainer, + GridRow, + Text, +} from '@island.is/island-ui/core' +import { Layout } from '../../components' +import localization from './EmailVerified.json' + +export const LinkExpiredScreen = () => { + const loc = localization['linkExpired'] + return ( + + + + + + + {loc.failText} + + + + {loc.linkExpiredText} + + {loc.text} + {loc.arrowLinkText} + + + + + + ) +} +export default LinkExpiredScreen diff --git a/apps/consultation-portal/screens/EmailVerified/NotFound.tsx b/apps/consultation-portal/screens/EmailVerified/NotFound.tsx new file mode 100644 index 000000000000..64682a2edb1b --- /dev/null +++ b/apps/consultation-portal/screens/EmailVerified/NotFound.tsx @@ -0,0 +1,46 @@ +import { + ArrowLink, + Box, + GridColumn, + GridContainer, + GridRow, + Text, +} from '@island.is/island-ui/core' +import { Layout } from '../../components' +import localization from './EmailVerified.json' + +export const NotFoundScreen = () => { + const loc = localization['notFound'] + return ( + + + + + + + {loc.failText} + + + + {loc.notFoundText} + + {loc.text} + {loc.arrowLinkText} + + + + + + ) +} +export default NotFoundScreen diff --git a/apps/consultation-portal/screens/Statistics/Statistics.json b/apps/consultation-portal/screens/Statistics/Statistics.json new file mode 100644 index 000000000000..d94712e8309b --- /dev/null +++ b/apps/consultation-portal/screens/Statistics/Statistics.json @@ -0,0 +1,19 @@ +{ + "statistics": { + "seo": { + "title": "Tölfræði", + "url": "/tolfraedi", + "description": "Tölfræði um samráðsgátt", + "keywords": "" + }, + "breadcrumbs": [ + { + "title": "Samráðsgátt", + "href": "/samradsgatt" + }, + { + "title": "Tölfræði" + } + ] + } +} diff --git a/apps/consultation-portal/screens/Statistics/Statistics.tsx b/apps/consultation-portal/screens/Statistics/Statistics.tsx new file mode 100644 index 000000000000..7d8468d9c4bc --- /dev/null +++ b/apps/consultation-portal/screens/Statistics/Statistics.tsx @@ -0,0 +1,32 @@ +import { GridContainer } from '@island.is/island-ui/core' + +import { Breadcrumbs, Layout } from '../../components' +import localization from './Statistics.json' +import { PowerBIComponent } from '../../components/PowerBI' + +export const StatisticsScreen = () => { + const loc = localization['statistics'] + + return ( + + + + + + + ) +} + +export default StatisticsScreen