Skip to content

Commit

Permalink
Merge pull request #535 from NYPL/SFR-2236/edition-license-link
Browse files Browse the repository at this point in the history
SFR-2236: Update license link to copyright
  • Loading branch information
jackiequach authored Oct 9, 2024
2 parents ed7dd65 + 0630135 commit 74c0893
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 26 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,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]
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/Search.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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("/copyright");
});
test("Shows cover", () => {
Expand Down Expand Up @@ -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("/copyright");
});
test("Shows Placeholder cover", () => {
Expand Down Expand Up @@ -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("/copyright");
Expand Down
2 changes: 1 addition & 1 deletion src/components/Collection/Collection.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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("/copyright");
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
"/copyright"
);
});
Expand Down
4 changes: 2 additions & 2 deletions src/components/CollectionItemCard/CollectionItemCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -56,7 +56,7 @@ export const CollectionItemCard: React.FC<{
publisher={publisher}
/>
<LanguageDisplayText language={language} />
<LicenseLink rights={rights} />
<CopyrightLink rights={rights} />
</CardContent>
<CardActions display="flex" flexDir="column" whiteSpace="nowrap" gap={4}>
<Ctas
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Link to="/copyright">
{rights ? `License: ${rights.rightsStatement}` : "License: Unknown"}
{rights ? `Copyright: ${rights.rightsStatement}` : "Copyright: Unknown"}
</Link>
);
};

export default LicenseLink;
export default CopyrightLink;
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ 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 (
<Link to="/copyright">
{rights && rights.length > 0
? `License: ${rights[0].rightsStatement}`
: "License: Unknown"}
? `Copyright: ${rights[0].rightsStatement}`
: "Copyright: Unknown"}
</Link>
);
};

export default LicenseLink;
export default CopyrightLink;
4 changes: 2 additions & 2 deletions src/components/EditionCard/EditionCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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("/copyright");
});
test("Shows cover", () => {
Expand Down Expand Up @@ -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(
"/copyright"
);
});
Expand Down
4 changes: 2 additions & 2 deletions src/components/EditionCard/EditionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import FeaturedEditionBadge from "./FeaturedEditionBadge";
import PhysicalEditionBadge from "./PhysicalEditionBadge";
import ScanAndDeliverBlurb from "./ScanAndDeliverBlurb";
import UpBlurb from "./UpBlurb";
import LicenseLink from "./LicenseLink";
import CopyrightLink from "./CopyrightLink";

export const EditionCard: React.FC<{
edition: WorkEdition;
Expand Down Expand Up @@ -115,7 +115,7 @@ export const EditionCard: React.FC<{
publishers={edition.publishers}
/>
<LanguageDisplayText edition={edition} />
<LicenseLink rights={previewItem?.rights} />
<CopyrightLink rights={previewItem?.rights} />
</Box>
{isPhysicalEdition && <ScanAndDeliverBlurb />}
{isUniversityPress && <UpBlurb publishers={edition.publishers} />}
Expand Down
2 changes: 1 addition & 1 deletion src/components/EditionDetail/Edition.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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("/copyright");
});
Expand Down
4 changes: 2 additions & 2 deletions src/components/InstanceCard/InstanceCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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("/copyright");
});
});
Expand Down Expand Up @@ -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(
"/copyright"
);
});
Expand Down
4 changes: 2 additions & 2 deletions src/components/InstanceCard/InstanceCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +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";
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`
Expand Down Expand Up @@ -94,7 +94,7 @@ export const InstanceCard: React.FC<{
/>
</div>
<WorldCat instance={instance} />
<LicenseLink rights={previewItem?.rights} />
<CopyrightLink rights={previewItem?.rights} />
{isPhysicalEdition && <ScanAndDeliverBlurb />}
{isUniversityPress && <UpBlurb publishers={edition.publishers} />}
</CardContent>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Work/Work.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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("/copyright");
});
test("Shows Details Table", () => {
Expand Down
4 changes: 2 additions & 2 deletions src/util/EditionCardUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down

0 comments on commit 74c0893

Please sign in to comment.