diff --git a/Jenkinsfile b/Jenkinsfile index 74be6bbf7..d8da01a1b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,7 +10,7 @@ pipeline { githubPush() } environment { - IMAGE_NAME = "bibliotekdk-next-frontend-${env.BRANCH_NAME.toLowerCase()}:${BUILD_NUMBER}" + IMAGE_NAME = "bibliotekdk-next-frontend-studiesog-${env.BRANCH_NAME.toLowerCase()}:${BUILD_NUMBER}" DOCKER_COMPOSE_NAME = "compose-${IMAGE_NAME}-${BRANCH_NAME.toLowerCase()}" GITLAB_PRIVATE_TOKEN = credentials("metascrum-gitlab-api-token") GITLAB_ID = "704" @@ -52,9 +52,6 @@ pipeline { when { anyOf { branch 'main'; - branch 'alfa-0' - branch 'prod' - expression{env.BRANCH_NAME.startsWith('feature')} } } steps { @@ -80,8 +77,6 @@ pipeline { when { anyOf { branch 'main'; - branch 'alfa-0' - branch 'prod' } } steps { @@ -90,20 +85,10 @@ pipeline { if (env.BRANCH_NAME == 'main') { sh ''' #!/usr/bin/env bash - set-new-version configuration.yaml ${GITLAB_PRIVATE_TOKEN} ${GITLAB_ID} ${BUILD_NUMBER} -b staging + set-new-version configuration.yaml ${GITLAB_PRIVATE_TOKEN} ${GITLAB_ID} ${BUILD_NUMBER} -b studiesoeg-staging ''' - } else if (env.BRANCH_NAME == 'alfa-0') { - sh ''' - #!/usr/bin/env bash - set-new-version configuration.yaml ${GITLAB_PRIVATE_TOKEN} ${GITLAB_ID} ${BUILD_NUMBER} -b alfa-0 - ''' - } - else if (env.BRANCH_NAME == 'prod') { - sh ''' - #!/usr/bin/env bash - set-new-version configuration.yaml ${GITLAB_PRIVATE_TOKEN} ${GITLAB_ID} ${BUILD_NUMBER} -b prod - ''' - } + } + } } } diff --git a/cypress/e2e/bookmarkDropdown.cy.js b/cypress/e2e/bookmarkDropdown.cy.js index 7addc620c..3167e62a0 100644 --- a/cypress/e2e/bookmarkDropdown.cy.js +++ b/cypress/e2e/bookmarkDropdown.cy.js @@ -1,5 +1,5 @@ describe("Dropdown", () => { - it(`Bookmark is shown`, () => { + it.skip(`Bookmark is shown`, () => { cy.visit("/iframe.html?id=work-overview-bookmark--bookmark-with-dropdown"); // test toggle diff --git a/cypress/e2e/bookmarkpage.cy.js b/cypress/e2e/bookmarkpage.cy.js index cc8e4c1a6..1218faa86 100644 --- a/cypress/e2e/bookmarkpage.cy.js +++ b/cypress/e2e/bookmarkpage.cy.js @@ -1,5 +1,5 @@ describe("Bookmark page", () => { - it(`test book marks`, () => { + it.skip(`test book marks`, () => { cy.visit("/iframe.html?id=profile-bookmarks--bookmark-list"); cy.get("article").should("exist").should("have.length", 2); diff --git a/cypress/e2e/linkme.cy.js b/cypress/e2e/linkme.cy.js index 6acfe5597..8eebb591a 100644 --- a/cypress/e2e/linkme.cy.js +++ b/cypress/e2e/linkme.cy.js @@ -11,7 +11,7 @@ const nextjsBaseUrl = Cypress.env("nextjsBaseUrl"); // }); // } describe(`linkme`, () => { - it(`redirects on no rec.id`, () => { + it.skip(`redirects on no rec.id`, () => { const path = "/linkme.php/?isBot=true"; const url = `${nextjsBaseUrl}${path}`; cy.visit(url); diff --git a/cypress/e2e/old/bibliographicdata.cy.js b/cypress/e2e/old/bibliographicdata.cy.js index 801bb16e8..18281060d 100644 --- a/cypress/e2e/old/bibliographicdata.cy.js +++ b/cypress/e2e/old/bibliographicdata.cy.js @@ -4,7 +4,7 @@ */ describe("bibliographic data", () => { - it("open edition - check contents", () => { + it.skip("open edition - check contents", () => { cy.visit("/iframe.html?id=work-bibliographic-data--bib-data"); // get first edition cy.get("[data-cy=accordion-item]").first().click(); @@ -20,7 +20,7 @@ describe("bibliographic data", () => { cy.contains("Kopier link til udgave"); }); - it("Full manifestation - check localizationlink", () => { + it.skip("Full manifestation - check localizationlink", () => { cy.visit("/iframe.html?id=work-bibliographic-data--full-manifestation"); cy.contains("Se om den er hjemme på dit bibliotek"); diff --git a/cypress/e2e/old/footer.cy.js b/cypress/e2e/old/footer.cy.js index a73ee61f2..666edad41 100644 --- a/cypress/e2e/old/footer.cy.js +++ b/cypress/e2e/old/footer.cy.js @@ -3,7 +3,7 @@ describe("Overview", () => { cy.visit("/iframe.html?id=layout-footer--footer-story"); }); - it("there should be 4 columns", () => { + it.skip("there should be 4 columns", () => { cy.get("[data-cy=footer-section] [data-cy=footer-column]").should( "have.length", 4 @@ -19,13 +19,13 @@ describe("Overview", () => { .should("include", "logowhite"); }); - it("check contact links", () => { + it.skip("check contact links", () => { cy.get( "[data-cy=footer-section] [data-cy=footer-column] [data-cy=contactlink]" ).should("have.length", 7); }); - it("check branch links", () => { + it.skip("check branch links", () => { cy.get( "[data-cy=footer-section] [data-cy=footer-column] [data-cy=branchlink]" ).should("have.length", 6); diff --git a/cypress/e2e/old/logo.cy.js b/cypress/e2e/old/logo.cy.js index c372466d8..b6ac264b6 100644 --- a/cypress/e2e/old/logo.cy.js +++ b/cypress/e2e/old/logo.cy.js @@ -3,7 +3,7 @@ * Test log */ describe("Logo", () => { - it(`View in BIG viewport`, () => { + it.skip(`View in BIG viewport`, () => { cy.visit("/iframe.html?id=base-logo--default-logo"); cy.viewport(1920, 1080); // verify that banner is shown @@ -11,7 +11,7 @@ describe("Logo", () => { cy.get("[data-cy=key-logo]").should("have.attr", "href").and("equal", "/"); }); - it(`View in SMALL viewport`, () => { + it.skip(`View in SMALL viewport`, () => { cy.visit("/iframe.html?id=base-logo--blue-logo"); cy.viewport(765, 1080); // verify that banner is NOT shown diff --git a/cypress/e2e/old/overview.cy.js b/cypress/e2e/old/overview.cy.js index 791e08b22..881a003b4 100644 --- a/cypress/e2e/old/overview.cy.js +++ b/cypress/e2e/old/overview.cy.js @@ -8,7 +8,7 @@ describe("Overview", () => { cy.visit("/iframe.html?id=work-overview--overview-wrapped"); }); - it(`have basic functionining functionality`, () => { + it.skip(`have basic functionining functionality`, () => { cy.contains("Overview - bog", { timeout: 15000 }); // --- Can tab through to different elements @@ -49,7 +49,7 @@ describe("Overview", () => { cy.get(`[data-cy=${tagBog}]`).children("i").should("not.be.visible"); }); - it("Can default its first materialType: ", () => { + it.skip("Can default its first materialType: ", () => { cy.visit("/iframe.html?id=work-overview--overview-wrapped-no-type"); cy.contains("Overview -", { timeout: 15000 }); diff --git a/cypress/e2e/old/suggester.cy.js b/cypress/e2e/old/suggester.cy.js index fac8eb73b..1b6c21f7b 100644 --- a/cypress/e2e/old/suggester.cy.js +++ b/cypress/e2e/old/suggester.cy.js @@ -119,7 +119,7 @@ describe("Suggester", () => { }); describe("Suggester data collect", () => { - it(`Should collect data for suggester`, () => { + it.skip(`Should collect data for suggester`, () => { // Allow cookies cy.visit(`${nextjsBaseUrl}`); cy.consentAllowAll(); diff --git a/cypress/e2e/quickFilters.cy.js b/cypress/e2e/quickFilters.cy.js index 95ae42eb0..f5fb4f26d 100644 --- a/cypress/e2e/quickFilters.cy.js +++ b/cypress/e2e/quickFilters.cy.js @@ -1,7 +1,7 @@ import isEmpty from "lodash/isEmpty"; describe("Quickfilters", () => { - it(`Check quickfilters`, () => { + it.skip(`Check quickfilters`, () => { cy.visit( "/iframe.html?id=advancedsearch-quickfilter--quick-filter-default" ); diff --git a/cypress/e2e/recommendations.cy.js b/cypress/e2e/recommendations.cy.js index 8c4694955..a3f7fdd3e 100644 --- a/cypress/e2e/recommendations.cy.js +++ b/cypress/e2e/recommendations.cy.js @@ -31,7 +31,7 @@ describe("Series", () => { .and("contain", "-display/recommend.result[0].work.workId"); }); - it(`Should collect data for recommender`, () => { + it.skip(`Should collect data for recommender`, () => { // Click first element cy.contains("recommend.result[0].work.titles.tvSeries.title").click(); diff --git a/cypress/e2e/reservationbutton.cy.js b/cypress/e2e/reservationbutton.cy.js index c299b13d4..4cb7b361c 100644 --- a/cypress/e2e/reservationbutton.cy.js +++ b/cypress/e2e/reservationbutton.cy.js @@ -3,7 +3,7 @@ * Test functionality of reservation button - see also @overview.spec.js */ describe("Reservation button", () => { - it("user logged in material available", () => { + it.skip("user logged in material available", () => { cy.visit( "/iframe.html?id=work-reservationbutton--reservation-button-physical-book" ); @@ -16,7 +16,7 @@ describe("Reservation button", () => { }); }); - it("physical material click opens modal with query params", () => { + it.skip("physical material click opens modal with query params", () => { cy.visit( "/iframe.html?id=work-reservationbutton--reservation-button-physical-book" ); @@ -28,7 +28,7 @@ describe("Reservation button", () => { cy.get("[data-cy=router-query]").contains("modal"); }); - it("physical material shows now for loan message, when no ILL, but is owned by agency", () => { + it.skip("physical material shows now for loan message, when no ILL, but is owned by agency", () => { cy.visit( "/iframe.html?args=&id=work-reservationbutton--reservation-button-physical-book-no-ill-but-is-owned-by-agency" ); @@ -36,7 +36,7 @@ describe("Reservation button", () => { cy.contains("Kan ikke bestilles til hjemlån"); }); - it("digital material", () => { + it.skip("digital material", () => { const urla = "/iframe.html?id=work-reservationbutton--reservation-button-e-book"; @@ -61,7 +61,7 @@ describe("Reservation button", () => { ); }); - it("user logged in material unavailable", () => { + it.skip("user logged in material unavailable", () => { cy.visit( "/iframe.html?id=work-reservationbutton--reservation-button-disabled" ); @@ -70,7 +70,7 @@ describe("Reservation button", () => { }).should("be.disabled"); }); - it("user not logged in then above text is shown", () => { + it.skip("user not logged in then above text is shown", () => { cy.visit( "/iframe.html?id=work-reservationbutton--reservation-button-not-logged-in" ); @@ -98,7 +98,7 @@ describe("Reservation button", () => { }).should("not.include.text", "deaktiveret"); }); - it("user not logged in material available", () => { + it.skip("user not logged in material available", () => { cy.visit( "/iframe.html?id=work-reservationbutton--reservation-button-not-logged-in" ); @@ -113,7 +113,7 @@ describe("Reservation button", () => { }); }); - it("user logged in loan is not possible for material", () => { + it.skip("user logged in loan is not possible for material", () => { cy.visit( "/iframe.html?id=work-reservationbutton--reservation-button-physical-book-loan-not-possible" ); @@ -122,7 +122,7 @@ describe("Reservation button", () => { }).should("be.disabled"); }); - it("onclick should open order-modal, when user is logged ind", () => { + it.skip("onclick should open order-modal, when user is logged ind", () => { cy.visit( "/iframe.html?id=work-reservationbutton--reservation-button-login-flow" ); @@ -140,7 +140,7 @@ describe("Reservation button", () => { cy.get("[data-cy=router-query]").contains("modal"); }); - it("onclick should open login-modal and add order modal to store, when user is NOT logged ind", () => { + it.skip("onclick should open login-modal and add order modal to store, when user is NOT logged ind", () => { cy.visit( "/iframe.html?id=work-reservationbutton--reservation-button-not-logged-in-flow" ); diff --git a/cypress/e2e/search.cy.js b/cypress/e2e/search.cy.js index 3761b86fa..ec96b9e17 100644 --- a/cypress/e2e/search.cy.js +++ b/cypress/e2e/search.cy.js @@ -10,7 +10,7 @@ function checkPrefilledQueryParameters() { describe("Search", () => { describe(`Form`, () => { - it(`Maps query parameters from url to input fields`, () => { + it.skip(`Maps query parameters from url to input fields`, () => { cy.visit("/iframe.html?id=layout-header--nav-header-prefilled"); // Check URL query parameters are as expected @@ -32,7 +32,7 @@ describe("Search", () => { ); }); - it(`Maps query parameters from input fields to url to input fields`, () => { + it.skip(`Maps query parameters from input fields to url to input fields`, () => { cy.visit("/iframe.html?id=layout-header--nav-header"); // Check URL query parameters are as expected @@ -57,7 +57,7 @@ describe("Search", () => { cy.get("[data-cy=router-action]").should("have.text", "push"); }); - it(`Click input clear button should NOT be reflected in URL immediately`, () => { + it.skip(`Click input clear button should NOT be reflected in URL immediately`, () => { cy.visit("/iframe.html?id=layout-header--nav-header-prefilled"); cy.get("header [data-cy=suggester-clear-input]").click(); @@ -66,7 +66,7 @@ describe("Search", () => { checkPrefilledQueryParameters(); }); - it(`Editing default search input, should not wipe other input, filters should be wiped`, () => { + it.skip(`Editing default search input, should not wipe other input, filters should be wiped`, () => { cy.visit("/iframe.html?id=layout-header--nav-header-prefilled"); // Check URL query parameters are as expected @@ -134,7 +134,7 @@ describe("Search", () => { }); }); - it(`Tab away from input will not sync with URL immediately`, () => { + it.skip(`Tab away from input will not sync with URL immediately`, () => { cy.visit("/iframe.html?id=layout-header--nav-header"); cy.get("header [data-cy=suggester-input]") @@ -148,7 +148,7 @@ describe("Search", () => { }); }); - it(`Pressing enter will sync with URL immediately`, () => { + it.skip(`Pressing enter will sync with URL immediately`, () => { cy.visit("/iframe.html?id=layout-header--nav-header"); cy.get("header [data-cy=suggester-input]") @@ -161,7 +161,7 @@ describe("Search", () => { }); }); - it(`Searching should reset filters and page`, () => { + it.skip(`Searching should reset filters and page`, () => { cy.visit("/iframe.html?id=layout-header--nav-header"); cy.get("header [data-cy=suggester-input]") @@ -174,7 +174,7 @@ describe("Search", () => { }); }); - it(`When on another page than /find, it should go to find page when performing search`, () => { + it.skip(`When on another page than /find, it should go to find page when performing search`, () => { // Open story with pathname set to "/some-page" cy.visit( "/iframe.html?id=layout-header--nav-header&nextRouter.pathname=/some-page" @@ -195,7 +195,7 @@ describe("Search", () => { }); describe(`Mobile`, () => { - it(`Maintains input value when opening mobile suggester`, () => { + it.skip(`Maintains input value when opening mobile suggester`, () => { cy.viewport("iphone-6"); cy.visit("/iframe.html?id=layout-header--nav-header-prefilled"); diff --git a/cypress/e2e/ssr.cy.js b/cypress/e2e/ssr.cy.js index 74a967888..ade8f7d3d 100644 --- a/cypress/e2e/ssr.cy.js +++ b/cypress/e2e/ssr.cy.js @@ -47,7 +47,7 @@ function getPageHead(path) { */ describe("Server Side Rendering", () => { describe(`frontpage`, () => { - it(`has correct metadata`, () => { + it.skip(`has correct metadata`, () => { getPageHead("/").then((res) => { expect(res.title).to.equal( "Bibliotek.dk | Lån fra alle Danmarks biblioteker" diff --git a/public/favicon.ico b/public/favicon.ico index 405d27854..4badfcefd 100644 Binary files a/public/favicon.ico and b/public/favicon.ico differ diff --git a/public/schools/hero/greve.jpg b/public/schools/hero/greve.jpg new file mode 100644 index 000000000..3c1f8bff3 Binary files /dev/null and b/public/schools/hero/greve.jpg differ diff --git a/public/schools/hero/odense.jpg b/public/schools/hero/odense.jpg new file mode 100644 index 000000000..9dd85b4fd Binary files /dev/null and b/public/schools/hero/odense.jpg differ diff --git a/public/schools/hero/roskilde.jpg b/public/schools/hero/roskilde.jpg new file mode 100644 index 000000000..547c64502 Binary files /dev/null and b/public/schools/hero/roskilde.jpg differ diff --git a/public/schools/hero/slagelse.jpg b/public/schools/hero/slagelse.jpg new file mode 100644 index 000000000..61eb3da1b Binary files /dev/null and b/public/schools/hero/slagelse.jpg differ diff --git a/public/schools/hero/soro.png b/public/schools/hero/soro.png new file mode 100644 index 000000000..a82e43957 Binary files /dev/null and b/public/schools/hero/soro.png differ diff --git a/public/schools/hero/soroeakademi.jpg b/public/schools/hero/soroeakademi.jpg new file mode 100644 index 000000000..a7436208c Binary files /dev/null and b/public/schools/hero/soroeakademi.jpg differ diff --git a/public/schools/hero/stenhus.jpg b/public/schools/hero/stenhus.jpg new file mode 100644 index 000000000..9ca56c565 Binary files /dev/null and b/public/schools/hero/stenhus.jpg differ diff --git a/public/schools/logo/greve.jpg b/public/schools/logo/greve.jpg new file mode 100644 index 000000000..cdad1fc78 Binary files /dev/null and b/public/schools/logo/greve.jpg differ diff --git a/public/schools/logo/odense.svg b/public/schools/logo/odense.svg new file mode 100644 index 000000000..ec19e80e3 --- /dev/null +++ b/public/schools/logo/odense.svg @@ -0,0 +1 @@ +Logo + Icon - Color \ No newline at end of file diff --git a/public/schools/logo/roskilde.jpg b/public/schools/logo/roskilde.jpg new file mode 100644 index 000000000..d2df9015a Binary files /dev/null and b/public/schools/logo/roskilde.jpg differ diff --git a/public/schools/logo/slagelse.png b/public/schools/logo/slagelse.png new file mode 100644 index 000000000..57067e00b Binary files /dev/null and b/public/schools/logo/slagelse.png differ diff --git a/public/schools/logo/soroeakademi.jpg b/public/schools/logo/soroeakademi.jpg new file mode 100644 index 000000000..7036b92b8 Binary files /dev/null and b/public/schools/logo/soroeakademi.jpg differ diff --git a/public/schools/logo/stenhus.png b/public/schools/logo/stenhus.png new file mode 100644 index 000000000..490d436a7 Binary files /dev/null and b/public/schools/logo/stenhus.png differ diff --git a/src/components/base/logo/Logo.js b/src/components/base/logo/Logo.js index bf9372cc0..6077cc700 100644 --- a/src/components/base/logo/Logo.js +++ b/src/components/base/logo/Logo.js @@ -1,11 +1,10 @@ -import LogoWithText from "./logo_text.svg"; import PropTypes from "prop-types"; import styles from "./Logo.module.css"; import Link from "@/components/base/link"; import { cyKey } from "@/utils/trim"; -import Translate from "@/components/base/translate"; -import cx from "classnames"; import useTestUser from "@/components/hooks/useTestUser"; +import Image from "next/image"; +import useAgencyFromSubdomain from "@/components/hooks/useSubdomainToAgency"; /** * Mark when test user mode is active @@ -36,9 +35,11 @@ function TestUserActive() { * Color of text and svg logo * @returns {React.JSX.Element} */ -export default function Logo({ href = "/", type = "BLUE", ...props }) { - if (props.skeleton) { - return ; +export default function Logo({ href = "/" }) { + const { logoPath } = useAgencyFromSubdomain(); + + if (!logoPath) { + return null; } return ( @@ -50,14 +51,7 @@ export default function Logo({ href = "/", type = "BLUE", ...props }) { })} >
- + logo
@@ -66,6 +60,5 @@ export default function Logo({ href = "/", type = "BLUE", ...props }) { // PropTypes for Button component Logo.propTypes = { - type: PropTypes.oneOf(["BLUE", "WHITE"]), href: PropTypes.string, }; diff --git a/src/components/base/logo/Logo.module.css b/src/components/base/logo/Logo.module.css index 1da53e72a..4044fa9a0 100644 --- a/src/components/base/logo/Logo.module.css +++ b/src/components/base/logo/Logo.module.css @@ -11,15 +11,3 @@ padding-top: var(--pt1); } } - -.defaultLogo_Blue { - color: var(--blue); -} - -.defaultLogo_White { - color: var(--white); -} - -.defaultLogo_Blue *[data-text="true"] { - color: var(--mine-shaft); -} diff --git a/src/components/base/translate/Translate.json b/src/components/base/translate/Translate.json index 4b2dd9833..eb485b461 100644 --- a/src/components/base/translate/Translate.json +++ b/src/components/base/translate/Translate.json @@ -570,12 +570,12 @@ "en": "Skip to content" }, "heroTxt": { - "da": "Søg, find, lån", - "en": "Search, find, borrow" + "da": "Let søgning for elever og lærere", + "en": "Easy search for students and teachers" }, "readMore": { - "da": "Bibliotek.dk viser materialer fra alle danske biblioteker, som du nemt kan låne og aflevere på dit bibliotek.", - "en": "Materials from all danish libraries, easy to pickup and deliver at your local library" + "da": "GymnasieSøg er en enkel grænseflade, der gør det let at søge efter bøger, artikler og gymnasierelevante kilder ét sted.", + "en": "GymnasieSøg is a simple interface that makes it easy to search for books, articles and sources relevant to high school students in one place." }, "searchButton": { "da": "Søg", @@ -915,8 +915,8 @@ }, "footer": { "hvad_er_bibliotek_dk": { - "da": "Bibliotek.dk er en samlet indgang til alle danske bibliotekers materialer og til hvad der udgives i Danmark. Du kan bestille materialer og så hente og låne på dit eget bibliotek. \n Du kan bruge Bibliotek.dk til at søge frem, hvad der er udgivet af bøger, musik, tidsskrifter, artikler, e-bøger, lydbøger osv. Bibliotek.dk er altså ikke et fysisk bibliotek, men en database og service over hvad der findes på danske offentlige biblioteker, som du kan bestille og få leveret til dit lokale bibliotek.", - "en": "What is bibliotek.dk" + "da": "StudieSøg er en enkel søgeflade designet til gymnasieelever og lærere, som gør det nemt at søge efter bøger og artikler. Med funktioner som filtrering på sprog og emne samt adgang til artikler via Infomedia, hvis abonnement er tilgængeligt, hjælper GymnasieSøg med at finde relevant materiale hurtigt. ", + "en": "StudieSøg is a simple search interface designed for high school students and teachers, making it easy to search for books and articles. With features such as filtering by language and subject, as well as access to articles via Infomedia, if available, GymnasieSøg helps find relevant material quickly." }, "contact": { "da": "Kontakt", @@ -1570,13 +1570,17 @@ } }, "overview": { + "see_location": { + "da": "Se placering", + "en": "See location" + }, "check_branch_holding": { "da": "Se om den er hjemme på dit bibliotek", "en": "Check your library" }, "button-order-no-localizations-disabled": { - "da": "Kan ikke bestilles", - "en": "No holdings - disabled" + "da": "Findes ikke på biblioteket", + "en": "Not available" }, "label_library_no_holdings": { "da": "Ingen biblioteker har pt. materialet.", @@ -2264,6 +2268,10 @@ "menu": { "da": "Menu", "en": "Menu" + }, + "english-danish": { + "da": "English", + "en": "Dansk" } }, "search": { diff --git a/src/components/footer/Footer.js b/src/components/footer/Footer.js index 0a10f034a..4627bf411 100644 --- a/src/components/footer/Footer.js +++ b/src/components/footer/Footer.js @@ -7,8 +7,7 @@ import Translate from "@/components/base/translate"; import Language from "@/components/base/language"; import Link from "@/components/base/link"; import styles from "./Footer.module.css"; -import Logo from "@/components/base/logo/Logo"; -import { MATERIAL_PAGES } from "@/components/header"; +import useAgencyFromSubdomain from "@/components/hooks/useSubdomainToAgency"; /** @file * Footer @@ -16,14 +15,6 @@ import { MATERIAL_PAGES } from "@/components/header"; * well section .. rather a copy paste from the Section component */ -/** - * The logo @see icons/logowhite.svg - * @returns {React.JSX.Element} - */ -const FooterLogo = () => { - return ; -}; - /** * First column holds a description of bibliotek.dk and a link to administer * cookie settings @@ -58,11 +49,19 @@ const FirstColumn = () => { * @returns {React.JSX.Element} */ const SecondColumn = () => { + const { agency } = useAgencyFromSubdomain(); let label = Translate({ context: "footer", label: "contact" }); return ( {label}
+
+ {agency?.agencyName} + {agency?.postalAddress} + + {agency?.city} {agency?.postalCode} + +
); @@ -76,19 +75,19 @@ const ContactLinks = () => { // Object holding info to generate contact links * NOTICE Keys of objects are translated. const contact_links = { // find_library: { pathname: "/", query: {} }, - about: { pathname: "/hjaelp/om-bibliotek-dk/24", query: {} }, - help: { pathname: "/hjaelp", query: {} }, + // about: { pathname: "/hjaelp/om-bibliotek-dk/24", query: {} }, + // help: { pathname: "/hjaelp", query: {} }, // press: { pathname: "/", query: {} }, - contact: { pathname: "/hjaelp/kontakt-os/25", query: {} }, + // contact: { pathname: "/hjaelp/kontakt-os/25", query: {} }, privacy: { pathname: "/hjaelp/privatlivspolitik-saadan-haandterer-vi-dine-data-/26", query: {}, }, - suppliers: { - pathname: "/artikel/leverandører/59", - query: {}, - }, - English: { pathname: "/", query: {} }, + // suppliers: { + // pathname: "/artikel/leverandører/59", + // query: {}, + // }, + // English: { pathname: "/", query: {} }, accessibility: { pathname: "https://www.was.digst.dk/bibliotek-dk", query: {}, @@ -141,50 +140,6 @@ const ContactLinks = () => { }); }; -/** - * Third column holds links to different material types - * (don't know why it is called branches - see design) - * @returns {React.JSX.Element} - */ -const ThirdColumn = () => { - let label = Translate({ context: "footer", label: "branches" }); - return ( - - - {label} - -
- -
- ); -}; - -/** - * Generate links for materialtypes - * Object holding info to generate links to materialtypes - * NOTICE Keys are translated - * @returns {React.JSX.Element} - */ -const BranchLinks = () => { - return MATERIAL_PAGES.map(({ path, label }) => ( -
- - - {Translate({ - context: "facets", - label: `label-${label}`, - })} - - -
- )); -}; - /** * Defines the footer section - one row with four columns * @returns {React.JSX.Element} @@ -198,14 +153,6 @@ const FooterSection = () => { className={`${styles.background} `} data-cy="footer-section" > - - - { { - - + > diff --git a/src/components/footer/Footer.module.css b/src/components/footer/Footer.module.css index 62d714301..2963ccbe9 100644 --- a/src/components/footer/Footer.module.css +++ b/src/components/footer/Footer.module.css @@ -48,3 +48,7 @@ display: none; } } + +.contactContainer { + margin-top: var(--pt1); +} diff --git a/src/components/head/Head.js b/src/components/head/Head.js index 0f1144816..00144cf64 100644 --- a/src/components/head/Head.js +++ b/src/components/head/Head.js @@ -3,10 +3,12 @@ import Head from "next/head"; import useCanonicalUrl from "@/components/hooks/useCanonicalUrl"; import Translate from "@/components/base/translate"; +import useAgencyFromSubdomain from "@/components/hooks/useSubdomainToAgency"; export default function _Head() { + const { agency } = useAgencyFromSubdomain(); const context = { context: "metadata" }; - const pageTitle = Translate({ ...context, label: "frontpage-title" }); + const pageTitle = agency?.name || "Studiesøg"; const pageDescription = Translate({ ...context, label: "frontpage-description", @@ -38,7 +40,7 @@ export default function _Head() { - + {alternate.map(({ locale, url }) => ( diff --git a/src/components/header/Header.js b/src/components/header/Header.js index ded9fa165..6655c452c 100644 --- a/src/components/header/Header.js +++ b/src/components/header/Header.js @@ -5,14 +5,11 @@ import Row from "react-bootstrap/Row"; import React, { useRef } from "react"; import cx from "classnames"; -import useHistory from "@/components/hooks/useHistory"; import useFilters from "@/components/hooks/useFilters"; -import useQ from "@/components/hooks/useQ"; -import { useAdvancedSearchContext } from "@/components/search/advancedSearch/advancedSearchContext"; import { cyKey } from "@/utils/trim"; -import Suggester, { focusInput, blurInput } from "./suggester/"; +import { focusInput } from "./suggester/"; import Translate from "@/components/base/translate"; import Text from "@/components/base/text"; @@ -21,22 +18,17 @@ import Link from "@/components/base/link"; import { useModal } from "@/components/_modal"; import LoginIcon from "./icons/login"; -import BurgerIcon from "./icons/burger"; +import GlobeIcon from "./icons/globe"; import SearchIcon from "./icons/search"; import BookmarkIcon from "./icons/bookmark"; import Logo from "@/components/base/logo/Logo"; -import { SkipToMainAnchor } from "@/components/base/skiptomain/SkipToMain"; - -import { DesktopMaterialSelect } from "@/components/search/select"; import { openMobileSuggester } from "@/components/header/suggester/Suggester"; import styles from "./Header.module.css"; -import { useRouter } from "next/router"; -import { SuggestTypeEnum } from "@/lib/enums"; -import isEmpty from "lodash/isEmpty"; -import useBreakpoint from "@/components/hooks/useBreakpoint"; +import Router, { useRouter } from "next/router"; + import { openLoginModal } from "../_modal/pages/login/utils"; import { signOut } from "@dbcdk/login-nextjs/client"; import useAuthentication from "../hooks/user/useAuthentication"; @@ -79,30 +71,12 @@ export function Header({ story = null, user, modal, - filters, hideShadow, }) { const context = { context: "header" }; - const breakpoint = useBreakpoint(); - const isMobileSize = - breakpoint === "xs" || breakpoint === "sm" || breakpoint === "md"; - - const { q, setQ, setQuery } = useQ(); - - const query = q[SuggestTypeEnum.ALL]; - - // Search history in suggester - const [history, setHistory, clearHistory] = useHistory(); - - // workType filter param - const { workTypes } = filters.getQuery(); - - // specific material workType selected - const selectedMaterial = workTypes[0] || SuggestTypeEnum.ALL; const simpleSearchRef = useRef(null); - const { showInfoTooltip, showPopover, setShowInfoTooltip } = - useAdvancedSearchContext(); + const getLoginLabel = () => { if (user.hasCulrUniqueId) { return "profile"; @@ -145,59 +119,24 @@ export function Header({ onClick: () => router.push("/profil/huskeliste"), }, { - label: "menu", - icon: BurgerIcon, - onClick: () => modal.push("menu"), - }, - ]; - - // Search modal suggester is visible - const suggesterVisibleMobile = - (story && story.suggesterVisibleMobile) || - (isMobileSize && router && router.query.suggester); - - // suggester visible class - const suggesterVisibleMobileClass = suggesterVisibleMobile - ? styles.suggester__visible - : ""; - - const doSearch = (value) => { - // If we are on mobile we replace - // since we don't want to suggest modal to open if user goes back - const method = suggesterVisibleMobile ? "replace" : "push"; - - const type = { - workTypes: - selectedMaterial !== SuggestTypeEnum.ALL ? selectedMaterial : null, - }; - - const newQ = isEmpty(value) ? { ...q, all: "" } : { ...q, all: value }; + label: "english-danish", + icon: GlobeIcon, + onClick: () => { + const locale = Router.locale === "da" ? "en" : "da"; + const pathname = Router.pathname; + const query = { ...Router.query }; - setQuery({ - include: newQ, - exclude: ["page"], - pathname: "/find", - query: type, - method, - }); + // remove modal key from query + // this will close the modal after language change + delete query.modal; - document.activeElement.blur(); + Router.push({ pathname, query }, null, { locale }); - // Delay history update in list - setTimeout(() => { - setHistory(value); - }, 300); - }; + // modal.push("menu"); + }, + }, + ]; - // function to force search onKeyDown - const keyPressed = (e) => { - if (e.key === "Enter") { - doSearch(e.target.value); - if (showInfoTooltip) { - setShowInfoTooltip(false); - } - } - }; return (
- - - -
-
- - -
- doSearch(val)} - onChange={(val) => setQ({ ...q, all: val })} - dataCy={`simple-search-input`} - onClose={() => { - if (router) { - // remove suggester prop from query obj - router.back(); - } - // Remove suggester in storybook - story && story.setSuggesterVisibleMobile(false); - }} - onKeyDown={keyPressed} - /> -
- - -
-
- -
-
+ + +
+
+ +
{menu.map((m) => { const ActionIcon = m.icon; diff --git a/src/components/header/Header.module.css b/src/components/header/Header.module.css index 1214f6474..42f76c04e 100644 --- a/src/components/header/Header.module.css +++ b/src/components/header/Header.module.css @@ -28,16 +28,6 @@ display: none; } -.header .top, -.header .bottom { - display: flex; - justify-content: space-between; -} - -.header .bottom { - height: 100%; -} - .header .top { display: none; padding: var(--pt1) 0 var(--pt1) 0; @@ -63,102 +53,15 @@ align-items: center; } -.bottom .actions .action, .top .materials a, .top .actions a { margin: 0 var(--pt3) 0 0; } -.bottom .actions .action { - display: flex; - margin: 0 var(--pt4) 0 0; -} - -.bottom .actions .action:last-child, .top .actions a:last-child { margin: 0; } -.bottom .actions { - display: flex; - align-items: center; -} - -/* Logo */ - -.select { - white-space: nowrap; - height: var(--pt7); -} - -/* Searchbar */ - -.search { - flex-grow: 2; - display: flex; - position: relative; -} - -.suggester__wrap { - padding-bottom: var(--pt2); - flex-grow: 2; - max-width: 672px; -} - -.suggester { - max-width: 100%; -} - -/* Search button */ - -.button { - position: relative; - width: 125px; - min-width: 125px; - height: var(--pt7); - padding: var(--pt2) var(--pt4); - background-color: transparent; - color: var(--blue); - border: 2px solid var(--blue); - font-family: var(--body-font-medium); - font-size: 20px; - letter-spacing: 0.2px; - line-height: 22px; - cursor: pointer; - overflow: hidden; -} - -.button span { - color: var(--blue); - position: relative; - z-index: 2; - border-width: 3px; -} - -.button .fill { - position: absolute; - width: 100%; - height: 100%; - background-color: var(--blue); - left: 50%; - top: 50%; - transform: translate(-50%, -50%) scale(0.75); - transition-duration: 0.2s; - z-index: 1; - opacity: 0; -} - -.button:hover > .fill, -.button:focus-visible > .fill { - opacity: 1; - transform: translate(-50%, -50%) scale(1.1); -} - -.button:hover > span, -.button:focus-visible > span { - color: white; -} - @media (max-width: 991px) { .header { padding-top: var(--pt1); @@ -201,10 +104,6 @@ transform: scale(0.9); } - .search > * { - display: none; - } - .mobileHeader { margin-left: 0; } @@ -212,33 +111,6 @@ .mobileHeaderNoActionCol { display: none; } - - .suggester__wrap { - position: fixed; - top: 0; - left: 0; - - width: 100%; - max-width: 100%; - height: 100%; - background-color: white; - z-index: 99; - - display: block; - opacity: 0; - pointer-events: none; - transition-duration: 0.3s; - transform: translate(0, 50px); - } - - /* visible suggester class for mobile */ - .suggester__visible { - max-width: 100%; - opacity: 1; - pointer-events: auto; - transform: translate(0, 0); - transition-duration: 0.35s; - } } @media (min-width: 992px) { @@ -247,35 +119,11 @@ /*padding-bottom: var(--pt4);*/ } - .header .bottom { - height: auto; - } - - .bottom .actions { - height: 64px; - } - - .bottom .actions .action:first-child { - display: none; - } - - .bottom .actions .action:last-child { - display: flex; - } - .header .top { display: flex; height: 48px; } - .header .bottom { - padding: var(--pt1) 0 0 0; - } - - .bottom .actions .action { - margin: 0 var(--pt3) 0 0; - } - .mobileSearch { display: none; } @@ -293,16 +141,6 @@ } } -@media (min-width: 1200px) { - .bottom .actions .action { - display: flex; - } - - .bottom .actions .action:first-child { - display: none; - } -} - @media (min-width: 1400px) { .header .top { justify-content: space-between; diff --git a/src/components/header/icons/burger/burger.js b/src/components/header/icons/burger/burger.js deleted file mode 100644 index 723ec8b7c..000000000 --- a/src/components/header/icons/burger/burger.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Custom basket action menu - */ -import PropTypes from "prop-types"; - -import Action from "@/components/base/action"; - -import styles from "./burger.module.css"; - -/** - * The Component function - * - * @param {Object} props - * See propTypes for specific props and types - * - * @returns {React.JSX.Element} - */ -export default function BurgerIcon(props) { - const { className } = props; - - return ( - -
-
-
-
-
-
-
- - ); -} - -// PropTypes for component -BurgerIcon.propTypes = { - className: PropTypes.oneOfType([PropTypes.string, PropTypes.object]), - href: PropTypes.oneOfType([PropTypes.string, PropTypes.object]), - icon: PropTypes.string, - title: PropTypes.string, - badge: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), - children: PropTypes.object, - dataCy: PropTypes.string, -}; diff --git a/src/components/header/icons/burger/burger.module.css b/src/components/header/icons/burger/burger.module.css deleted file mode 100644 index a7054ecf3..000000000 --- a/src/components/header/icons/burger/burger.module.css +++ /dev/null @@ -1,41 +0,0 @@ -.icon { - /* width: var(--pt2); */ - /* height: 18px; */ - width: 20px; - height: 22px; - display: flex; - flex-direction: column; - justify-content: space-between; -} - -.line { - width: 100%; - height: 2px; - background-color: var(--mine-shaft); - margin: auto; - transition-duration: 0.3s; -} - -.line:nth-child(2) { - transform: scale(0.75); -} -@media (hover: hover) { - .trigger:hover .line:not(:nth-child(2)), - .trigger:focus .line:not(:nth-child(2)) { - animation: fullWidth 0.4s cubic-bezier(0.3, 1, 0.32, 1.3); - } - - .trigger:hover .line:nth-child(2), - .trigger:focus .line:nth-child(2) { - transform: scale(1); - animation: fullWidth 0.4s cubic-bezier(0.3, 1, 0.32, 2); - } -} -@keyframes fullWidth { - from { - transform: scale(0.75); - } - to { - transform: scale(1); - } -} diff --git a/src/components/header/icons/globe/burger.js b/src/components/header/icons/globe/burger.js new file mode 100644 index 000000000..6deece3d2 --- /dev/null +++ b/src/components/header/icons/globe/burger.js @@ -0,0 +1,58 @@ +import PropTypes from "prop-types"; +import Action from "@/components/base/action"; +import styles from "./burger.module.css"; +/** + * The Component function replicating the uploaded SVG icon + * + * @param {Object} props + * See propTypes for specific props and types + * + * @returns {React.JSX.Element} + */ +export default function EarthIcon(props) { + const { className } = props; + + return ( + +
+ + Language + + + + +
+
+ ); +} + +// PropTypes for component +EarthIcon.propTypes = { + className: PropTypes.oneOfType([PropTypes.string, PropTypes.object]), + href: PropTypes.oneOfType([PropTypes.string, PropTypes.object]), + icon: PropTypes.string, + title: PropTypes.string, + badge: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), + children: PropTypes.object, + dataCy: PropTypes.string, +}; diff --git a/src/components/header/icons/globe/burger.module.css b/src/components/header/icons/globe/burger.module.css new file mode 100644 index 000000000..e1cab07e0 --- /dev/null +++ b/src/components/header/icons/globe/burger.module.css @@ -0,0 +1,20 @@ +.icon { + width: 24px; + height: 24px; + display: flex; + align-items: center; + justify-content: center; +} + +.earth { + width: 100%; + height: 100%; +} + +@media (hover: hover) { + .trigger:hover .earth, + .trigger:focus .earth { + stroke: var(--blue); + transition: stroke 0.3s ease; + } +} diff --git a/src/components/header/icons/burger/index.js b/src/components/header/icons/globe/index.js similarity index 100% rename from src/components/header/icons/burger/index.js rename to src/components/header/icons/globe/index.js diff --git a/src/components/help/header/Header.js b/src/components/help/header/Header.js index 7dc7da8d0..f5744bba0 100644 --- a/src/components/help/header/Header.js +++ b/src/components/help/header/Header.js @@ -7,8 +7,8 @@ import Translate from "@/components/base/translate"; import SearchInput from "@/components/help/search/input"; import { useModal } from "@/components/_modal"; - -import BurgerIcon from "@/components/header/icons/burger"; +//TODO: CHECK WHERE THIS COMPONENT IS USED +import GlobeIcon from "@/components/header/icons/globe"; import styles from "./Header.module.css"; import Title from "@/components/base/title"; @@ -61,7 +61,7 @@ export function Header({ - onMenuClick()} diff --git a/src/components/hero/Hero.js b/src/components/hero/Hero.js index 0ba9a3525..52eb46e81 100644 --- a/src/components/hero/Hero.js +++ b/src/components/hero/Hero.js @@ -9,22 +9,24 @@ import Icon from "@/components/base/icon"; import FakeSearchInput from "@/components/header/suggester/FakeSearchInput"; import Translate from "@/components/base/translate"; import Image from "@/components/base/image"; -import { useData } from "@/lib/api/api"; -import { frontpageHero } from "@/lib/api/hero.fragments"; + import Text from "@/components/base/text/Text"; +import useAgencyFromSubdomain from "@/components/hooks/useSubdomainToAgency"; //@TODO switch backclass for mobile // @TODO image scale on resize -export function Hero({ image }) { +export function Hero() { + const { agency, heroPath } = useAgencyFromSubdomain(); + return ( - {image?.image?.url && ( + {heroPath && ( )}
@@ -69,9 +71,9 @@ export function Hero({ image }) { })}
- {image?.description && ( + {agency?.name && ( - {`${image?.description}`} + {`${agency.name}`} )} @@ -102,7 +104,5 @@ export function parseHero(data) { } export default function Wrap() { - const { data } = useData(frontpageHero()); - const heroImage = parseHero(data); - return ; + return ; } diff --git a/src/components/hero/Hero.module.css b/src/components/hero/Hero.module.css index 445b9e351..ad77a3bed 100644 --- a/src/components/hero/Hero.module.css +++ b/src/components/hero/Hero.module.css @@ -43,7 +43,7 @@ } .bluebox { - width: 559px; + width: 530px; background-color: var(--blue); color: var(--white); position: absolute; diff --git a/src/components/hooks/useSubdomainToAgency.js b/src/components/hooks/useSubdomainToAgency.js new file mode 100644 index 000000000..41790280d --- /dev/null +++ b/src/components/hooks/useSubdomainToAgency.js @@ -0,0 +1,63 @@ +//Given a subdomain, returns agency data. e.g. odense.gym.bib.dk -> returns odense agency data +import { useEffect, useState } from "react"; +//TODO: should we fetch from fbi-api instead? +import gymAgencies from "@/components/utils/gymAgencies.json"; +//TODO: get exact subdomain names from current urls https://odense.gym.bib.dk/ +const agencyNames = [ + "roskilde", + "soroeakademi", + "odense", + "greve", + "slagelse", + "stenhus", +]; +//path to logo images +const logoPaths = { + greve: "/schools/logo/greve.jpg", + odense: "/schools/logo/odense.svg", + roskilde: "/schools/logo/roskilde.jpg", + slagelse: "/schools/logo/slagelse.png", + stenhus: "/schools/logo/stenhus.png", + soroeakademi: "/schools/logo/soroeakademi.jpg", +}; + +const heroPath = { + roskilde: "/schools/hero/roskilde.jpg", + greve: "/schools/hero/greve.jpg", + slagelse: "/schools/hero/slagelse.jpg", + stenhus: "/schools/hero/stenhus.jpg", + odense: "/schools/hero/odense.jpg", + soroeakademi: "/schools/hero/soroeakademi.jpg", +}; +const useAgencyFromSubdomain = () => { + const [agencyName, setAgencyName] = useState(null); + + useEffect(() => { + if (typeof window !== "undefined") { + const subdomains = window.location?.hostname?.split("."); + const extractedAgencyName = subdomains[0]; + + if (agencyNames.includes(extractedAgencyName)) { + setAgencyName(extractedAgencyName); + } else if (extractedAgencyName === "localhost") { + //TODO: remove later. For localhost testing + setAgencyName("soroeakademi"); + + // "roskilde", + // "soroeakademi", + // "odense", + // "greve", + // "slagelse", + // "stenhus", + } + } + }, []); + + return { + agency: gymAgencies[agencyName], + logoPath: logoPaths[agencyName], + heroPath: heroPath[agencyName], + }; +}; + +export default useAgencyFromSubdomain; diff --git a/src/components/profile/bookmarks/Bookmark.module.css b/src/components/profile/bookmarks/Bookmark.module.css index d8212e3ed..ad9dce689 100644 --- a/src/components/profile/bookmarks/Bookmark.module.css +++ b/src/components/profile/bookmarks/Bookmark.module.css @@ -34,24 +34,6 @@ margin-right: var(--pt1); } -.orderButton { - width: 100px; - margin-right: var(--pt2); -} - -.orderButton:not(disabled) { - outline: 2px solid var(--blue); -} - -.orderButton:not(disabled):hover, -.orderButton:not(disabled):focus-visible { - outline: 2px solid var(--mine-shaft); -} - -.referenceButton { - margin-right: var(--pt3); -} - .listContainer { border-top: 1px solid var(--iron); } diff --git a/src/components/profile/bookmarks/Page.js b/src/components/profile/bookmarks/Page.js index c5d8c8477..9737dd4d4 100644 --- a/src/components/profile/bookmarks/Page.js +++ b/src/components/profile/bookmarks/Page.js @@ -474,29 +474,7 @@ const BookmarkPage = () => { })}
- - +
-
- -
- -
- - openReferencesModal( - modal, - [manifestation?.pid], - workId, - manifestation - ) - } - > - - {Translate({ - context: "references", - label: "label_references_title", - })} - - -
-
{ return manifestationMaterialTypeFactory(manifestations); @@ -87,6 +86,14 @@ export function Overview({ ); const selectedPids = useMemo(() => flatPidsByType(type), [type]); + const { branches } = useHoldingsForAgency({ + pids: allPids, + agencyId: agency?.agencyId, + }); + const branch = branches?.find( + (branch) => branch?.branchId === agency?.branchId + ); + return (
@@ -154,6 +161,7 @@ export function Overview({ - - - - - - diff --git a/src/components/work/overview/Overview.module.css b/src/components/work/overview/Overview.module.css index 1c6eea002..1f63473cc 100644 --- a/src/components/work/overview/Overview.module.css +++ b/src/components/work/overview/Overview.module.css @@ -70,13 +70,6 @@ flex-wrap: wrap; } -.info { - padding-top: var(--pt1); -} -.info p:first-letter { - text-transform: uppercase; -} - .subtitle { padding: 0 0 var(--pt1) 0; } diff --git a/src/components/work/reservationbutton/ReservationButton.js b/src/components/work/reservationbutton/ReservationButton.js index 3efe89793..0799b12e6 100644 --- a/src/components/work/reservationbutton/ReservationButton.js +++ b/src/components/work/reservationbutton/ReservationButton.js @@ -9,12 +9,11 @@ import { handleGoToLogin, sortEreolFirst, } from "@/components/work/reservationbutton/utils"; -import isEmpty from "lodash/isEmpty"; import useAuthentication from "@/components/hooks/user/useAuthentication"; import { useManifestationAccess } from "@/components/hooks/useManifestationAccess"; import { useData } from "@/lib/api/api"; import { overviewWork } from "@/lib/api/work.fragments"; -import { useManifestationData, useOrderFlow } from "@/components/hooks/order"; +import { useManifestationData } from "@/components/hooks/order"; function TextAboveButton({ access, isAuthenticated }) { return ( @@ -57,6 +56,7 @@ function ReservationButtonWrapper({ className, handleOrderFinished = undefined, bookmarkKey, + branch, }) { const { data: workData, isLoadingWorkData } = useData( workId && overviewWork({ workId }) @@ -135,6 +135,7 @@ function ReservationButtonWrapper({ hasPhysicalCopy, hasDigitalCopy, bookmarkKey, + branch, }} /> ); @@ -161,89 +162,56 @@ export const ReservationButton = ({ isAuthenticated, buttonType, size, - pids, - shortText = false, // Shorten material text overrideButtonText = null, - modal, + branch, workTypes, materialTypes, - hasPhysicalCopy, - bookmarkKey, + modal, }) => { access = sortEreolFirst(access); - const { start } = useOrderFlow(); - const noSelectedManifestations = Boolean(isEmpty(access)); - - // pjo 15/08/24 - added filter for dfi.dk - it is not a real accessUrl - const onlineMaterialWithoutLoginOrLoginAtUrl = Boolean( - access?.filter((entry) => entry?.url && entry?.origin !== "www.dfi.dk") - .length > 0 - ); - - const noSelectedManifestationsProps = { - dataCy: "button-order-overview-disabled", - disabled: true, - }; - - let noSelectedManifestationsLabel; - if (!hasPhysicalCopy) { - noSelectedManifestationsLabel = "Order-disabled-but-owned"; - } else if (hasPhysicalCopy) { - noSelectedManifestationsLabel = "Order-disabled"; - } else { - noSelectedManifestationsLabel = "Order-online-disabled"; - } - const noSelectedManifestationsTxt = Translate({ - context: "overview", - label: noSelectedManifestationsLabel, - }); - - const accessibleOnlineAndNoLoginProps = { - skeleton: !access, - dataCy: "button-order-overview", - onClick: () => handleGoToLogin(modal, access, isAuthenticated), - }; - - const loginRequiredProps = { - skeleton: isEmpty(access), - dataCy: `button-order-overview-enabled`, - onClick: () => { - start({ orders: [{ pids, bookmarkKey: bookmarkKey }] }); - }, - }; - - const loginRequiredText = Translate({ - context: "general", - label: "bestil", - }); - - /** - * Get props for the button based on the case scenario - * @returns {Object} props and text for button - */ const getProps = () => { - if (noSelectedManifestations) { + const lookupUrl = branch?.holdings?.lookupUrl; + if (lookupUrl) { return { - props: noSelectedManifestationsProps, - text: noSelectedManifestationsTxt, + props: { + dataCy: "button-order-overview-enabled", + onClick: () => { + window.open(lookupUrl, "_blank"); + }, + }, + text: Translate({ context: "overview", label: "see_location" }), preferSecondary: false, }; } + // is this an access url ? + const onlineAccessUrl = Boolean( + access?.filter((entry) => entry?.url && entry?.origin !== "www.dfi.dk") + .length > 0 + ); + // props for button - online access with login options + const onlineAccessWithLogin = { + skeleton: !access, + dataCy: "button-order-overview", + onClick: () => handleGoToLogin(modal, access, isAuthenticated), + }; //ACCESS_URL,INFOMEDIA,EREOL - if (onlineMaterialWithoutLoginOrLoginAtUrl) { + if (onlineAccessUrl) { return { - props: accessibleOnlineAndNoLoginProps, - text: constructButtonText(workTypes, materialTypes, shortText), - preferSecondary: shortText, // Becomes secondary button if button links to material (not ordering) + props: onlineAccessWithLogin, + text: constructButtonText(workTypes, materialTypes), }; } - - //DIGITAL_ARTICLE_SERVICE, INTER_LIBRARY_LOAN return { - props: loginRequiredProps, - text: loginRequiredText, + props: { + dataCy: "button-order-no-localizations-disabled", + disabled: true, + }, + text: Translate({ + context: "overview", + label: "button-order-no-localizations-disabled", + }), preferSecondary: false, }; }; diff --git a/src/css/colors.css b/src/css/colors.css index b0a62be3f..5c1b83a6c 100644 --- a/src/css/colors.css +++ b/src/css/colors.css @@ -9,7 +9,7 @@ :root { /* Primary */ --mine-shaft: #212121; /* Primary txt color */ - --blue: #3333ff; /* Interaction color, links, buttons, ... */ + --blue: #006d7c; /* Interaction color, links, buttons, ... */ /* Secondary */ --concrete: #f2f2f2; /* Default bg color */ diff --git a/src/pages/_app.js b/src/pages/_app.js index b1f7ad85f..52096a19a 100644 --- a/src/pages/_app.js +++ b/src/pages/_app.js @@ -29,7 +29,6 @@ import { setTranslations, } from "@/components/base/translate/Translate"; -import Banner from "@/components/banner/Banner"; import Footer from "@/components/footer"; import Matomo from "@/components/matomo"; import BodyScrollLock from "@/components/scroll/lock"; @@ -37,13 +36,11 @@ import Modal from "@/components/_modal"; import Pages from "@/components/_modal/pages"; import Notifications from "@/components/base/notifications/Notifications"; import HelpHeader from "@/components/help/header"; -import FeedBackLink from "@/components/feedbacklink"; import { SkipToMainLink } from "@/components/base/skiptomain/SkipToMain"; import Listener from "@/components/ffu"; import Head from "@/components/head"; -import fetchTranslations from "@/lib/api/backend"; import App from "next/app"; import SetPickupBranch from "@/components/utils/SetPickupBranch"; import { enableDebug } from "@/lib/api/api"; @@ -242,13 +239,11 @@ export default function MyApp({ Component, pageProps: _pageProps, router }) {
- -
@@ -283,7 +278,6 @@ MyApp.getInitialProps = async (ctx) => { return { pageProps: { ...appProps?.pageProps, - translations: await fetchTranslations(), }, }; }; diff --git a/src/pages/api/auth/[...nextauth].js b/src/pages/api/auth/[...nextauth].js index 1e8e24b3d..4deb474d6 100644 --- a/src/pages/api/auth/[...nextauth].js +++ b/src/pages/api/auth/[...nextauth].js @@ -103,4 +103,13 @@ export const options = { }, }; -export default NextAuth(options); +export default async function auth(req, res) { + // Instead of using a static env variable NEXTAUTH_URL, we generate + // it dynamically. This is because we have multiple subdomains pointing to + // same NextJS instance. + const host = req.headers.host; + const protocol = req.headers["x-forwarded-proto"] || "http"; + const baseUrl = protocol + "://" + host; + + return NextAuth(req, res, { ...options, baseUrl }); +} diff --git a/src/pages/index.js b/src/pages/index.js index b0a238418..16c3a0e5c 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -6,15 +6,12 @@ import Head from "next/head"; -import ArticleSection from "@/components/article/section"; import Hero from "@/components/hero"; import { promotedArticles } from "@/lib/api/article.fragments"; import { fetchAll } from "@/lib/api/apiServerOnly"; import Header from "@/components/header/Header"; -import Translate from "@/components/base/translate"; import React from "react"; import { frontpageHero } from "@/lib/api/hero.fragments"; -import { InspirationSlider } from "@/components/inspiration"; import { useData } from "@/lib/api/api"; import { parseHero } from "@/components/hero/Hero"; @@ -37,35 +34,6 @@ const Index = () => { /> )} - - - - - - - );