diff --git a/CHANGELOG.md b/CHANGELOG.md
index 53dec348..8c43f87d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# CHANGE LOG
+## [0.18.4]
+
+- Update license link for editions, works, and collections to copyright
+- Update License page to Copyright and add section for "In Copyright" explanation
+- Remove error codes from error page
+- Update styling for mobile view of error page
+- SFR:2257 - fix pw tests for modified license page
+
## [0.18.3]
- Fix error when collections are empty
diff --git a/package-lock.json b/package-lock.json
index ed0e8183..dd4fbe86 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "sfr-bookfinder-front-end",
- "version": "0.18.3",
+ "version": "0.18.4",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sfr-bookfinder-front-end",
- "version": "0.18.3",
+ "version": "0.18.4",
"dependencies": {
"@chakra-ui/react": "2.5.4",
"@newrelic/next": "0.10.0",
diff --git a/package.json b/package.json
index 6f6117e9..ba437ddb 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "sfr-bookfinder-front-end",
- "version": "0.18.3",
+ "version": "0.18.4",
"private": true,
"scripts": {
"dev": "next dev",
diff --git a/playwright/features/licensePage.feature b/playwright/features/copyrightPage.feature
similarity index 60%
rename from playwright/features/licensePage.feature
rename to playwright/features/copyrightPage.feature
index e2a786b5..385ad068 100644
--- a/playwright/features/licensePage.feature
+++ b/playwright/features/copyrightPage.feature
@@ -1,13 +1,13 @@
Feature: License Page
- Scenario: As a user I want to verify the headers and subheaders of DRB License Page
- Given I go to the "license" page
- Then the "license explanations header" should be displayed
+ Scenario: As a user I want to verify the headers and subheaders of DRB Copyright Page
+ Given I go to the "copyright" page
+ Then the "copyright explanations header" should be displayed
Then the "public domain header" should be displayed
Then the "public domain us only header" should be displayed
Then the "creative commons licenses header" should be displayed
- Scenario: As a user I verify the subheaders of DRB License Page are displayed correctly
- Given I go to the "license" page
+ Scenario: As a user I verify the subheaders of DRB Copyright Page are displayed correctly
+ Given I go to the "copyright" page
Then the "public domain subheader" should be displayed
Then the "public domain us only subheader" should be displayed
\ No newline at end of file
diff --git a/playwright/features/drbFooters.feature b/playwright/features/drbFooters.feature
index 545c71cf..62774738 100644
--- a/playwright/features/drbFooters.feature
+++ b/playwright/features/drbFooters.feature
@@ -15,13 +15,13 @@ Feature: Footer Links
And the "language footer link" should be displayed
Examples:
- | DRB |
- | "home" |
- | "advanced search" |
- | "search results" |
- | "item details" |
- | "edition details" |
- | "collection" |
- | "read online" |
- | "license" |
- | "about" |
+ | DRB |
+ | "home" |
+ | "advanced search" |
+ | "search results" |
+ | "item details" |
+ | "edition details" |
+ | "collection" |
+ | "read online" |
+ | "copyright" |
+ | "about" |
diff --git a/playwright/features/headerLinks.feature b/playwright/features/headerLinks.feature
index 38e216e9..3224d469 100644
--- a/playwright/features/headerLinks.feature
+++ b/playwright/features/headerLinks.feature
@@ -27,7 +27,7 @@ Feature: Header Links
| "edition details" |
| "collection" |
| "read online" |
- | "license" |
+ | "copyright" |
| "about" |
Scenario: As a user I navigate to the Digital Research Books home page and verify the account and search header sub-links and elements are displayed
diff --git a/playwright/support/mappings.ts b/playwright/support/mappings.ts
index 6bc5af40..fc120590 100644
--- a/playwright/support/mappings.ts
+++ b/playwright/support/mappings.ts
@@ -27,8 +27,8 @@ export const pages: { [name: string]: Pages } = {
about: {
route: "/about",
},
- license: {
- route: "/license",
+ copyright: {
+ route: "/copyright",
},
"read online": {
route: "/read/4440666",
@@ -117,7 +117,7 @@ export const elements = {
"item featured edition year": "a:has-text('Edition') >> nth=0",
"item featured edition publisher": "div:text('Published by') >> nth=0",
"item featured edition language": "div:text('Languages') >> nth=0",
- "item featured edition license": "[href='/license'] >> nth=0",
+ "item featured edition license": "[href='/copyright'] >> nth=0",
"item details heading": "#details-list-heading",
"item details authors heading": "dt:text('Authors')",
"item details authors": "dd > a[href*='display=author'] >> nth=0",
@@ -213,7 +213,7 @@ export const elements = {
"language footer link": "//a[@href='http://www.nypl.org/language']",
/** license page locators */
- "license explanations header": "//h1[text()='License Explanations']",
+ "copyright explanations header": "//h1[text()='Copyright Explanations']",
"public domain header": "//h2[text()='Public Domain']",
"creative commons licenses header":
"//h2[text()='Creative Commons Licenses']",
diff --git a/src/__tests__/Search.test.tsx b/src/__tests__/Search.test.tsx
index 7244e2f8..8bd0c899 100644
--- a/src/__tests__/Search.test.tsx
+++ b/src/__tests__/Search.test.tsx
@@ -366,8 +366,8 @@ describe("Renders Search Results Page", () => {
});
test("Shows license with links", () => {
expect(
- screen.getByText("License: Public Domain").closest("a").href
- ).toContain("/license");
+ screen.getByText("Copyright: Public Domain").closest("a").href
+ ).toContain("/copyright");
});
test("Shows cover", () => {
expect(
@@ -415,8 +415,8 @@ describe("Renders Search Results Page", () => {
});
test("Shows Unknown license with links", () => {
expect(
- screen.getByText("License: Unknown").closest("a").href
- ).toContain("/license");
+ screen.getByText("Copyright: Unknown").closest("a").href
+ ).toContain("/copyright");
});
test("Shows Placeholder cover", () => {
expect(
@@ -483,10 +483,10 @@ describe("Renders Search Results Page", () => {
expect(
screen
.getByText(
- "License: Public Domain Public Domain Public Domain Public Domain Public Domain Public Domain Public Domain Public Domain Public Domain"
+ "Copyright: Public Domain Public Domain Public Domain Public Domain Public Domain Public Domain Public Domain Public Domain Public Domain"
)
.closest("a").href
- ).toContain("/license");
+ ).toContain("/copyright");
});
test("Shows cover", () => {
expect(
diff --git a/src/components/About/About.tsx b/src/components/About/About.tsx
index ce8d51b8..267953de 100644
--- a/src/components/About/About.tsx
+++ b/src/components/About/About.tsx
@@ -39,10 +39,10 @@ const About: React.FC = () => {
All the materials in Digital Research Books Beta are completely free to
read and most of them you can download and keep, with no library card
required. The books are either in the{" "}
- public domain, with no restrictions on your
+ public domain, with no restrictions on your
use of them, or under{" "}
- Creative Commons licences that may have some
- conditions, but only on redistribution or adaptation.
+ Creative Commons licences that may have
+ some conditions, but only on redistribution or adaptation.
Works in the public domain have no copyright (in most cases because the
@@ -159,6 +159,13 @@ const License: React.FC = () => {
, you may copy, distribute and modify the work as long as any
modifications are also made available under the GPL.
+ In Copyright
+
+ Works that are In Copyright are protected by copyright and/or related
+ rights. You are free to use this Item in any way that is permitted by
+ the copyright and related rights legislation that applies to your use.
+ For other uses you need to obtain permission from the rights-holder(s).
+
, you may copy, distribute and modify the work as long as any modifications are also made available under the GPL.
+
+ In Copyright
+
+
+ Works that are In Copyright are protected by copyright and/or related rights. You are free to use this Item in any way that is permitted by the copyright and related rights legislation that applies to your use. For other uses you need to obtain permission from the rights-holder(s).
+
diff --git a/src/components/EditionCard/CopyrightLink.tsx b/src/components/EditionCard/CopyrightLink.tsx
new file mode 100644
index 00000000..e26a85d9
--- /dev/null
+++ b/src/components/EditionCard/CopyrightLink.tsx
@@ -0,0 +1,15 @@
+import React from "react";
+import { Rights } from "~/src/types/DataModel";
+import Link from "~/src/components/Link/Link";
+
+const CopyrightLink: React.FC<{ rights: Rights[] }> = ({ rights }) => {
+ return (
+
+ {rights && rights.length > 0
+ ? `Copyright: ${rights[0].rightsStatement}`
+ : "Copyright: Unknown"}
+
+ );
+};
+
+export default CopyrightLink;
diff --git a/src/components/EditionCard/EditionCard.test.tsx b/src/components/EditionCard/EditionCard.test.tsx
index 5ab8fb91..7056aeb4 100644
--- a/src/components/EditionCard/EditionCard.test.tsx
+++ b/src/components/EditionCard/EditionCard.test.tsx
@@ -36,8 +36,8 @@ describe("Edition Card with Valid Data", () => {
});
test("Shows license with links", () => {
expect(
- screen.getByText("License: test rights statement").closest("a").href
- ).toContain("/license");
+ screen.getByText("Copyright: test rights statement").closest("a").href
+ ).toContain("/copyright");
});
test("Shows cover", () => {
expect(
@@ -79,8 +79,8 @@ describe("Edition Year with Minimal Data", () => {
expect(screen.getByText("Languages: Undetermined")).toBeInTheDocument();
});
test("Shows Unknown license with links", () => {
- expect(screen.getByText("License: Unknown").closest("a").href).toContain(
- "/license"
+ expect(screen.getByText("Copyright: Unknown").closest("a").href).toContain(
+ "/copyright"
);
});
test("Shows Placeholder cover", () => {
diff --git a/src/components/EditionCard/EditionCard.tsx b/src/components/EditionCard/EditionCard.tsx
index a5143e24..7e1f45c6 100644
--- a/src/components/EditionCard/EditionCard.tsx
+++ b/src/components/EditionCard/EditionCard.tsx
@@ -19,6 +19,7 @@ import FeaturedEditionBadge from "./FeaturedEditionBadge";
import PhysicalEditionBadge from "./PhysicalEditionBadge";
import ScanAndDeliverBlurb from "./ScanAndDeliverBlurb";
import UpBlurb from "./UpBlurb";
+import CopyrightLink from "./CopyrightLink";
export const EditionCard: React.FC<{
edition: WorkEdition;
@@ -114,9 +115,7 @@ export const EditionCard: React.FC<{
publishers={edition.publishers}
/>
-
- {EditionCardUtils.getLicense(previewItem)}
-
+
{isPhysicalEdition && }
{isUniversityPress && }
diff --git a/src/components/EditionDetail/Edition.test.tsx b/src/components/EditionDetail/Edition.test.tsx
index be8ae370..9eda8ba1 100644
--- a/src/components/EditionDetail/Edition.test.tsx
+++ b/src/components/EditionDetail/Edition.test.tsx
@@ -73,9 +73,9 @@ describe("Renders edition component when given valid edition", () => {
expect(screen.getAllByAltText("").length).toBe(2);
expect(
screen
- .getAllByText("License: Public Domain when viewed in the US")[0]
+ .getAllByText("Copyright: Public Domain when viewed in the US")[0]
.closest("a").href
- ).toContain("/license");
+ ).toContain("/copyright");
});
test("Featured Card, which has publisher 'Miller', shows up once", () => {
diff --git a/src/components/Feedback/Feedback.tsx b/src/components/Feedback/Feedback.tsx
index c8952859..1b8daba9 100644
--- a/src/components/Feedback/Feedback.tsx
+++ b/src/components/Feedback/Feedback.tsx
@@ -5,6 +5,7 @@ import { FeedbackContext } from "~/src/context/FeedbackContext";
const DEFAULT_DESCRIPTION_TEXT = "Please share your question or feedback.";
const ERROR_DESCRIPTION_TEXT = "We are here to help!";
+const ERROR_NOTIFICATION_TEXT = `You are asking for help or information about a page error.`;
const Feedback: React.FC = ({ location }) => {
const [view, setView] = useState("form");
@@ -18,14 +19,19 @@ const Feedback: React.FC = ({ location }) => {
onClose,
isError,
notificationText,
+ statusCode,
setIsError,
setNotificationText,
} = useContext(FeedbackContext);
useEffect(() => {
- if (isError) setDescriptionText(ERROR_DESCRIPTION_TEXT);
- else setDescriptionText(DEFAULT_DESCRIPTION_TEXT);
- }, [isError]);
+ if (isError) {
+ setDescriptionText(ERROR_DESCRIPTION_TEXT);
+ setNotificationText(ERROR_NOTIFICATION_TEXT);
+ } else {
+ setDescriptionText(DEFAULT_DESCRIPTION_TEXT);
+ }
+ }, [isError, setNotificationText]);
const onCloseAndReset = () => {
if (isError) setIsError(false);
@@ -38,7 +44,9 @@ const Feedback: React.FC = ({ location }) => {
values: React.ComponentProps["onSubmit"]
) => {
submitFeedback({
- feedback: values.comment,
+ feedback: isError
+ ? `Error Code: ${statusCode ?? "Unknown"} - ${values.comment}`
+ : values.comment,
category: isError ? "Bug" : values.category,
url: location,
email: values.email,
diff --git a/src/components/InstanceCard/InstanceCard.test.tsx b/src/components/InstanceCard/InstanceCard.test.tsx
index 41a0042e..bdac6220 100644
--- a/src/components/InstanceCard/InstanceCard.test.tsx
+++ b/src/components/InstanceCard/InstanceCard.test.tsx
@@ -40,8 +40,8 @@ describe("Instance Card with Valid Data", () => {
});
test("shows license", () => {
expect(
- screen.getByText("License: test rights statement").closest("a").href
- ).toContain("/license");
+ screen.getByText("Copyright: test rights statement").closest("a").href
+ ).toContain("/copyright");
});
});
@@ -74,8 +74,8 @@ describe("Instance Card with Minmal Data", () => {
);
});
test("shows license", () => {
- expect(screen.getByText("License: Unknown").closest("a").href).toContain(
- "/license"
+ expect(screen.getByText("Copyright: Unknown").closest("a").href).toContain(
+ "/copyright"
);
});
});
diff --git a/src/components/InstanceCard/InstanceCard.tsx b/src/components/InstanceCard/InstanceCard.tsx
index 2a7a52ba..d26f9cb6 100644
--- a/src/components/InstanceCard/InstanceCard.tsx
+++ b/src/components/InstanceCard/InstanceCard.tsx
@@ -10,7 +10,6 @@ import {
Flex,
} from "@nypl/design-system-react-components";
import EditionCardUtils from "~/src/util/EditionCardUtils";
-import Link from "../Link/Link";
import Ctas from "../EditionCard/Ctas";
import PublisherAndLocation from "../EditionCard/PublisherAndLocation";
import WorldCat from "./WorldCat";
@@ -19,6 +18,7 @@ import FeaturedEditionBadge from "../EditionCard/FeaturedEditionBadge";
import PhysicalEditionBadge from "../EditionCard/PhysicalEditionBadge";
import ScanAndDeliverBlurb from "../EditionCard/ScanAndDeliverBlurb";
import UpBlurb from "../EditionCard/UpBlurb";
+import CopyrightLink from "../EditionCard/CopyrightLink";
// Creates an Instance card out of the Edition Year and Instance object
// Note: Edition Year only needs to be passed because `instance.publication_date`
@@ -94,7 +94,7 @@ export const InstanceCard: React.FC<{
/>
- {EditionCardUtils.getLicense(previewItem)}
+
{isPhysicalEdition && }
{isUniversityPress && }
diff --git a/src/components/License/License.test.tsx b/src/components/License/License.test.tsx
deleted file mode 100644
index 10f21189..00000000
--- a/src/components/License/License.test.tsx
+++ /dev/null
@@ -1,8 +0,0 @@
-import React from "react";
-import { render } from "~/src/__tests__/testUtils/render";
-import License from "./License";
-
-it("renders License page unchanged", async () => {
- const tree = render();
- expect(tree.container.firstChild).toMatchSnapshot();
-});
diff --git a/src/components/Work/Work.test.tsx b/src/components/Work/Work.test.tsx
index 662ac6a4..abb00858 100644
--- a/src/components/Work/Work.test.tsx
+++ b/src/components/Work/Work.test.tsx
@@ -76,8 +76,8 @@ describe("Renders Work component when given valid work", () => {
).toBe(1);
expect(screen.getAllByText("Languages: English, German").length).toBe(1);
expect(
- screen.getAllByText("License: Unknown")[0].closest("a").href
- ).toContain("/license");
+ screen.getAllByText("Copyright: Unknown")[0].closest("a").href
+ ).toContain("/copyright");
});
test("Shows Details Table", () => {
expect(
diff --git a/src/constants/analytics.ts b/src/constants/analytics.ts
index 68feb1d5..d787b3e4 100644
--- a/src/constants/analytics.ts
+++ b/src/constants/analytics.ts
@@ -3,7 +3,7 @@ export const SITE_SECTION = "Digital Research Books";
export const pageNames = {
home: "drb|home",
about: "drb|about",
- license: "drb|license",
+ copyright: "drb|copyright",
advancedSearch: "drb|advanced-search",
search: "drb|search|?",
workItem: "drb|work|",
diff --git a/src/context/FeedbackContext.tsx b/src/context/FeedbackContext.tsx
index 5c739612..1a95a1a5 100644
--- a/src/context/FeedbackContext.tsx
+++ b/src/context/FeedbackContext.tsx
@@ -12,6 +12,8 @@ type FeedbackContextType = {
setIsError: React.Dispatch>;
notificationText: string | null;
setNotificationText: React.Dispatch>;
+ statusCode: number | null;
+ setStatusCode: React.Dispatch>;
};
export const FeedbackContext = createContext(
@@ -24,6 +26,7 @@ export const FeedbackProvider: React.FC<{
const { FeedbackBox, isOpen, onOpen, onClose } = useFeedbackBox();
const [isError, setIsError] = useState(null);
const [notificationText, setNotificationText] = useState(null);
+ const [statusCode, setStatusCode] = useState(null);
return (
{children}
diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx
index 7c5385bd..f01ee5c7 100644
--- a/src/pages/_app.tsx
+++ b/src/pages/_app.tsx
@@ -66,8 +66,8 @@ const sendAnalytics = (query: any, pathname: string) => {
trackPageview(pageNames.advancedSearch);
} else if (pathname === "/about") {
trackPageview(pageNames.about);
- } else if (pathname === "/license") {
- trackPageview(pageNames.license);
+ } else if (pathname === "/copyright") {
+ trackPageview(pageNames.copyright);
} else {
trackPageview(pageNames.home);
}
diff --git a/src/pages/_error.tsx b/src/pages/_error.tsx
index 7177e3a3..12737eb2 100644
--- a/src/pages/_error.tsx
+++ b/src/pages/_error.tsx
@@ -14,26 +14,19 @@ import { FeedbackContext } from "../context/FeedbackContext";
const ERROR_PERSISTS = " if the error persists.";
-const getNotificationText = (statusCode) => {
- return `You are asking for help or information about a page error (error code ${statusCode})`;
-};
-
const errorMap = {
500: {
- overline: "error 500",
heading: "Something went wrong on our end.",
subText: "We encountered an error while trying to load the page. ",
tryText: "Try refreshing the page or ",
},
404: {
- overline: "error 404",
heading: "We couldn't find that page.",
subText:
"The page you were looking for doesn't exist or may have moved elsewhere. ",
tryText: "Try a different URL or ",
},
400: {
- overline: "error 400",
heading: "There was an unexpected error.",
subText: "We couldn't process your request at this time. ",
tryText: "Try again later or ",
@@ -41,21 +34,28 @@ const errorMap = {
};
const Error = ({ statusCode }) => {
- const { onOpen, isError, setNotificationText, setIsError } =
+ const { onOpen, isError, setIsError, setStatusCode } =
useContext(FeedbackContext);
useEffect(() => {
if (!isError) {
setIsError(true);
- setNotificationText(getNotificationText(statusCode));
+ setStatusCode(statusCode);
}
- }, [isError, setIsError, setNotificationText, statusCode]);
+ }, [isError, setIsError, setStatusCode, statusCode]);
+
+ // default to 400 messages for unexpected error codes
+ const errorValues = errorMap[statusCode]
+ ? errorMap[statusCode]
+ : errorMap[400];
return (
@@ -63,19 +63,18 @@ const Error = ({ statusCode }) => {
src="/images/error-img.png"
alt=""
marginBottom="xl"
- marginTop="xxxl"
+ marginTop={{ base: "xl", md: "xxxl" }}
width={100}
/>
- {errorMap[statusCode].overline}
- {errorMap[statusCode].heading}
+ {errorValues.heading}
- {errorMap[statusCode].subText}
+ {errorValues.subText}
- {errorMap[statusCode].tryText}
+ {errorValues.tryText}
{ERROR_PERSISTS}
-
+
Back to Digital Research Books
diff --git a/src/pages/copyright.tsx b/src/pages/copyright.tsx
new file mode 100644
index 00000000..873c0956
--- /dev/null
+++ b/src/pages/copyright.tsx
@@ -0,0 +1,12 @@
+import React from "react";
+import Copyright from "~/src/components/Copyright/Copyright";
+import Layout from "~/src/components/Layout/Layout";
+
+const CopyrightPage: React.FC = () => {
+ return (
+
+
+
+ );
+};
+export default CopyrightPage;
diff --git a/src/pages/license.tsx b/src/pages/license.tsx
deleted file mode 100644
index 2664efda..00000000
--- a/src/pages/license.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import React from "react";
-import License from "~/src/components/License/License";
-import Layout from "~/src/components/Layout/Layout";
-
-const LicensePage: React.FC = () => {
- return (
-
-
-
- );
-};
-export default LicensePage;
diff --git a/src/util/EditionCardUtils.tsx b/src/util/EditionCardUtils.tsx
index 3849fc38..be0e88cb 100644
--- a/src/util/EditionCardUtils.tsx
+++ b/src/util/EditionCardUtils.tsx
@@ -134,8 +134,8 @@ export default class EditionCardUtils {
// Rights
static getLicense(item: ApiItem): string {
return item && item.rights && item.rights.length > 0
- ? `License: ${item.rights[0].rightsStatement}`
- : "License: Unknown";
+ ? `Copyright: ${item.rights[0].rightsStatement}`
+ : "Copyright: Unknown";
}
static getReadLink = (item: ApiItem, type: "reader" | "embed"): ItemLink => {