From e106e34b382dfc0e81b4b9593b6a5f19e6aa89d5 Mon Sep 17 00:00:00 2001
From: Jackie Quach
Date: Thu, 3 Oct 2024 15:29:45 -0400
Subject: [PATCH 1/2] update license page to copyright
---
CHANGELOG.md | 4 +++
playwright/support/mappings.ts | 6 ++---
src/__tests__/Search.test.tsx | 6 ++---
src/components/About/About.tsx | 6 ++---
.../About/__snapshots__/About.test.tsx.snap | 4 +--
src/components/Collection/Collection.test.tsx | 2 +-
.../CollectionItemCard.test.tsx | 2 +-
.../CollectionItemCard/LicenseLink.tsx | 2 +-
.../Copyright.test.tsx} | 6 ++---
.../License.tsx => Copyright/Copyright.tsx} | 19 +++++++++++---
.../__snapshots__/Copyright.test.tsx.snap} | 25 ++++++++++++++++---
.../EditionCard/EditionCard.test.tsx | 4 +--
src/components/EditionCard/EditionCard.tsx | 5 ++--
src/components/EditionCard/LicenseLink.tsx | 15 +++++++++++
src/components/EditionDetail/Edition.test.tsx | 2 +-
.../InstanceCard/InstanceCard.test.tsx | 4 +--
src/components/InstanceCard/InstanceCard.tsx | 4 +--
src/components/Work/Work.test.tsx | 2 +-
src/constants/analytics.ts | 2 +-
src/pages/_app.tsx | 4 +--
src/pages/copyright.tsx | 12 +++++++++
src/pages/license.tsx | 12 ---------
22 files changed, 97 insertions(+), 51 deletions(-)
rename src/components/{License/License.test.tsx => Copyright/Copyright.test.tsx} (53%)
rename src/components/{License/License.tsx => Copyright/Copyright.tsx} (88%)
rename src/components/{License/__snapshots__/License.test.tsx.snap => Copyright/__snapshots__/Copyright.test.tsx.snap} (92%)
create mode 100644 src/components/EditionCard/LicenseLink.tsx
create mode 100644 src/pages/copyright.tsx
delete mode 100644 src/pages/license.tsx
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 53dec348..b7adf958 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
# CHANGE LOG
+## [Prerelease]
+
+- Update License page to Copyright and add section for "In Copyright" explanation
+
## [0.18.3]
- Fix error when collections are empty
diff --git a/playwright/support/mappings.ts b/playwright/support/mappings.ts
index 6bc5af40..4e20ea76 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",
diff --git a/src/__tests__/Search.test.tsx b/src/__tests__/Search.test.tsx
index 7244e2f8..e0278282 100644
--- a/src/__tests__/Search.test.tsx
+++ b/src/__tests__/Search.test.tsx
@@ -367,7 +367,7 @@ describe("Renders Search Results Page", () => {
test("Shows license with links", () => {
expect(
screen.getByText("License: Public Domain").closest("a").href
- ).toContain("/license");
+ ).toContain("/copyright");
});
test("Shows cover", () => {
expect(
@@ -416,7 +416,7 @@ describe("Renders Search Results Page", () => {
test("Shows Unknown license with links", () => {
expect(
screen.getByText("License: Unknown").closest("a").href
- ).toContain("/license");
+ ).toContain("/copyright");
});
test("Shows Placeholder cover", () => {
expect(
@@ -486,7 +486,7 @@ describe("Renders Search Results Page", () => {
"License: 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.
diff --git a/src/components/About/__snapshots__/About.test.tsx.snap b/src/components/About/__snapshots__/About.test.tsx.snap
index a3429adc..85fea51a 100644
--- a/src/components/About/__snapshots__/About.test.tsx.snap
+++ b/src/components/About/__snapshots__/About.test.tsx.snap
@@ -142,7 +142,7 @@ exports[`renders about unchanged 1`] = `
public domain
@@ -150,7 +150,7 @@ exports[`renders about unchanged 1`] = `
Creative Commons licences
diff --git a/src/components/Collection/Collection.test.tsx b/src/components/Collection/Collection.test.tsx
index 70584cc6..ce148c46 100644
--- a/src/components/Collection/Collection.test.tsx
+++ b/src/components/Collection/Collection.test.tsx
@@ -100,7 +100,7 @@ describe("Renders Collection Page", () => {
test("Shows license with links", () => {
expect(
screen.getByText("License: Public Domain").closest("a").href
- ).toContain("/license");
+ ).toContain("/copyright");
});
});
});
diff --git a/src/components/CollectionItemCard/CollectionItemCard.test.tsx b/src/components/CollectionItemCard/CollectionItemCard.test.tsx
index 91276337..c16250d1 100644
--- a/src/components/CollectionItemCard/CollectionItemCard.test.tsx
+++ b/src/components/CollectionItemCard/CollectionItemCard.test.tsx
@@ -30,7 +30,7 @@ describe("Collection Item Card", () => {
});
test("shows license", () => {
expect(screen.getByText("License: Unknown").closest("a").href).toContain(
- "/license"
+ "/copyright"
);
});
});
diff --git a/src/components/CollectionItemCard/LicenseLink.tsx b/src/components/CollectionItemCard/LicenseLink.tsx
index 8d6da98a..fcafd79d 100644
--- a/src/components/CollectionItemCard/LicenseLink.tsx
+++ b/src/components/CollectionItemCard/LicenseLink.tsx
@@ -4,7 +4,7 @@ import Link from "~/src/components/Link/Link";
const LicenseLink: React.FC<{ rights: Rights }> = ({ rights }) => {
return (
-
+
{rights ? `License: ${rights.rightsStatement}` : "License: Unknown"}
);
diff --git a/src/components/License/License.test.tsx b/src/components/Copyright/Copyright.test.tsx
similarity index 53%
rename from src/components/License/License.test.tsx
rename to src/components/Copyright/Copyright.test.tsx
index 10f21189..b19a4806 100644
--- a/src/components/License/License.test.tsx
+++ b/src/components/Copyright/Copyright.test.tsx
@@ -1,8 +1,8 @@
import React from "react";
import { render } from "~/src/__tests__/testUtils/render";
-import License from "./License";
+import Copyright from "./Copyright";
-it("renders License page unchanged", async () => {
- const tree = render();
+it("renders Copyright page unchanged", async () => {
+ const tree = render();
expect(tree.container.firstChild).toMatchSnapshot();
});
diff --git a/src/components/License/License.tsx b/src/components/Copyright/Copyright.tsx
similarity index 88%
rename from src/components/License/License.tsx
rename to src/components/Copyright/Copyright.tsx
index 79ae2ca5..5f9a8d2f 100644
--- a/src/components/License/License.tsx
+++ b/src/components/Copyright/Copyright.tsx
@@ -8,13 +8,13 @@ import {
import Link from "../Link/Link";
import DrbBreakout from "../DrbBreakout/DrbBreakout";
-const License: React.FC = () => {
+const Copyright: React.FC = () => {
const breakoutElement = (
-
+
);
const contentPrimaryElement = (
<>
- License Explanations
+ Copyright ExplanationsPublic Domain
Works in the public domain have no copyright (in most cases because the
@@ -159,6 +159,17 @@ 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/EditionCard.test.tsx b/src/components/EditionCard/EditionCard.test.tsx
index 5ab8fb91..ca68df12 100644
--- a/src/components/EditionCard/EditionCard.test.tsx
+++ b/src/components/EditionCard/EditionCard.test.tsx
@@ -37,7 +37,7 @@ describe("Edition Card with Valid Data", () => {
test("Shows license with links", () => {
expect(
screen.getByText("License: test rights statement").closest("a").href
- ).toContain("/license");
+ ).toContain("/copyright");
});
test("Shows cover", () => {
expect(
@@ -80,7 +80,7 @@ describe("Edition Year with Minimal Data", () => {
});
test("Shows Unknown license with links", () => {
expect(screen.getByText("License: Unknown").closest("a").href).toContain(
- "/license"
+ "/copyright"
);
});
test("Shows Placeholder cover", () => {
diff --git a/src/components/EditionCard/EditionCard.tsx b/src/components/EditionCard/EditionCard.tsx
index a5143e24..1dd58e06 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 LicenseLink from "./LicenseLink";
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/EditionCard/LicenseLink.tsx b/src/components/EditionCard/LicenseLink.tsx
new file mode 100644
index 00000000..590ba7bd
--- /dev/null
+++ b/src/components/EditionCard/LicenseLink.tsx
@@ -0,0 +1,15 @@
+import React from "react";
+import { Rights } from "~/src/types/DataModel";
+import Link from "~/src/components/Link/Link";
+
+const LicenseLink: React.FC<{ rights: Rights[] }> = ({ rights }) => {
+ return (
+
+ {rights && rights.length > 0
+ ? `License: ${rights[0].rightsStatement}`
+ : "License: Unknown"}
+
+ );
+};
+
+export default LicenseLink;
diff --git a/src/components/EditionDetail/Edition.test.tsx b/src/components/EditionDetail/Edition.test.tsx
index be8ae370..00e157d7 100644
--- a/src/components/EditionDetail/Edition.test.tsx
+++ b/src/components/EditionDetail/Edition.test.tsx
@@ -75,7 +75,7 @@ describe("Renders edition component when given valid edition", () => {
screen
.getAllByText("License: 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/InstanceCard/InstanceCard.test.tsx b/src/components/InstanceCard/InstanceCard.test.tsx
index 41a0042e..cd02e204 100644
--- a/src/components/InstanceCard/InstanceCard.test.tsx
+++ b/src/components/InstanceCard/InstanceCard.test.tsx
@@ -41,7 +41,7 @@ describe("Instance Card with Valid Data", () => {
test("shows license", () => {
expect(
screen.getByText("License: test rights statement").closest("a").href
- ).toContain("/license");
+ ).toContain("/copyright");
});
});
@@ -75,7 +75,7 @@ describe("Instance Card with Minmal Data", () => {
});
test("shows license", () => {
expect(screen.getByText("License: Unknown").closest("a").href).toContain(
- "/license"
+ "/copyright"
);
});
});
diff --git a/src/components/InstanceCard/InstanceCard.tsx b/src/components/InstanceCard/InstanceCard.tsx
index 2a7a52ba..0b53078f 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 LicenseLink from "../EditionCard/LicenseLink";
// 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/Work/Work.test.tsx b/src/components/Work/Work.test.tsx
index 662ac6a4..d1194aea 100644
--- a/src/components/Work/Work.test.tsx
+++ b/src/components/Work/Work.test.tsx
@@ -77,7 +77,7 @@ describe("Renders Work component when given valid work", () => {
expect(screen.getAllByText("Languages: English, German").length).toBe(1);
expect(
screen.getAllByText("License: Unknown")[0].closest("a").href
- ).toContain("/license");
+ ).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/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/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;
From 5b6ab559d30722aea8839926d6ea48adce77037d Mon Sep 17 00:00:00 2001
From: Jackie Quach
Date: Mon, 7 Oct 2024 16:27:23 -0400
Subject: [PATCH 2/2] updates based on feedback
---
src/components/Copyright/Copyright.test.tsx | 69 +++++++++++++++++++
src/components/Copyright/Copyright.tsx | 12 ++--
.../__snapshots__/Copyright.test.tsx.snap | 11 +--
3 files changed, 74 insertions(+), 18 deletions(-)
diff --git a/src/components/Copyright/Copyright.test.tsx b/src/components/Copyright/Copyright.test.tsx
index b19a4806..5c5b085c 100644
--- a/src/components/Copyright/Copyright.test.tsx
+++ b/src/components/Copyright/Copyright.test.tsx
@@ -1,8 +1,77 @@
import React from "react";
import { render } from "~/src/__tests__/testUtils/render";
+import { screen } from "@testing-library/react";
import Copyright from "./Copyright";
it("renders Copyright page unchanged", async () => {
const tree = render();
expect(tree.container.firstChild).toMatchSnapshot();
});
+
+describe("Copyright Page", () => {
+ beforeEach(() => {
+ render();
+ });
+
+ it("renders the Copyright Explanations heading", () => {
+ expect(
+ screen.getByRole("heading", { name: "Copyright Explanations" })
+ ).toBeInTheDocument();
+ });
+
+ it("renders the Public Domain headings", () => {
+ expect(
+ screen.getByRole("heading", { name: "Public Domain" })
+ ).toBeInTheDocument();
+ expect(
+ screen.getByRole("heading", { name: "Public Domain (US Only)" })
+ ).toBeInTheDocument();
+ });
+
+ it("renders the Creative Commons section", () => {
+ expect(
+ screen.getByRole("heading", { name: "Creative Commons Licenses" })
+ ).toBeInTheDocument();
+
+ expect(
+ screen.getByRole("link", { name: "Creative Commons licenses" })
+ ).toHaveAttribute("href", "https://creativecommons.org/");
+
+ expect(
+ screen.getByRole("link", { name: "Attribution 3.0 Unported (CC BY 3.0)" })
+ ).toHaveAttribute("href", "https://creativecommons.org/licenses/by/3.0/");
+ });
+
+ it("renders the CC0 section", () => {
+ expect(
+ screen.getByRole("heading", { name: "CC0 Public Domain Dedication" })
+ ).toBeInTheDocument();
+
+ expect(
+ screen.getByRole("link", {
+ name: "CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
+ })
+ ).toHaveAttribute(
+ "href",
+ "https://creativecommons.org/publicdomain/zero/1.0/"
+ );
+ });
+
+ it("renders the GNU section", () => {
+ expect(
+ screen.getByRole("heading", { name: "GNU General Public License" })
+ ).toBeInTheDocument();
+
+ expect(
+ screen.getByRole("link", {
+ name: "GNU General Public License",
+ })
+ ).toHaveAttribute("href", "http://www.gnu.org/licenses/gpl.html");
+ });
+
+ it("renders the In Copyright heading", () => {
+ expect(
+ screen.getByRole("heading", { name: "In Copyright" })
+ ).toBeInTheDocument();
+ });
+});
diff --git a/src/components/Copyright/Copyright.tsx b/src/components/Copyright/Copyright.tsx
index 5f9a8d2f..e60bb9fe 100644
--- a/src/components/Copyright/Copyright.tsx
+++ b/src/components/Copyright/Copyright.tsx
@@ -161,14 +161,10 @@ const Copyright: React.FC = () => {
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).
+ 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).
- 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).
+ 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).