From 2a6a9790c92bca49e5c912ad1079094b2259a25e Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 28 Feb 2024 14:53:38 +0100 Subject: [PATCH 1/7] Hide regulations from search --- next/components/pages/searchPageContentNew.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/next/components/pages/searchPageContentNew.tsx b/next/components/pages/searchPageContentNew.tsx index 7f0bf8db3..5475f7af3 100644 --- a/next/components/pages/searchPageContentNew.tsx +++ b/next/components/pages/searchPageContentNew.tsx @@ -68,11 +68,11 @@ const SearchPageContentNew = () => { displayName: t('SearchPage.contact'), displayNamePlural: t('SearchPage.contacts'), }, - { - id: 'regulations', - displayName: t('SearchPage.regulation'), - displayNamePlural: t('SearchPage.regulations'), - }, + // { + // id: 'regulations', + // displayName: t('SearchPage.regulation'), + // displayNamePlural: t('SearchPage.regulations'), + // }, // { // id: 'officialBoard', // displayName: t('SearchPage.document'), From 493d1c110645f6e6140213fcf1f19aa707f72278 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 29 Feb 2024 13:52:01 +0100 Subject: [PATCH 2/7] Add aria-label to RegulationCard --- .../molecules/Regulations/RegulationCard.tsx | 10 +++++++++- next/messages/en.json | 3 +++ next/messages/sk.json | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/next/components/molecules/Regulations/RegulationCard.tsx b/next/components/molecules/Regulations/RegulationCard.tsx index 40557872e..9919fe420 100644 --- a/next/components/molecules/Regulations/RegulationCard.tsx +++ b/next/components/molecules/Regulations/RegulationCard.tsx @@ -9,6 +9,7 @@ export type RegulationCardProps = { title: string path?: string className?: string + ariaLabel?: string isUplneZnenie?: boolean | null | undefined } @@ -17,7 +18,13 @@ export type RegulationCardProps = { * Figma for FileCard: https://www.figma.com/file/17wbd0MDQcMW9NbXl6UPs8/DS-ESBS%2BBK%3A-Component-library?type=design&node-id=7367-17767&t=Km8W7qXXiWIDWSYw-0 */ -const RegulationCard = ({ title, path, className, isUplneZnenie }: RegulationCardProps) => { +const RegulationCard = ({ + title, + path, + className, + isUplneZnenie, + ariaLabel, +}: RegulationCardProps) => { const t = useTranslations() return ( @@ -35,6 +42,7 @@ const RegulationCard = ({ title, path, className, isUplneZnenie }: RegulationCar variant="underlineOnHover" target="_blank" rel="noreferrer" + aria-label={ariaLabel ?? t('Regulation.aria.linkToRegulationAriaLabel', { title })} > {title} diff --git a/next/messages/en.json b/next/messages/en.json index cd696e197..e5a1570fc 100644 --- a/next/messages/en.json +++ b/next/messages/en.json @@ -306,6 +306,9 @@ "socialnaPomocASkolstvo": "Social services and Education", "ostatne": "Other", "archiv": "Archive" + }, + "aria": { + "linkToRegulationAriaLabel": "Go to regulation {title}" } } } diff --git a/next/messages/sk.json b/next/messages/sk.json index 62c9f8385..1ba1afc1d 100644 --- a/next/messages/sk.json +++ b/next/messages/sk.json @@ -306,6 +306,9 @@ "socialnaPomocASkolstvo": "Sociálna pomoc a školstvo", "ostatne": "Ostatné", "archiv": "Archív" + }, + "aria": { + "linkToRegulationAriaLabel": "Prejsť na {title}" } } } From fec935bb64453d1f92481ded9e8b7bef6611e506 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 29 Feb 2024 14:00:44 +0100 Subject: [PATCH 3/7] Remove unneeded comments --- next/components/molecules/Regulations/Regulations.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/next/components/molecules/Regulations/Regulations.tsx b/next/components/molecules/Regulations/Regulations.tsx index c65abf420..7f759b355 100644 --- a/next/components/molecules/Regulations/Regulations.tsx +++ b/next/components/molecules/Regulations/Regulations.tsx @@ -21,7 +21,6 @@ const Regulations = ({ className, regulations }: Props) => { {regulations?.map((regulation) => { return (
- {/* TODO: consider adding english translation GBR instead of VZN */} {
( - // TODO: consider adding english translation GBR instead of VZN Date: Thu, 29 Feb 2024 14:53:15 +0100 Subject: [PATCH 4/7] Style: display mainDocument and Attachments as rows in RegulationPageContent --- .../pages/RegulationPageContent.tsx | 54 ++++++++++--------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/next/components/pages/RegulationPageContent.tsx b/next/components/pages/RegulationPageContent.tsx index e67af3667..bc0584d02 100644 --- a/next/components/pages/RegulationPageContent.tsx +++ b/next/components/pages/RegulationPageContent.tsx @@ -1,6 +1,5 @@ import { Enum_Componentsectionsfilelist_Variant, - FileItemBlockFragment, RegulationEntityFragment, } from '@backend/graphql' import { Typography } from '@bratislava/component-library' @@ -8,7 +7,6 @@ import FileList from '@bratislava/ui-bratislava/FileList/FileList' import PageHeader from '@bratislava/ui-bratislava/PageHeader/PageHeader' import SectionContainer from '@bratislava/ui-bratislava/SectionContainer/SectionContainer' import MLink from '@components/forms/simple-components/MLink' -import FileCard from '@components/molecules/presentation/FileCard' import RegulationCard from '@components/molecules/Regulations/RegulationCard' import RegulationDetailMessage from '@components/molecules/Regulations/RegulationDetailMessage' import { isDefined } from '@utils/isDefined' @@ -25,8 +23,8 @@ const RegulationPageContent = ({ regulation }: RegulationPageContentProps) => { const t = useTranslations('Regulation') const locale = useLocale() - const mainDocument = regulation.attributes?.mainDocument?.data?.attributes - const consolidatedDocument = regulation.attributes?.consolidatedText?.data?.attributes + const mainDocument = regulation.attributes?.mainDocument + const consolidatedDocument = regulation.attributes?.consolidatedText const amendments = regulation.attributes?.amendments?.data .filter((amendment) => isDefined(amendment)) .sort((a, b) => { @@ -35,7 +33,7 @@ const RegulationPageContent = ({ regulation }: RegulationPageContentProps) => { const amending = regulation.attributes?.amending?.data.filter(isDefined) const cancelling = regulation.attributes?.cancelling?.data.filter(isDefined) - const attachmentFiles: FileItemBlockFragment[] = + const attachmentFiles = regulation.attributes?.attachments?.data.map((attachment) => { return { title: attachment.attributes?.name ?? 'Príloha', @@ -43,6 +41,12 @@ const RegulationPageContent = ({ regulation }: RegulationPageContentProps) => { } }) ?? [] + if (consolidatedDocument?.data) + attachmentFiles.unshift({ + title: `${t('consolidatedText')} - ${consolidatedDocument.data.attributes?.name}`, + media: { data: consolidatedDocument?.data }, + }) + const breadcrumbs = [ { title: t('regulations'), @@ -66,31 +70,32 @@ const RegulationPageContent = ({ regulation }: RegulationPageContentProps) => {
-
+
{t('mainDocument')} {mainDocument ? ( - - ) : null} -
-
- - {t('consolidatedText')} - - {consolidatedDocument ? ( - ) : ( - {t('noConsolidatedTextMessage')} + {t('noAttachmentsMessage')} )}
-
+
{t('attachments')} @@ -106,16 +111,17 @@ const RegulationPageContent = ({ regulation }: RegulationPageContentProps) => { )}
-
+
{t('amendments')} {amendments?.length ? ( -
+
{amendments?.map((amendment) => { return ( Date: Thu, 29 Feb 2024 15:17:51 +0100 Subject: [PATCH 5/7] Show message if fulltextregulation in RegulationCard --- next/components/molecules/Regulations/Regulations.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/next/components/molecules/Regulations/Regulations.tsx b/next/components/molecules/Regulations/Regulations.tsx index 7f759b355..b74951a69 100644 --- a/next/components/molecules/Regulations/Regulations.tsx +++ b/next/components/molecules/Regulations/Regulations.tsx @@ -24,7 +24,7 @@ const Regulations = ({ className, regulations }: Props) => {
@@ -37,7 +37,7 @@ const Regulations = ({ className, regulations }: Props) => { ))} From a8bcd075edb8ceda122a88004cbb88edcc7af2a8 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 29 Feb 2024 15:18:16 +0100 Subject: [PATCH 6/7] Style: make headings bigger in RegulationPage --- next/components/pages/RegulationPageContent.tsx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/next/components/pages/RegulationPageContent.tsx b/next/components/pages/RegulationPageContent.tsx index bc0584d02..f242867e7 100644 --- a/next/components/pages/RegulationPageContent.tsx +++ b/next/components/pages/RegulationPageContent.tsx @@ -1,7 +1,4 @@ -import { - Enum_Componentsectionsfilelist_Variant, - RegulationEntityFragment, -} from '@backend/graphql' +import { Enum_Componentsectionsfilelist_Variant, RegulationEntityFragment } from '@backend/graphql' import { Typography } from '@bratislava/component-library' import FileList from '@bratislava/ui-bratislava/FileList/FileList' import PageHeader from '@bratislava/ui-bratislava/PageHeader/PageHeader' @@ -71,7 +68,7 @@ const RegulationPageContent = ({ regulation }: RegulationPageContentProps) => {
- + {t('mainDocument')} {mainDocument ? ( @@ -96,7 +93,7 @@ const RegulationPageContent = ({ regulation }: RegulationPageContentProps) => { )}
- + {t('attachments')} {attachmentFiles?.length ? ( @@ -112,7 +109,7 @@ const RegulationPageContent = ({ regulation }: RegulationPageContentProps) => {
- + {t('amendments')} {amendments?.length ? ( From e678df26bdb72ed29c5ca6108f257035e6126a83 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 29 Feb 2024 15:20:11 +0100 Subject: [PATCH 7/7] Fix homepage search - use actual input instead of debounced --- next/components/molecules/HomePageSearch.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/next/components/molecules/HomePageSearch.tsx b/next/components/molecules/HomePageSearch.tsx index 42bed716a..712a879dd 100644 --- a/next/components/molecules/HomePageSearch.tsx +++ b/next/components/molecules/HomePageSearch.tsx @@ -52,8 +52,8 @@ const HomePageSearch = ({ isOpen, setOpen }: HomePageSearchProps) => { const handleSearchPressed = useCallback(() => { // eslint-disable-next-line @typescript-eslint/no-floating-promises - router.push(`${t('searchLink')}?keyword=${searchValue}`) - }, [router, searchValue, t]) + router.push(`${t('searchLink')}?keyword=${input}`) + }, [router, input, t]) return (