Skip to content

Commit

Permalink
Merge pull request #509 from diggsweden/release-5.0.7-new
Browse files Browse the repository at this point in the history
Release 5.0.7 new
  • Loading branch information
MickeA authored Nov 21, 2024
2 parents 7db9e8a + 7d4fbfd commit d8cab1b
Show file tree
Hide file tree
Showing 13 changed files with 1,616 additions and 1,333 deletions.
10 changes: 9 additions & 1 deletion .env.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ HTTP_PROXY_PASS=secretpass
# Screen9 token for video player.
REACT_APP_SCREEN9_API_TOKEN=secret

## Connect to a local backend.
## Develop with local backend.
## Connect to localhost backend.
#APOLLO_URL=http://localhost:1301
#REACT_APP_APOLLO_URL=http://localhost:1301
#IMAGE_DOMAIN=localhost
Expand All @@ -26,6 +27,13 @@ REACT_APP_SCREEN9_API_TOKEN=secret
#IMAGE_DOMAIN=127.0.0.1
#REACT_APP_MEDIA_BASE_URL=http://127.0.0.1:1337

## Develop without a local backend.
## Connect to dev1 backend (beta.dataportal.dev1.se).
# APOLLO_URL=https://dev.beta.graphql.dataportal.dev1.se/
# REACT_APP_APOLLO_URL=https://dev.beta.graphql.dataportal.dev1.se/
# IMAGE_DOMAIN=dev.beta.graphql.dataportal.dev1.se
# REACT_APP_MEDIA_BASE_URL=https://dev.beta.strapi.dataportal.dev1.se

