Skip to content

feat(lxlweb): add item information#1567

Open
jesperengstrom wants to merge 13 commits intodevelopfrom
feat-lxlweb-item-details-continued
Open

feat(lxlweb): add item information#1567
jesperengstrom wants to merge 13 commits intodevelopfrom
feat-lxlweb-item-details-continued

Conversation

@jesperengstrom
Copy link
Copy Markdown
Contributor

@jesperengstrom jesperengstrom commented Apr 20, 2026

Description

Solves

Add an Item lens for web-details to display as "biblioteksspecifika detaljer" on instance pages:

Skärmavbild 2026-04-20 kl  15 37 12.

  • Displayed per holder instead of per prop as previously. Ok?
  • Mapped as itemInformation to align with filter "Bestånd", even though "Bestånd" also includes itemShelf properties not displayed here. Too confusing?

I also went out on a limb and vibe coded a function to cleanup the decorated data. The aim was to get rid of empty nodes mainly caused by hasComponent (that might have stuff we want to display but usually not):

Skärmavbild 2026-04-20 kl  16 12 28

Basically we have no way of knowing if a branch in displayDecorated ends up as a dead end:

{
  "@id": "https://libris-qa.kb.se/xx",
  "@type": "Item",
  "_display": [
    {
      "hasComponent": {
        "@type": "Item",
        "_display": [
          {
            "something": {
              "_display": [
                {
                  "couldGoOnForever": {
                    "_display": [] // nothing here
                  }
                }
              ]
            }
          }
        ],
        "_style": [
          "ext-link"
        ],
        "_label": "Bestånd"
      },
      "_label": "har komponent"
    }
  ],
  "_style": [
    "ext-link"
  ],
  "_label": "Bestånd"
}

It we squash it like 👇 we can decisively skip the entire section

{
  "@id": "https://libris-qa.kb.se/xx",
  "@type": "Item",
  "_display": [],
  "_style": [
    "ext-link"
  ],
  "_label": "Bestånd"
}

Cleaning is now done as the last step of lensAndFormat and seems to be working fine.
However:

  • Hope it does not have a negative performance impact
  • Best option would be to not even construct these nodes in the first place

Summary of changes

  • Add item-web-details lens, format and pass as resource itemInformation
  • Add <details> section in Resource component
  • Create and use /cleanupDecorated.ts
  • Rename shelfData -> itemShelf (= Placering)
  • Rename itemNoteData -> itemNote (= Beståndsuppgift)
  • Move immediateAcquisition from shelf to information.

@jesperengstrom jesperengstrom marked this pull request as ready for review April 21, 2026 07:22
@olovy
Copy link
Copy Markdown
Contributor

olovy commented Apr 21, 2026

Ok!

Some initial testing:

immediateAcquisition is not working?
http://localhost:5173/wf7hxsw705qtktz
https://libris-qa.kb.se/katalogisering/8dmfj7hf2nvl39t

:immediateAcquisition [ a :ImmediateAcquisition ;
      marc:methodOfAcquisition "Gåva;" ;
      marc:sourceOfAcquisition "Måltidsakademiens biblioteksstiftelse" ] ;
bild

hasComponent should be handled in some way. Render it the same way as editions in the holdings panel? i.e. grouped with a vertical bar. flatten when 1 component?

should show the props inside hasComponent, not hasComponent:
bild

bild

I think marc:hasTextualHoldingsBasicBibliographicUnit (Oformaterad beståndsuppgift - Huvudpublikation) should only be shown in the holding panel? Not in details.

@jesperengstrom
Copy link
Copy Markdown
Contributor Author

I think marc:hasTextualHoldingsBasicBibliographicUnit (Oformaterad beståndsuppgift - Huvudpublikation) should only be shown in the holding panel? Not in details.

ok, fixed in 32aeb69
hasNote is in both shelf (panel) and in details. Maybe same thing there, only in panel?

@jesperengstrom
Copy link
Copy Markdown
Contributor Author

removing hasNote would also fix the hasComponent issue in your example. Don't know if there are others...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants