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

Wire up details panel to collection item nodes #18

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

chiatt
Copy link
Member

@chiatt chiatt commented Jan 30, 2025

Removes (most) mock data from the collection item details panel. Loads identifier, images, and acquisition information from tile data.

@chiatt chiatt marked this pull request as draft January 30, 2025 20:47
@chiatt chiatt marked this pull request as ready for review January 30, 2025 23:08
@@ -22,16 +25,27 @@ watch(resultSelected, () => {

async function getData() {
const resp = await fetchResourceData(resultSelected.value);
const imageResourceids = resp.resource["Digital Reference"]?.map((tile: { [key: string]: any; }) => // eslint-disable-line @typescript-eslint/no-explicit-any
tile["Digital Source"]["resourceId"]);
const accessionNumber = resp.resource['Identifier']?.find((identifier: {[key: string]: any;}) => // eslint-disable-line @typescript-eslint/no-explicit-any
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure what else to do about the key value type. I think it has to be 'any' because I really don't know what it might be, so I used this // eslint-disable-line @typescript-eslint/no-explicit-any to appease the linter.

const imageResourceids = resp.resource["Digital Reference"]?.map((tile: { [key: string]: any; }) => // eslint-disable-line @typescript-eslint/no-explicit-any
tile["Digital Source"]["resourceId"]);
const accessionNumber = resp.resource['Identifier']?.find((identifier: {[key: string]: any;}) => // eslint-disable-line @typescript-eslint/no-explicit-any
identifier["Identifier_type"]["@display_value"]==="Accession Number");
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm using 'Accession' number here as a placeholder. I'm really not sure what will go here because there is nothing in the graph that corresponds to the mock-up.

@apeters apeters self-requested a review January 31, 2025 18:06
@apeters
Copy link
Member

apeters commented Jan 31, 2025

Seeing some inconsistencies with the details panel.

Screenshot 2025-01-31 at 1 13 23 PM

@chiatt
Copy link
Member Author

chiatt commented Feb 1, 2025

Seeing some inconsistencies with the details panel.

Not sure what's going on here .. it looks okay on mine:
image

Comment on lines 34 to 39
({
"person": tile["Addition to Collection_carried out by"]["@display_value"],
"date": tile["Addition to Collection_time"]["Addition to Collection_time_begin of the begin"]["@display_value"],
"details": tile["Addition to Collection_Statement"]?.map((statement: {[key: string]: any;}) => // eslint-disable-line @typescript-eslint/no-explicit-any
(statement["Addition to Collection_Statement_content"]["@display_value"])).join(" ")
}));
Copy link
Member

Choose a reason for hiding this comment

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

add optional chaining to allow forother parts of display to render properly

Suggested change
({
"person": tile["Addition to Collection_carried out by"]["@display_value"],
"date": tile["Addition to Collection_time"]["Addition to Collection_time_begin of the begin"]["@display_value"],
"details": tile["Addition to Collection_Statement"]?.map((statement: {[key: string]: any;}) => // eslint-disable-line @typescript-eslint/no-explicit-any
(statement["Addition to Collection_Statement_content"]["@display_value"])).join(" ")
}));
({
"person": tile?.["Addition to Collection_carried out by"]?.["@display_value"],
"date": tile?.["Addition to Collection_time"]?.["Addition to Collection_time_begin of the begin"]["@display_value"],
"details": tile?.["Addition to Collection_Statement"]?.map((statement: {[key: string]: any;}) => // eslint-disable-line @typescript-eslint/no-explicit-any
(statement?.["Addition to Collection_Statement_content"]?.["@display_value"])).join(" ")
}));

Copy link
Member Author

@chiatt chiatt Feb 1, 2025

Choose a reason for hiding this comment

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

Ah - I thought the optional chaining in the ?.map above that which passes 'tile' in would ensure there was a tile, but I guess not if you had a parent with no children.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok - that should be fixed now.

/>
</div>
<div v-if="images.length" class="images">
<Carousel :value="images" :numVisible="2" :numScroll="1" containerClass="flex items-center">
Copy link
Member

Choose a reason for hiding this comment

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

these properties should use hyphens instead of camelCase.

Copy link
Member Author

@chiatt chiatt Feb 1, 2025

Choose a reason for hiding this comment

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

Unfortunately, I can't change those. They are passed into Carousel. I checked to see if Carousel would take hyphenated args, but no luck.

const imageResourceids = resp.resource["Digital Reference"]?.map((tile: { [key: string]: any; }) => // eslint-disable-line @typescript-eslint/no-explicit-any
tile["Digital Source"]["resourceId"]);
const accessionNumber = resp.resource['Identifier']?.find((identifier: {[key: string]: any;}) => // eslint-disable-line @typescript-eslint/no-explicit-any
identifier["Identifier_type"]["@display_value"]==="Accession Number");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
identifier["Identifier_type"]["@display_value"]==="Accession Number");
type UnspecifiedObject = { [key: string]: UnspecifiedObject | unknown };
.....
.....
const imageResourceids = resp.resource["Digital Reference"]?.map((tile: UnspecifiedObject) =>
(tile["Digital Source"] as UnspecifiedObject)?.["resourceId"]);

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