## Connect to production backend (beta.dataportal.se).
APOLLO_URL=https://graphql.digg.se/
REACT_APP_APOLLO_URL=https://graphql.digg.se/
Expand Down
18 changes: 11 additions & 7 deletions components/content/Search/SearchFilters/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export const SearchFilters: React.FC<SearchFilterProps> = ({
aria-selected={selected(key, facetValue)}
>
<button
className={`focus--in group relative flex w-full items-center break-all py-md pl-md pr-[3rem] text-left hover:bg-brown-100 ${
className={`focus--in group relative flex w-full items-center break-words py-md pl-md pr-[3rem] text-left hover:bg-brown-100 ${
selected(key, facetValue) && "font-strong"
}`}
onClick={() => {
Expand Down Expand Up @@ -361,9 +361,11 @@ export const SearchFilters: React.FC<SearchFilterProps> = ({
name="API"
type="checkbox"
className="peer/hvd-only sr-only"
checked={search.request.facetValues?.some(
(t) => t.title == ESRdfType.hvd,
)}
checked={
search.request.facetValues?.some(
(t) => t.title == ESRdfType.hvd,
) || false
}
onChange={() => doSearch(key, facetValues[0])}
/>
<label
Expand Down Expand Up @@ -396,9 +398,11 @@ export const SearchFilters: React.FC<SearchFilterProps> = ({
name="National"
type="checkbox"
className="peer/national-only sr-only"
checked={search.request.facetValues?.some(
(t) => t.facet == ESRdfType.national_data,
)}
checked={
search.request.facetValues?.some(
(t) => t.facet == ESRdfType.national_data,
) || false
}
onChange={() => doSearch(key, facetValues[0])}
/>
<label
Expand Down
155 changes: 77 additions & 78 deletions components/content/Search/SearchPage/SearchPageEntryScape/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import SearchProvider, {
import { decode } from "qss";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import { useScript } from "@/hooks/useScript";
import Head from "next/head";
import { Container } from "@/components/layout/Container";
import { ESRdfType, ESType } from "@/utilities/entryScape";
Expand All @@ -33,11 +32,6 @@ export const SearchPageEntryScape: FC<SearchProps> = ({ searchType }) => {
const [query, setQuery] = useState("");
const [showFilter, setShowFilter] = useState(false);
const [showTip, setShowTip] = useState(false);
const postscribeStatus = useScript(
"/postscribe.min.js",
"sha384-1nPAWyZS0cvGLWSoWOrkTZAy8Xq8g6llEe985qo5NRPAeDi+F9h9U+0R8v56XWCM",
"anonymous",
);

const clearCurrentScrollPos = () => {
if (typeof localStorage != "undefined") {
Expand Down Expand Up @@ -140,12 +134,16 @@ export const SearchPageEntryScape: FC<SearchProps> = ({ searchType }) => {
},
{
resource: "http://purl.org/dc/terms/type",
dcatProperty: "dcterms:type",
dcatId: "adms:publishertype",
type: ESType.uri,
related: true,
dcatType: "choice",
indexOrder: 1,
},
{
resource: "http://purl.org/dc/terms/publisher",
dcatProperty: "dcterms:publisher",
type: ESType.uri,
indexOrder: 2,
},
Expand All @@ -159,6 +157,7 @@ export const SearchPageEntryScape: FC<SearchProps> = ({ searchType }) => {
},
{
resource: "http://purl.org/dc/terms/accrualPeriodicity",
dcatId: "dcat:dcterms:accrualPeriodicity_da",
type: ESType.uri,
dcatProperty: "dcterms:accrualPeriodicity",
dcatType: "choice",
Expand Down Expand Up @@ -232,6 +231,7 @@ export const SearchPageEntryScape: FC<SearchProps> = ({ searchType }) => {
},
{
resource: "http://purl.org/dc/terms/publisher",
dcatProperty: "dcterms:publisher",
type: ESType.uri,
indexOrder: 1,
},
Expand Down Expand Up @@ -260,6 +260,7 @@ export const SearchPageEntryScape: FC<SearchProps> = ({ searchType }) => {
{
resource: "http://www.w3.org/2004/02/skos/core#inScheme",
type: ESType.uri,
dcatProperty: "dcterms:type",
indexOrder: 0,
},
],
Expand All @@ -286,83 +287,81 @@ export const SearchPageEntryScape: FC<SearchProps> = ({ searchType }) => {
/>
</Head>

{postscribeStatus === "ready" && (
<SearchProvider
entryscapeUrl={
searchProviderSettings[
searchType as keyof typeof searchProviderSettings
].entryscapeUrl
}
hitSpecifications={
searchProviderSettings[
searchType as keyof typeof searchProviderSettings
].hitSpecifications
}
facetSpecification={
searchProviderSettings[
searchType as keyof typeof searchProviderSettings
].facetSpecification
}
initRequest={
searchProviderSettings[
searchType as keyof typeof searchProviderSettings
].initRequest
}
>
<SearchContext.Consumer>
{(search) => (
<Container>
<div className="flex max-w-md items-end justify-between">
<Heading level={1} size="lg" className="mb-none">
{pageTitle}
</Heading>
<SearchProvider
entryscapeUrl={
searchProviderSettings[
searchType as keyof typeof searchProviderSettings
].entryscapeUrl
}
hitSpecifications={
searchProviderSettings[
searchType as keyof typeof searchProviderSettings
].hitSpecifications
}
facetSpecification={
searchProviderSettings[
searchType as keyof typeof searchProviderSettings
].facetSpecification
}
initRequest={
searchProviderSettings[
searchType as keyof typeof searchProviderSettings
].initRequest
}
>
<SearchContext.Consumer>
{(search) => (
<Container>
<div className="flex max-w-md items-end justify-between">
<Heading level={1} size="lg" className="mb-none">
{pageTitle}
</Heading>

{searchType === "datasets" && (
<Button
aria-expanded={showTip}
variant="plain"
size="sm"
icon={ChevronDownIcon}
iconPosition="right"
className={showTip ? "active" : " "}
onClick={() => {
clearCurrentScrollPos();
setShowTip(!showTip);
}}
label={t("pages|search$search-tips")}
/>
)}
</div>
{searchType === "datasets" && (
<Button
aria-expanded={showTip}
variant="plain"
size="sm"
icon={ChevronDownIcon}
iconPosition="right"
className={showTip ? "active" : " "}
onClick={() => {
clearCurrentScrollPos();
setShowTip(!showTip);
}}
label={t("pages|search$search-tips")}
/>
)}
</div>

{searchType === "datasets" && <SearchTips showTip={showTip} />}
{searchType === "datasets" && <SearchTips showTip={showTip} />}

<SearchForm
search={search}
searchMode={searchType}
query={query}
setQuery={setQuery}
/>
<SearchForm
search={search}
searchMode={searchType}
query={query}
setQuery={setQuery}
/>

<SearchPageSelector query={query} />
<SearchPageSelector query={query} />

<SearchFilters
showFilter={showFilter}
searchMode={searchType}
search={search}
query={query}
setShowFilter={setShowFilter}
/>
<noscript>{t("common|no-js-text")}</noscript>
<SearchResults
showSorting={showFilter}
search={search}
searchMode="datasets"
/>
</Container>
)}
</SearchContext.Consumer>
</SearchProvider>
)}
<SearchFilters
showFilter={showFilter}
searchMode={searchType}
search={search}
query={query}
setShowFilter={setShowFilter}
/>
<noscript>{t("common|no-js-text")}</noscript>
<SearchResults
showSorting={showFilter}
search={search}
searchMode="datasets"
/>
</Container>
)}
</SearchContext.Consumer>
</SearchProvider>
</div>
);
};
17 changes: 5 additions & 12 deletions components/content/Search/SearchResults/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -292,21 +292,14 @@ export const SearchResults: FC<SearchResultsProps> = ({
{hit.metadata &&
search.allFacets &&
!search.loadingFacets &&
hit.metadata["inScheme_resource"] &&
search.getFacetValueTitle(
"http://www.w3.org/2004/02/skos/core#inScheme",
hit.metadata["inScheme_resource"][0],
) && (
<span>
{search.getFacetValueTitle(
"http://www.w3.org/2004/02/skos/core#inScheme",
hit.metadata["inScheme_resource"][0],
)}
</span>
hit.metadata["inScheme_resource"] && (
<span>{hit.metadata["inScheme_resource"]}</span>
)}

{isCompact && hit.descriptionLang && (
<p className="mb-xs break-words">{hit.description}</p>
<p className="mb-xs line-clamp-4 break-words md:line-clamp-2">
{hit.description}
</p>
)}

<div
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@alfalab/winston3-logstash-transport": "^1.3.0",
"@apollo/client": "^3.6.9",
"@beam-australia/react-env": "^3.1.1",
"@entryscape/entrystore-js": "^4.14.3",
"@types/node-fetch": "^2.6.2",
"@types/swagger-ui-react": "^4.11.0",
"class-variance-authority": "^0.7.0",
Expand Down
Loading

0 comments on commit d8cab1b

Please sign in to comment.