Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SFR-2236: Update license link to copyright #535

Merged
merged 3 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
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("/license");
});
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("/license");
});
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("/license");
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("/license");
});
});
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(
"/license"
);
});
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="/license">
{rights ? `License: ${rights.rightsStatement}` : "License: Unknown"}
{rights ? `Copyright: ${rights.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("/license");
});
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(
"/license"
);
});
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("/license");
});
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("/license");
});
});
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(
"/license"
);
});
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("/license");
});
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
Loading