Skip to content

Commit

Permalink
update license page to copyright
Browse files Browse the repository at this point in the history
  • Loading branch information
jackiequach committed Oct 3, 2024
1 parent b147425 commit e106e34
Show file tree
Hide file tree
Showing 22 changed files with 97 additions and 51 deletions.
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 page to Copyright and add section for "In Copyright" explanation

## [0.18.3]

- Fix error when collections are empty
Expand Down
6 changes: 3 additions & 3 deletions playwright/support/mappings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export const pages: { [name: string]: Pages } = {
about: {
route: "/about",
},
license: {
route: "/license",
copyright: {
route: "/copyright",
},
"read online": {
route: "/read/4440666",
Expand Down Expand Up @@ -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",
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 @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions src/components/About/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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{" "}
<Link to="/license">public domain</Link>, with no restrictions on your
<Link to="/copyright">public domain</Link>, with no restrictions on your
use of them, or under{" "}
<Link to="/license">Creative Commons licences</Link> that may have some
conditions, but only on redistribution or adaptation.
<Link to="/copyright">Creative Commons licences</Link> that may have
some conditions, but only on redistribution or adaptation.
</p>

<p>
Expand Down
4 changes: 2 additions & 2 deletions src/components/About/__snapshots__/About.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,15 @@ exports[`renders about unchanged 1`] = `
<a
class="chakra-link css-qsaw8"
href="/license"
href="/copyright"
>
public domain
</a>
, with no restrictions on your use of them, or under
<a
class="chakra-link css-qsaw8"
href="/license"
href="/copyright"
>
Creative Commons licences
</a>
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 @@ -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");
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("Collection Item Card", () => {
});
test("shows license", () => {
expect(screen.getByText("License: Unknown").closest("a").href).toContain(
"/license"
"/copyright"
);
});
});
2 changes: 1 addition & 1 deletion src/components/CollectionItemCard/LicenseLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Link from "~/src/components/Link/Link";

const LicenseLink: React.FC<{ rights: Rights }> = ({ rights }) => {
return (
<Link to="/license">
<Link to="/copyright">
{rights ? `License: ${rights.rightsStatement}` : "License: Unknown"}
</Link>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -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(<License />);
it("renders Copyright page unchanged", async () => {
const tree = render(<Copyright />);
expect(tree.container.firstChild).toMatchSnapshot();
});
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
<DrbBreakout breadcrumbsData={[{ url: "/license", text: "License" }]} />
<DrbBreakout breadcrumbsData={[{ url: "/copyright", text: "Copyright" }]} />
);
const contentPrimaryElement = (
<>
<Heading level="h1">License Explanations</Heading>
<Heading level="h1">Copyright Explanations</Heading>
<Heading level="h2">Public Domain</Heading>
<p>
Works in the public domain have no copyright (in most cases because the
Expand Down Expand Up @@ -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.
</p>
<Heading level="h2">In Copyright</Heading>
<p>
Works that are{" "}
<Link to="https://rightsstatements.org/page/InC/1.0/?language=en">
In Copyright
</Link>{" "}
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).
</p>
</>
);
return (
Expand All @@ -169,4 +180,4 @@ const License: React.FC = () => {
);
};

export default License;
export default Copyright;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders License page unchanged 1`] = `
exports[`renders Copyright page unchanged 1`] = `
<div
class="css-1u8qly9"
>
Expand Down Expand Up @@ -101,12 +101,12 @@ exports[`renders License page unchanged 1`] = `
<a
aria-current="page"
class="chakra-breadcrumb__link css-0"
href="/license"
href="/copyright"
>
<span
class="breadcrumb-label"
>
License
Copyright
</span>
</a>
</li>
Expand All @@ -124,7 +124,7 @@ exports[`renders License page unchanged 1`] = `
<h1
class="chakra-heading css-1xdhyk6"
>
License Explanations
Copyright Explanations
</h1>
<h2
class="chakra-heading css-1xdhyk6"
Expand Down Expand Up @@ -316,6 +316,23 @@ exports[`renders License page unchanged 1`] = `
</a>
, you may copy, distribute and modify the work as long as any modifications are also made available under the GPL.
</p>
<h2
class="chakra-heading css-1xdhyk6"
>
In Copyright
</h2>
<p>
Works that are
<a
class="chakra-link css-qsaw8"
href="https://rightsstatements.org/page/InC/1.0/?language=en"
>
In Copyright
</a>
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).
</p>
</div>
</main>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/EditionCard/EditionCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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", () => {
Expand Down
5 changes: 2 additions & 3 deletions src/components/EditionCard/EditionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -114,9 +115,7 @@ export const EditionCard: React.FC<{
publishers={edition.publishers}
/>
<LanguageDisplayText edition={edition} />
<Link to="/license">
{EditionCardUtils.getLicense(previewItem)}
</Link>
<LicenseLink rights={previewItem?.rights} />
</Box>
{isPhysicalEdition && <ScanAndDeliverBlurb />}
{isUniversityPress && <UpBlurb publishers={edition.publishers} />}
Expand Down
15 changes: 15 additions & 0 deletions src/components/EditionCard/LicenseLink.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<Link to="/copyright">
{rights && rights.length > 0
? `License: ${rights[0].rightsStatement}`
: "License: Unknown"}
</Link>
);
};

export default LicenseLink;
2 changes: 1 addition & 1 deletion src/components/EditionDetail/Edition.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
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 @@ -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");
});
});

Expand Down Expand Up @@ -75,7 +75,7 @@ describe("Instance Card with Minmal Data", () => {
});
test("shows license", () => {
expect(screen.getByText("License: Unknown").closest("a").href).toContain(
"/license"
"/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 @@ -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";
Expand All @@ -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`
Expand Down Expand Up @@ -94,7 +94,7 @@ export const InstanceCard: React.FC<{
/>
</div>
<WorldCat instance={instance} />
<Link to="/license">{EditionCardUtils.getLicense(previewItem)}</Link>
<LicenseLink 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 @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/constants/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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|",
Expand Down
4 changes: 2 additions & 2 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
12 changes: 12 additions & 0 deletions src/pages/copyright.tsx
Original file line number Diff line number Diff line change
@@ -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<any> = () => {
return (
<Layout>
<Copyright />
</Layout>
);
};
export default CopyrightPage;
12 changes: 0 additions & 12 deletions src/pages/license.tsx

This file was deleted.

0 comments on commit e106e34

Please sign in to comment.