From 4b74b2b908a54d876c90c812a2b7ed251226b5da Mon Sep 17 00:00:00 2001 From: Jackie Quach Date: Tue, 8 Oct 2024 11:40:47 -0400 Subject: [PATCH 1/2] update license to copyright --- CHANGELOG.md | 4 ++++ src/__tests__/Search.test.tsx | 6 +++--- src/components/Collection/Collection.test.tsx | 2 +- .../CollectionItemCard/CollectionItemCard.test.tsx | 2 +- .../{LicenseLink.tsx => CopyrightLink.tsx} | 6 +++--- src/components/EditionCard/EditionCard.test.tsx | 4 ++-- src/components/EditionDetail/Edition.test.tsx | 2 +- src/components/InstanceCard/InstanceCard.test.tsx | 4 ++-- src/components/Work/Work.test.tsx | 2 +- src/util/EditionCardUtils.tsx | 4 ++-- 10 files changed, 20 insertions(+), 16 deletions(-) rename src/components/CollectionItemCard/{LicenseLink.tsx => CopyrightLink.tsx} (50%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53dec348..e72e110f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGE LOG +## [Prerelease] + +- Update license link for editions, works, and collections to copyright + ## [0.18.3] - Fix error when collections are empty diff --git a/src/__tests__/Search.test.tsx b/src/__tests__/Search.test.tsx index 7244e2f8..1664aaef 100644 --- a/src/__tests__/Search.test.tsx +++ b/src/__tests__/Search.test.tsx @@ -366,7 +366,7 @@ describe("Renders Search Results Page", () => { }); test("Shows license with links", () => { expect( - screen.getByText("License: Public Domain").closest("a").href + screen.getByText("Copyright: Public Domain").closest("a").href ).toContain("/license"); }); test("Shows cover", () => { @@ -415,7 +415,7 @@ describe("Renders Search Results Page", () => { }); test("Shows Unknown license with links", () => { expect( - screen.getByText("License: Unknown").closest("a").href + screen.getByText("Copyright: Unknown").closest("a").href ).toContain("/license"); }); test("Shows Placeholder cover", () => { @@ -483,7 +483,7 @@ 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"); diff --git a/src/components/Collection/Collection.test.tsx b/src/components/Collection/Collection.test.tsx index 70584cc6..98eda176 100644 --- a/src/components/Collection/Collection.test.tsx +++ b/src/components/Collection/Collection.test.tsx @@ -99,7 +99,7 @@ describe("Renders Collection Page", () => { }); test("Shows license with links", () => { expect( - screen.getByText("License: Public Domain").closest("a").href + screen.getByText("Copyright: Public Domain").closest("a").href ).toContain("/license"); }); }); diff --git a/src/components/CollectionItemCard/CollectionItemCard.test.tsx b/src/components/CollectionItemCard/CollectionItemCard.test.tsx index 91276337..33a6ce78 100644 --- a/src/components/CollectionItemCard/CollectionItemCard.test.tsx +++ b/src/components/CollectionItemCard/CollectionItemCard.test.tsx @@ -29,7 +29,7 @@ describe("Collection Item Card", () => { ); }); test("shows license", () => { - expect(screen.getByText("License: Unknown").closest("a").href).toContain( + expect(screen.getByText("Copyright: Unknown").closest("a").href).toContain( "/license" ); }); diff --git a/src/components/CollectionItemCard/LicenseLink.tsx b/src/components/CollectionItemCard/CopyrightLink.tsx similarity index 50% rename from src/components/CollectionItemCard/LicenseLink.tsx rename to src/components/CollectionItemCard/CopyrightLink.tsx index 8d6da98a..e3ebdc79 100644 --- a/src/components/CollectionItemCard/LicenseLink.tsx +++ b/src/components/CollectionItemCard/CopyrightLink.tsx @@ -2,12 +2,12 @@ import React from "react"; import { Rights } from "~/src/types/DataModel"; import Link from "~/src/components/Link/Link"; -const LicenseLink: React.FC<{ rights: Rights }> = ({ rights }) => { +const CopyrightLink: React.FC<{ rights: Rights }> = ({ rights }) => { return ( - {rights ? `License: ${rights.rightsStatement}` : "License: Unknown"} + {rights ? `Copyright: ${rights.rightsStatement}` : "Copyright: Unknown"} ); }; -export default LicenseLink; +export default CopyrightLink; diff --git a/src/components/EditionCard/EditionCard.test.tsx b/src/components/EditionCard/EditionCard.test.tsx index 5ab8fb91..f50b9644 100644 --- a/src/components/EditionCard/EditionCard.test.tsx +++ b/src/components/EditionCard/EditionCard.test.tsx @@ -36,7 +36,7 @@ describe("Edition Card with Valid Data", () => { }); test("Shows license with links", () => { expect( - screen.getByText("License: test rights statement").closest("a").href + screen.getByText("Copyright: test rights statement").closest("a").href ).toContain("/license"); }); test("Shows cover", () => { @@ -79,7 +79,7 @@ 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( + expect(screen.getByText("Copyright: Unknown").closest("a").href).toContain( "/license" ); }); diff --git a/src/components/EditionDetail/Edition.test.tsx b/src/components/EditionDetail/Edition.test.tsx index be8ae370..07800aa9 100644 --- a/src/components/EditionDetail/Edition.test.tsx +++ b/src/components/EditionDetail/Edition.test.tsx @@ -73,7 +73,7 @@ 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"); }); diff --git a/src/components/InstanceCard/InstanceCard.test.tsx b/src/components/InstanceCard/InstanceCard.test.tsx index 41a0042e..18d1bbae 100644 --- a/src/components/InstanceCard/InstanceCard.test.tsx +++ b/src/components/InstanceCard/InstanceCard.test.tsx @@ -40,7 +40,7 @@ describe("Instance Card with Valid Data", () => { }); test("shows license", () => { expect( - screen.getByText("License: test rights statement").closest("a").href + screen.getByText("Copyright: test rights statement").closest("a").href ).toContain("/license"); }); }); @@ -74,7 +74,7 @@ describe("Instance Card with Minmal Data", () => { ); }); test("shows license", () => { - expect(screen.getByText("License: Unknown").closest("a").href).toContain( + expect(screen.getByText("Copyright: Unknown").closest("a").href).toContain( "/license" ); }); diff --git a/src/components/Work/Work.test.tsx b/src/components/Work/Work.test.tsx index 662ac6a4..02eaba07 100644 --- a/src/components/Work/Work.test.tsx +++ b/src/components/Work/Work.test.tsx @@ -76,7 +76,7 @@ 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 + screen.getAllByText("Copyright: Unknown")[0].closest("a").href ).toContain("/license"); }); test("Shows Details Table", () => { 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 => { From d16abac29adcce942e7342d5ac0a53f9365bfc9e Mon Sep 17 00:00:00 2001 From: Jackie Quach Date: Tue, 8 Oct 2024 11:42:44 -0400 Subject: [PATCH 2/2] fix typo --- src/components/CollectionItemCard/CollectionItemCard.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/CollectionItemCard/CollectionItemCard.tsx b/src/components/CollectionItemCard/CollectionItemCard.tsx index 93abd1af..e5b7cb61 100644 --- a/src/components/CollectionItemCard/CollectionItemCard.tsx +++ b/src/components/CollectionItemCard/CollectionItemCard.tsx @@ -12,7 +12,7 @@ import CollectionUtils from "~/src/util/CollectionUtils"; import Ctas from "~/src/components/CollectionItemCard/Ctas"; import EditionYear from "~/src/components/CollectionItemCard/EditionYear"; import PublisherAndLocation from "~/src/components/CollectionItemCard/PublisherAndLocation"; -import LicenseLink from "~/src/components/CollectionItemCard/LicenseLink"; +import CopyrightLink from "~/src/components/CollectionItemCard/CopyrightLink"; import LanguageDisplayText from "~/src/components/CollectionItemCard/LanguageDisplayText"; // Creates an Collection item card out of the collectionItem object @@ -56,7 +56,7 @@ export const CollectionItemCard: React.FC<{ publisher={publisher} /> - +