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

SCC-3776 - Item Table Component #50

Merged
merged 45 commits into from
Dec 21, 2023
Merged

Conversation

dgcohen
Copy link
Contributor

@dgcohen dgcohen commented Nov 30, 2023

Ticket Link

This PR adds the ItemTableData model and the following components:

ItemTable
RequestButtons
ItemAvailability (formerly InformationLinks)

It also includes tests and some small miscellaneous changes to Item model, SearchResultsBib model, and one renaming change (pascal-casing the itemFilterData class).

NB:
There are some further optimizations to be made, but I will not let these hold up the PR. I added comments where relevant.

Copy link
Member

@EdwinGuzman EdwinGuzman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The update makes sense to me. There are some minor comments but I know this will go through another iteration.

Some things that stick out that we have talked about:

  • Use the the "text" variant for the button that looks like a link for now. I think we may need to reword it and isolate it to better appear as a button. This is for the "contact a librarian" button.
  • Right now, Buttons styled as link do have the underlined as hover and it is expected.

Something I noticed after we chatted:

  • the mobile view has many horizontal lines that I will talk to @bigfishdesign13 about. It makes the mobile view confusing (to me at least)
    Screen Shot 2023-12-04 at 12 38 36 PM

A few things that need to be added that can be another ticket/PR:

Screen Shot 2023-12-04 at 12 40 10 PM

@@ -8,6 +11,8 @@ interface RCLinkProps {
children: ReactNode
className?: string
color?: string
type?: LinkTypes
disabled?: boolean
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be isDisabled. Right now, the disabled version is too light and not the right disabled and I think it's because the DS prop is isDisabled.

For comparison:
Screen Shot 2023-12-04 at 10 13 22 AM

<RCLink
href={item.aeonUrl}
type="buttonSecondary"
disabled={!item.isAvailable}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be isDisabled.

it("renders the correct text when item is available, has an aeon url, and has a location endpoint", async () => {
const item = new Item(itemPhysicallyRequestable, parentBib)
render(<ItemAvailability item={item} />)
screen.getByText(/Available by appointment/)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These would break if they're not in the document, but for completeness I think it should have the expect(...).toBeInDocument() wrapper.

const item = new Item(itemUnavailable, parentBib)
render(<ItemAvailability item={item} />)
screen.getByText(/Not available/)
screen.getByText(/- Please/)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above comment applies to all of these.

src/models/SearchResultsBib.ts Outdated Show resolved Hide resolved
import { Link as DSLink } from "@nypl/design-system-react-components"
import {
Link as DSLink,
type LinkTypes,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@EdwinGuzman take a closer look.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was pointed out that LinkProps needs to be exported.

{" - Please "}
<Button
id="contact-librarian"
buttonType="link"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try buttonType="text".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this still need to be addressed?

@@ -29,12 +46,19 @@ const SearchResult = ({ bib }: SearchResultProps) => {
<RCLink href={`${PATHS.BIB}/${bib.id}`}>{bib.title}</RCLink>
</CardHeading>
<CardContent>
<Box sx={{ p: { display: "inline", marginRight: "s" } }}>
<Box sx={{ p: { display: "inline", marginRight: "s" } }} mb="m">
{bib.materialType && <Text>{bib.materialType}</Text>}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taking a better/closer look, I think these should be spans.

@bigfishdesign13
Copy link

  • the mobile view has many horizontal lines that I will talk to @bigfishdesign13 about. It makes the mobile view confusing (to me at least)

@EdwinGuzman Those lines are there to provide delineation between table rows. But yes, that treatment isn't working well here. Perhaps we could tie that style to the showRowDividers prop. MLN is the only NYPL app that is using the Table component and the horizonal lines in the mobile view don't look great on that site either.

| Variable | Type | Value Example | Description |
| ---------------------------------------- | ------ | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NYPL_HEADER_URL` | string | "https://ds-header.nypl.org" | The base URL of the NYPL environment-specific header and footer scripts. |
| `NEXT_PUBLIC_CLOSED_LOCATIONS` | string | "all;Library of the Performing Arts" | A semicolon-delimited list of strings. Include quotes around the string. All locations beginning with any string in this list will be removed from the list of request options in the `ElectronicDelivery`, `HoldRequest`, and `ItemTableRow` components. Currently used physical locations: `Schwarzman;Science;Library for the Performing Arts;Schomburg`. To close all locations, add `all`. This will also remove EDD as a request option, the 'Request' buttons, and also disable the hold request/edd forms. If `all` is not present, EDD and 'Request' buttons will still be available. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does NEXT_PUBLIC indicate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That prefix allows env variables to be used on the client side.

@@ -16,6 +18,7 @@ export const itemPhysicallyRequestable = {
prefLabel: "book, limited circ, MaRLI",
},
],
dueDate: ["September 3rd"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it makes a difference to the code, but I'm pretty sure this would be formatted YYYY-MM-DD

Copy link
Member

@EdwinGuzman EdwinGuzman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The update looks good but there are a few things to cover before moving on.

  • There are general spacing issues that I think will be picked up during VQA. I think now is a good time to share the Vercel Preview link in the Jira ticket with Apoorva and Clare for their VQA and accessibilty review.
  • The electronic resource link seems better because the link text is actual text and not the URL. Do verify that this is what we want (also note there could be some space above the "Available Online" text):
Screen Shot 2023-12-13 at 11 32 56 AM
  • The "Not available - Please contact a librarian for assistance" text is not displaying. There also seems to be more spacing between elements and it could be slightly reduced. It also appears that the buttons that should be disabled are not. The right side is from this PR and the search term is "National Geographic":
Screen Shot 2023-12-13 at 11 32 15 AM

Copy link
Member

@EdwinGuzman EdwinGuzman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving knowing there's stylistic updates todo later.

@dgcohen dgcohen merged commit 8e584fc into main Dec 21, 2023
3 checks passed
@dgcohen dgcohen deleted the SCC-3776/item-table-component branch December 21, 2023 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants