From d95061fdad5ffc08e2e4b647f7f6dcc41e8bda32 Mon Sep 17 00:00:00 2001 From: Dennis Date: Thu, 25 Feb 2021 21:04:20 -0500 Subject: [PATCH 001/523] webpack eslint issues --- package-lock.json | 8 ++++++++ package.json | 1 + src/assests/i18n/i18n.ts | 5 +++-- webpack.common.js | 2 ++ webpack.dev.js | 21 ++++++++++++--------- webpack.prod.js | 1 + 6 files changed, 27 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index ca861aae..7b13c99f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7223,6 +7223,14 @@ "@babel/runtime": "^7.12.0" } }, + "i18next-http-backend": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/i18next-http-backend/-/i18next-http-backend-1.1.1.tgz", + "integrity": "sha512-li3Un71yBu1uCfgJrCg8DOEtljse1er0ja1pM/rFmWLihrD2RFqyrglOsYUHokvzZ53mJB2Mmu4DYgd8/t3R0A==", + "requires": { + "node-fetch": "2.6.1" + } + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", diff --git a/package.json b/package.json index 1342b653..239c0178 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,7 @@ "esri-leaflet": "2.5.1", "esri-leaflet-renderers": "2.0.6", "i18next": "19.8.4", + "i18next-http-backend": "^1.1.1", "immutable": "^4.0.0-rc.12", "leaflet": "1.7.1", "lodash.throttle": "^4.1.1", diff --git a/src/assests/i18n/i18n.ts b/src/assests/i18n/i18n.ts index 698cd204..abd7415f 100644 --- a/src/assests/i18n/i18n.ts +++ b/src/assests/i18n/i18n.ts @@ -1,12 +1,13 @@ +/* eslint-disable prettier/prettier */ import i18n from 'i18next'; import { initReactI18next } from 'react-i18next'; import en from '../../locales/en-CA/translation.json'; -import fr from '../../locales/fr-CA/translation.json'; +import fr from '../../locales/fr-CA/translation.json'; i18n.use(initReactI18next) // load translation using http -> see /public/locales (i.e. https://github.com/i18next/react-i18next/tree/master/example/react/public/locales) // learn more: https://github.com/i18next/i18next-http-backend - //.use(Backend) + // .use(Backend) // init i18next // for all options read: https://www.i18next.com/overview/configuration-options .init({ diff --git a/webpack.common.js b/webpack.common.js index 68df5b96..c17ffcfb 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -1,3 +1,4 @@ +/* eslint-disable prettier/prettier */ /* eslint-disable import/no-extraneous-dependencies */ /* eslint-disable @typescript-eslint/no-var-requires */ const webpack = require('webpack'); @@ -17,6 +18,7 @@ const config = { output: { path: path.resolve(__dirname, 'dist'), filename: 'gcpv-main.js', + publicPath: '/' }, resolve: { extensions: ['.mjs', '.ts', '.tsx', '.js', '.jsx', '.json', '.jpg'], diff --git a/webpack.dev.js b/webpack.dev.js index 51151025..97ce03d1 100644 --- a/webpack.dev.js +++ b/webpack.dev.js @@ -1,3 +1,4 @@ +/* eslint-disable prettier/prettier */ /* eslint-disable import/no-extraneous-dependencies */ /* eslint-disable @typescript-eslint/no-var-requires */ const path = require('path'); @@ -7,15 +8,17 @@ const common = require('./webpack.common.js'); const config = { mode: 'development', devServer: { - host: process.env.IP, - https: false, - disableHostCheck: true, - contentBase: path.resolve(__dirname, 'public'), - historyApiFallback: true, - //contentBase: './dist', - overlay: true, - hot: true, - port: 8080, + host: process.env.IP, + https: false, + disableHostCheck: true, + contentBase: path.resolve(__dirname, 'public'), + historyApiFallback: true, + // contentBase: './dist', + overlay: true, + hot: true, + port: 8080, + compress: true, + open: true, }, }; diff --git a/webpack.prod.js b/webpack.prod.js index 00741eef..18ef2101 100644 --- a/webpack.prod.js +++ b/webpack.prod.js @@ -1,3 +1,4 @@ +/* eslint-disable prettier/prettier */ /* eslint-disable import/no-extraneous-dependencies */ /* eslint-disable @typescript-eslint/no-var-requires */ const path = require('path'); From de835fb3de292f206f99de4982f153250de522c7 Mon Sep 17 00:00:00 2001 From: Dennis Date: Fri, 26 Feb 2021 12:40:55 -0500 Subject: [PATCH 002/523] themes parameter name --- src/components/search/keywordsearch.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/search/keywordsearch.tsx b/src/components/search/keywordsearch.tsx index 52d76071..83fc8f3b 100644 --- a/src/components/search/keywordsearch.tsx +++ b/src/components/search/keywordsearch.tsx @@ -80,7 +80,7 @@ const KeywordSearch: React.FunctionComponent = () => { max: cnt > 0 ? Math.min(pn * rpp, cnt) : pn * rpp, }; if (storethemefilters.length > 0) { - searchParams.theme = storethemefilters.map((fs: number) => themes[language][fs]).join(','); + searchParams.themes = storethemefilters.map((fs: number) => themes[language][fs]).join(','); } if (storeorgfilters.length > 0) { searchParams.org = storeorgfilters.map((fs: number) => organisations[language][fs]).join('|'); @@ -500,7 +500,7 @@ interface SearchParams { lang: string; min: number; max: number; - theme?: string; + themes?: string; org?: string; type?: string; foundational?: 'true'; From 37062b821f94504647931552a50f3435ac30109e Mon Sep 17 00:00:00 2001 From: Dennis Date: Mon, 1 Mar 2021 16:26:57 -0500 Subject: [PATCH 003/523] result page id --- src/components/search/geosearch.tsx | 12 +++++++----- src/components/search/metadatapage.jsx | 6 ++++-- webpack.dev.js | 5 ++++- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/components/search/geosearch.tsx b/src/components/search/geosearch.tsx index 0497f8b5..e1e6185c 100644 --- a/src/components/search/geosearch.tsx +++ b/src/components/search/geosearch.tsx @@ -10,8 +10,9 @@ /* eslint-disable no-nested-ternary */ /* eslint-disable react/jsx-filename-extension */ import React, { useState, createRef, useEffect, ChangeEvent } from "react"; -import {useLocation} from 'react-router'; -import { useDispatch, useSelector} from "react-redux"; +import { useLocation } from 'react-router'; +// import { Link } from "react-router-dom"; +import { useDispatch, useSelector } from "react-redux"; import { useMap } from 'react-leaflet'; import { useTranslation } from 'react-i18next'; import SearchIcon from '@material-ui/icons/Search'; @@ -98,6 +99,7 @@ const GeoSearch = (showing:boolean):JSX.Element => { const handleView = (evt:React.MouseEvent, id:string) => { evt.stopPropagation(); window.open(`/#/result?id=${encodeURI(id.trim())}&lang=${language}`, `View Record ${id.trim()}`); + // window.open(`/#/result/${encodeURI(id.trim())}?lang=${language}`, `View Record ${id.trim()}`); } const handleChange = (e: ChangeEvent) => { @@ -134,7 +136,7 @@ const GeoSearch = (showing:boolean):JSX.Element => { max: cnt>0?Math.min(pn*rpp, cnt):pn*rpp } if (themefilters.length > 0) { - searchParams.theme = themefilters.map((fs:number)=>themes[language][fs]).join(","); + searchParams.themes = themefilters.map((fs:number)=>themes[language][fs]).join(","); } if (orgfilters.length > 0) { searchParams.org = orgfilters.map((fs:number)=>organisations[language][fs]).join("|"); @@ -289,8 +291,8 @@ const GeoSearch = (showing:boolean):JSX.Element => {

