Code Monkey home page Code Monkey logo

nectar-iiif's People

Contributors

adamjarling avatar markpbaggett avatar mathewjordan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

navnorth

nectar-iiif's Issues

Export types

Description

Let's double check the TypeScript types are being exported as part of the bundle?

image

Responsive image delivery spike

Description

After a Lighthouse audit in [Digital Collections}(), image optimization was a frequently suggested solution. Perhaps it'd be worth investigating srcSet, responsive images for what Nectar delivers? Assuming images are being served from a IIIF image service, would it be as simple as requesting various dimensions at the image's scale?

https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images

Done looks like

  • Is this do-able, and/or worth the effort?

Verify images have alt attributes

Description

From Lighthouse reports, it's complaining about some missing alt tags...

image

Done looks like

  • All images verified to have alt attributes

Metadata pattern mapping

Problem:

Say you have a metadata property resembling:

[
  {
    label: { none: [ "Genre" ]},
    value: { none: [ "paintings (visual works)" ]}
  },
  {
    label: { none: [ "Record" ]},
    value: { none: [ "00001234" ]}
  },
  {
    label: { none: [ "Subject" ]},
    value: { none: [ "Buddhist art" ]}
  }
]

A consuming application using Next.js wants to create a custom patterns wrapping the rendered value for specific labels, Subject, and Genre so that those values are rendered within a next/link <Link> component.

Potential solution?

This pattern would target matching labels and render their value as they are entered as the children of the <MetadataPattern>. It would allow for a React component to be rendered within <MetadataPattern> including <Link>.

import { Metadata, MetadataPattern, MetadataValue } from "@samvera/nectar-iiif";
import Link from "next/link";

const WorkMetadata = ({ manifest }) => {
  return (
    <>
      <Metadata metadata={manifest.metadata}>
        <MetadataPattern label={{ none: ["Genre"] }}>
          <Link href={`https://next.site/search?genre=${MetadataValue}`}>
            <a>{MetadataValue}</a>
          </Link>
        </MetadataPattern>
        <MetadataPattern label={{ none: ["Subject"] }}>
          <Link href={`https://next.site/search?subject=${MetadataValue}`}>
            <a>{MetadataValue}</a>
          </Link>
        </MetadataPattern>
      </Metadata>
    </>
  );
};

OR?

import Link from "next/link";
import { Metadata } from "@samvera/nectar-iiif";

const WorkMetadata = ({ manifest }) => {
  const customValueContent = [
    {
      matchingLabel: { none: ["Genre"] },
      Content: (
        <Link href={`https://next.site/search?genre=${Metadata.Value}`}>
          <a>{Metadata.Value}</a>
        </Link>
      )
    },
    {
      matchingLabel: { none: ["Subject"] },
      Content: (
        <Link href={`https://next.site/search?subject=${Metadata.Value}`}>
          <a>{Metadata.Value}</a>
        </Link>
      )
    }
  ];

  return (
    <Metadata
      metadata={manifest.metadata}
      customValueContent={customValueContent}
    />
  );
};

DOM Output

Note that in this scenario patterns matching label patterns have their sibling values rendered in the default method.

<dl>
  <div role="group">
    <dt>Genre</dt>
    <dd>
      <a href="https:/next.site/search?genre=paintings (visual works)">paintings (visual works)</a>
    </dd>
  </div>
  <div role="group">
    <dt>Record</dt>
    <dd>00001234</dd>
  </div>
  <div role="group">
    <dt>Subject</dt>
    <dd>
      <a href="https://next.site/search?subject=Buddhist art">Buddhist art</a>
    </dd>
  </div>
</dl>

Should Nectar assume the width of a thumbnail?

At UTK, we don't necessarily have a set size for thumbnails. Our current practice is to generate thumbnails that are at least 400 pixels wide. That being said, Nectar always takes whatever the thumbnail is and degrades it to 200 pixels wide in useGetImageResource. This has several negative effects in my opinion.

  1. You can't use your thumbnail in its native size. It will always be downsize to 200 pixels.
  2. If you're using something like Bloom that leverages Nectar, it too follows this same practice. This can lead to some weirdness since Bloom initially will make use of the thumbnail associated with an item in the collection in its native state and then onHover reduce that thumbnail to 200 pixels wide.

In my opinion, nectar should leverage the width property from resource and pass it with service since it is a required property in 2.0, 2.1, and 3.0.

if (Array.isArray(resource.service) && resource.service.length > 0)
    imageService = service[0] as ImageService;

Is there any reason why width should not be leveraged from resource and used in place of size here?

  if (imageService) {
    if (imageService["@id"])
      return `${imageService["@id"]}/${region}/${size}/0/default.jpg`;

    if (imageService.id)
      return `${imageService.id}/${region}/${size}/0/default.jpg`;
  }

When getLabelEntries returns value not matching requested lang, the components still uses lang on element

I noticed that nectar returns wrong lang on elements when getLabelEntries returns values not matching requested language.

On this english page, https://chc-web.vercel.app/en/id/ubb-ms-0008, i am fetching a Manifest with metadata missing "en" values. Nectar shows the norwegian values in this case, but the html markup assumes that there will be values in the requested language. Example below.

<div role="group" data-label="subjects">
  <dt lang="en" class="nectar-c-PJLV">Subjects</dt>
  <dd lang="en" class="nectar-c-PJLV">
    Reiseskildringer,Reisebeskrivelser, Søvæsen vedk., Kapervirksomhet, Tyrkia, Journal of a priveteer, Avskriftssamling fra 16- og 
    17-tallet, Russland, 1700-tallet, Sørøvertogt, Pirater, England vedk., Krigshistorie, Dagboksoptegnelser, Sjørøveri
  </dd>
</div>

I believe the components should use the correct lang tag, when the Manifest have missing language values.

Add basic Rights component.

Long-term, we may want to dereference the rights uri. For now, create a component that renders rights as an anchor.

Add Logo component

Add <Logo/> component to support logo in Linking Properties.
See: https://iiif.io/api/presentation/3.0/#logo

The value of this property must be an array of JSON objects, each of which must have id and type properties, and should have format. The value of type must be “Image”.

Support HTML rendering using `dangerouslySetInnerHTML`

Labels and Values might contain HTML. See https://figgy.princeton.edu/concern/scanned_resources/678fb869-c5de-4e5a-a1b7-2cd71ff663ec/manifest where a metadata entry is represented as:

   {
      "label": "Identifier",
      "value": [
        "<a href='http://arks.princeton.edu/ark:/88435/fx719n84d' alt='Identifier'>http://arks.princeton.edu/ark:/88435/fx719n84d</a>"
      ]
   }

Consider including partOf and provider

Consider bringing more complex components to map partOf and provider entries.

<PartOf partOf={manifest.partOf}>
  <PartOf.Entry>
    <Homepage>
      <Label as="h3" />
      <Thumbnail alt="my-dumb-alt" />
    </Homepage>
  </PartOf.Entry>
</PartOf>
<Provider provider={provider}>
  <Homepage>
    <Label as="h3" />
    <Logo alt="my-dumb-alt" />
  </Homepage>
  <SeeAlso />
</Provider>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.