diff --git a/CHANGELOG.md b/CHANGELOG.md index e72e110f..477be20c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [Prerelease] - Update license link for editions, works, and collections to copyright +- Update License page to Copyright and add section for "In Copyright" explanation ## [0.18.3] 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 1664aaef..8bd0c899 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("Copyright: 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("Copyright: Unknown").closest("a").href - ).toContain("/license"); + ).toContain("/copyright"); }); test("Shows Placeholder cover", () => { expect( @@ -486,7 +486,7 @@ describe("Renders Search Results Page", () => { "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.

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 98eda176..1551e06d 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("Copyright: 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 33a6ce78..83abb2b6 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("Copyright: Unknown").closest("a").href).toContain( - "/license" + "/copyright" ); }); }); diff --git a/src/components/CollectionItemCard/CopyrightLink.tsx b/src/components/CollectionItemCard/CopyrightLink.tsx index e3ebdc79..1a6e8d5f 100644 --- a/src/components/CollectionItemCard/CopyrightLink.tsx +++ b/src/components/CollectionItemCard/CopyrightLink.tsx @@ -4,7 +4,7 @@ import Link from "~/src/components/Link/Link"; const CopyrightLink: React.FC<{ rights: Rights }> = ({ rights }) => { return ( - + {rights ? `Copyright: ${rights.rightsStatement}` : "Copyright: Unknown"} ); diff --git a/src/components/Copyright/Copyright.test.tsx b/src/components/Copyright/Copyright.test.tsx new file mode 100644 index 00000000..5c5b085c --- /dev/null +++ b/src/components/Copyright/Copyright.test.tsx @@ -0,0 +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/License/License.tsx b/src/components/Copyright/Copyright.tsx similarity index 90% rename from src/components/License/License.tsx rename to src/components/Copyright/Copyright.tsx index 79ae2ca5..e60bb9fe 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 Explanations Public Domain

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). +

); return ( @@ -169,4 +176,4 @@ const License: React.FC = () => { ); }; -export default License; +export default Copyright; diff --git a/src/components/License/__snapshots__/License.test.tsx.snap b/src/components/Copyright/__snapshots__/Copyright.test.tsx.snap similarity index 94% rename from src/components/License/__snapshots__/License.test.tsx.snap rename to src/components/Copyright/__snapshots__/Copyright.test.tsx.snap index 0df0e614..eb5b9c52 100644 --- a/src/components/License/__snapshots__/License.test.tsx.snap +++ b/src/components/Copyright/__snapshots__/Copyright.test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`renders License page unchanged 1`] = ` +exports[`renders Copyright page unchanged 1`] = `
@@ -101,12 +101,12 @@ exports[`renders License page unchanged 1`] = ` - License + Copyright @@ -124,7 +124,7 @@ exports[`renders License page unchanged 1`] = `

- License Explanations + Copyright Explanations

, 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 f50b9644..7056aeb4 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("Copyright: 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("Copyright: 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..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 07800aa9..9eda8ba1 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("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/InstanceCard/InstanceCard.test.tsx b/src/components/InstanceCard/InstanceCard.test.tsx index 18d1bbae..bdac6220 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("Copyright: 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("Copyright: Unknown").closest("a").href).toContain( - "/license" + "/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 02eaba07..abb00858 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("Copyright: 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;