{t("page.organisation")}: {result.organisation}

{t("page.published")}: {result.published}

{result.description.substr(0,240)} {result.description.length>240 ? ... : ""}

- + {/* */} ))} @@ -311,7 +313,7 @@ interface SearchParams { lang: string; min: number; max: number; - theme?: string; + themes?: string; org?: string; type?: string; foundational?: 'true'; diff --git a/src/components/search/metadatapage.jsx b/src/components/search/metadatapage.jsx index c5f98824..4df74209 100644 --- a/src/components/search/metadatapage.jsx +++ b/src/components/search/metadatapage.jsx @@ -12,6 +12,7 @@ /* eslint-disable react-hooks/exhaustive-deps */ import React, { useState, useEffect } from "react"; import {useLocation} from 'react-router'; +// import {useParams} from 'react-router-dom'; import { useDispatch, useSelector} from "react-redux"; import { useTranslation } from 'react-i18next'; import { MapContainer, TileLayer, GeoJSON } from 'react-leaflet'; @@ -35,9 +36,10 @@ const MetaDataPage = () => { const [loading, setLoading] = useState(true); const [results, setResults] = useState([]); const [openSection, setOpen] = useState([]); - const [rid, setID] = useState(queryParams && queryParams.id?queryParams.id.trim():""); + const rid = queryParams && queryParams.id?queryParams.id.trim():""; const language = t("app.language"); - + // const { rid } = useParams(); + const handleOpen = (section) => { const newOpen = openSection.map(o=>o); const hIndex = openSection.findIndex(os=>os===section); diff --git a/webpack.dev.js b/webpack.dev.js index 97ce03d1..d94b83ae 100644 --- a/webpack.dev.js +++ b/webpack.dev.js @@ -12,10 +12,13 @@ const config = { https: false, disableHostCheck: true, contentBase: path.resolve(__dirname, 'public'), - historyApiFallback: true, + historyApiFallback: { + index: '/' + }, // contentBase: './dist', overlay: true, hot: true, + inline: true, port: 8080, compress: true, open: true, From 60f2fa9e0834d88998228cdbf055c5c4152b2bb7 Mon Sep 17 00:00:00 2001 From: Dennis Date: Mon, 1 Mar 2021 16:58:27 -0500 Subject: [PATCH 004/523] header logo and nav links change --- src/components/header/header.tsx | 6 ++++-- src/locales/en-CA/translation.json | 1 + src/locales/fr-CA/translation.json | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/header/header.tsx b/src/components/header/header.tsx index f4d5c875..462d4861 100644 --- a/src/components/header/header.tsx +++ b/src/components/header/header.tsx @@ -1,4 +1,6 @@ /* eslint-disable prettier/prettier */ +/* eslint-disable react/jsx-no-target-blank */ +/* eslint-disable jsx-a11y/control-has-associated-label */ /* eslint-disable jsx-a11y/click-events-have-key-events */ /* eslint-disable jsx-a11y/no-noninteractive-element-interactions */ import React, { useState } from 'react'; @@ -35,12 +37,12 @@ export default function Header(): JSX.Element {
- +
diff --git a/src/locales/en-CA/translation.json b/src/locales/en-CA/translation.json index 0ba62b86..7a781657 100644 --- a/src/locales/en-CA/translation.json +++ b/src/locales/en-CA/translation.json @@ -4,6 +4,7 @@ }, "nav": { "home": "Home", + "search": "Search", "language": { "key": "fr-CA", "name": "Français" diff --git a/src/locales/fr-CA/translation.json b/src/locales/fr-CA/translation.json index 9439e917..ddc1f92c 100644 --- a/src/locales/fr-CA/translation.json +++ b/src/locales/fr-CA/translation.json @@ -4,6 +4,7 @@ }, "nav": { "home": "Accueil", + "search": "Chercher", "language": { "key": "en-CA", "name": "English" From aebf0fd0a6b7b3dfaeaa7ec7b61fbba0ea07c9c7 Mon Sep 17 00:00:00 2001 From: Dennis Date: Tue, 2 Mar 2021 10:14:55 -0500 Subject: [PATCH 005/523] merge jira 290 changes --- src/components/search/geosearch.tsx | 2 +- src/components/search/keywordsearch.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/search/geosearch.tsx b/src/components/search/geosearch.tsx index e1e6185c..61fd99ea 100644 --- a/src/components/search/geosearch.tsx +++ b/src/components/search/geosearch.tsx @@ -136,7 +136,7 @@ const GeoSearch = (showing:boolean):JSX.Element => { max: cnt>0?Math.min(pn*rpp, cnt):pn*rpp } if (themefilters.length > 0) { - searchParams.themes = themefilters.map((fs:number)=>themes[language][fs]).join(","); + searchParams.themes = themefilters.map((fs:number)=>themes[language][fs]).join("|"); } if (orgfilters.length > 0) { searchParams.org = orgfilters.map((fs:number)=>organisations[language][fs]).join("|"); diff --git a/src/components/search/keywordsearch.tsx b/src/components/search/keywordsearch.tsx index 83fc8f3b..60f4af58 100644 --- a/src/components/search/keywordsearch.tsx +++ b/src/components/search/keywordsearch.tsx @@ -80,7 +80,7 @@ const KeywordSearch: React.FunctionComponent = () => { max: cnt > 0 ? Math.min(pn * rpp, cnt) : pn * rpp, }; if (storethemefilters.length > 0) { - searchParams.themes = storethemefilters.map((fs: number) => themes[language][fs]).join(','); + searchParams.themes = storethemefilters.map((fs: number) => themes[language][fs]).join('|'); } if (storeorgfilters.length > 0) { searchParams.org = storeorgfilters.map((fs: number) => organisations[language][fs]).join('|'); From 8d4aea561fc0a3d1000ba1538ffdee85709760f1 Mon Sep 17 00:00:00 2001 From: "ken.chase" Date: Tue, 2 Mar 2021 12:03:05 -0500 Subject: [PATCH 006/523] Adding more accessible HTML and updated styling to pagination (this breaks react onClick events) --- src/components/pagination/pagination.scss | 74 ++++---------- src/components/pagination/pagination.tsx | 117 ++++++++++++++-------- 2 files changed, 97 insertions(+), 94 deletions(-) diff --git a/src/components/pagination/pagination.scss b/src/components/pagination/pagination.scss index 2b302f26..98375dc4 100644 --- a/src/components/pagination/pagination.scss +++ b/src/components/pagination/pagination.scss @@ -1,57 +1,27 @@ -.paginationContainer { - margin: 0 auto; - padding: 15px 5%; - .total { - text-align: center; +@import '../../assests/css/variables-site/variables-site'; + +.pagination-container { + margin-top: 1rem; + padding: 1rem 0; + .pagination-total { + color: $color__semi-dark; + font-weight: 300; + font-size: 1rem; } - .pages { - display: flex; - justify-content: center; - align-items: center; - .buttonContainer { - height: 1.2rem; - width: 1.2rem; - display: flex; - align-items: center; - justify-content: center; - margin: 0 2px; - cursor: pointer; - &.disabled { - opacity: 0.5; - cursor: default; + .pagination-list { + .list-item { + &.hover { + background-color: $color__bg-aside; + color: $color__bg-aside; } - >svg { - width:100%; - height: 100%; - margin: 0; - } - } - .pageList { - max-width: calc(100% - 5rem - 36px); - overflow: auto; - color: #000000; - font-family: 'Open Sans', sans-serif; - font-weight: 400; - font-size: 1em; - line-height: 22px; - margin: 0 10px; - display: flex; - align-items: center; - .pageListItem { - opacity: 0.5; - display: inline-block; - padding: 0 3px; - cursor: pointer; - &:hover { - opacity: 0.8; - font-weight: 700; - } - &.current { - font-weight: 700; - opacity: 1; - cursor: default; + &.current { + .page-link { + background-color: $color__bg-aside; } } + .page-link { + color: $color__semi-dark; + } } - } -} \ No newline at end of file + } +} diff --git a/src/components/pagination/pagination.tsx b/src/components/pagination/pagination.tsx index 8f073b50..de99ea29 100644 --- a/src/components/pagination/pagination.tsx +++ b/src/components/pagination/pagination.tsx @@ -9,52 +9,85 @@ import ArrowPre from '@material-ui/icons/ArrowLeft'; import ArrowFirst from '@material-ui/icons/ArrowBack'; import './pagination.scss'; -export default function Pagination(props:paginationProps): JSX.Element { +export default function Pagination(props: paginationProps): JSX.Element { const { t } = useTranslation(); - const {rpp, ppg, rcnt, current, selectPage} = props; - const pcnt = Math.ceil(rcnt/rpp); - const pgcnt = Math.ceil(pcnt/ppg); - const cgroup = Math.ceil(current/rpp); + const { rpp, ppg, rcnt, current, selectPage } = props; + const pcnt = Math.ceil(rcnt / rpp); + const pgcnt = Math.ceil(pcnt / ppg); + const cgroup = Math.ceil(current / rpp); const pagenumbers = []; // eslint-disable-next-line no-plusplus - for (let i=(cgroup-1)*ppg+1; i<=Math.min(cgroup*ppg, pcnt); i++) { + for (let i = (cgroup - 1) * ppg + 1; i <= Math.min(cgroup * ppg, pcnt); i++) { pagenumbers.push(i); } - const max = Math.min(current*rpp, rcnt); + const max = Math.min(current * rpp, rcnt); return ( -
-
{t("page.ctrl.total", { index: `${(current-1)*rpp+1} - ${max}`, total: rcnt })}
- {rcnt > rpp && -
- {pgcnt>1 && -
1?() => selectPage((cgroup-1)*rpp):undefined}> - -
- } -
1?() => selectPage(current-1):undefined}> - -
-
- {pagenumbers.map(pn=>( -
selectPage(pn):undefined} - > - {pn} -
- ))} -
-
selectPage(current+1):undefined}> - -
- {pgcnt>1 && -
selectPage(cgroup*rpp+1):undefined}> - -
- } -
} -
- ) +