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

261 - Add File Citation to File Page #269

Merged
merged 6 commits into from
Jan 21, 2024

Conversation

MellyGray
Copy link
Contributor

What this PR does / why we need it:

This PR adds the File Citation section to the UI of the File Page.

Which issue(s) this PR closes:

Special notes for your reviewer:

I refactored some components related to the citation to rehuse them in the FileCitation component

The citation boxes won't look as in the mock, with the coloured background because in the SPA the dataset citation box only has the border coloured, so I did the same with the File Citation box.

Suggestions on how to test this:

  1. Install the necessary dependencies using npm install.
  2. Build the design system with cd packages/design-system && npm run build.
  3. Navigate back to the root directory with cd ../../.
  4. Start Storybook with npm run storybook.
  5. Visit the File Page in the Storybook
  6. For detailed stories of the FileCitation component you can go to the FileCitation section of the storybook

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

image

Is there a release notes update needed for this change?:

No

@MellyGray MellyGray added the Size: 3 A percentage of a sprint. 2.1 hours. label Dec 21, 2023
@MellyGray MellyGray marked this pull request as ready for review December 21, 2023 12:07
@coveralls
Copy link

coveralls commented Dec 21, 2023

Coverage Status

coverage: 97.822% (-0.03%) from 97.854%
when pulling 30ae03e on feature/261-file-citation-ui
into b5f65e2 on feature/249-boilerplate-file-page.

@GPortas GPortas self-requested a review January 2, 2024 11:37
@GPortas GPortas self-assigned this Jan 2, 2024
Copy link
Contributor

@GPortas GPortas left a comment

Choose a reason for hiding this comment

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

In general it looks good.

I have found a detail that I believe is an error in the composition of the file citation block text.

filecitation_err

I don't see anything similar in JSF

filecitationjsf

...props
})
}
}

export class FileCitationMother {
static create(fileName: string): string {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think here is where the string is composed incorrectly. (${fileName} [fileName]`)

Copy link
Contributor Author

@MellyGray MellyGray Jan 8, 2024

Choose a reason for hiding this comment

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

This is how I see the files in JSF, with the [fileName] part. If you look at the DataCitation.java in the dataverse repo, that part is added if there is no global identifier

image

In any case, I was assuming that the citation was coming from the API, as in the Dataset page. So this (${fileName} [fileName])` logic only applies to the Stoybook, then I can change it to a different string if we don't like the one with the [fileName]

Please, let me know if my assumption was correct and the citation is coming in the API payload as it does in the dataset payload, otherwise I have to apply that logic to the SPA

citation={version.citation}
tooltip={<DatasetCitationTooltip status={version.publishingStatus} />}
/>
<CitationLearnAbout />
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice extraction

@GPortas GPortas added the UI Tasks related to the user interface (UI) or frontend development label Jan 2, 2024
@jggautier
Copy link

jggautier commented Jan 2, 2024

@GPortas, about the composition of the file citation block text, could you see what the citation looks like when the file is given a persistent ID?

All files in Demo Dataverse, including the file in your "JSF" screenshot, are given a persistent ID.

But for files that aren't given persistent IDs, such as https://dataverse.harvard.edu/file.xhtml?fileId=8079268&version=1.0, it looks like the file's citation block text composition is the same as your first screenshot with the red circle.

This difference is citation composition is discussed in IQSS/dataverse#4777 and it was done intentionally. The conversation in the GitHub issue is a bit long but it ends with Phil's comment at IQSS/dataverse#4777 (comment).

@GPortas
Copy link
Contributor

GPortas commented Jan 2, 2024

Thank you @jggautier,

Then we have to compose the citation text by choosing one of the two composing options depending on whether the file has a persistent ID or not.

@MellyGray I think we should add this distinction in the logic in this PR.

@GPortas GPortas added pm.GREI-d-2.7.1 NIH, yr2, aim7, task1: R&D UI modules for creating datasets and supporting publishing workflows pm.GREI-d-2.7.2 NIH, yr2, aim7, task2: Implement UI modules for creating datasets and publishing workflows labels Jan 3, 2024
@GPortas GPortas removed their assignment Jan 4, 2024
@MellyGray MellyGray assigned GPortas and unassigned MellyGray Jan 8, 2024
@GPortas
Copy link
Contributor

GPortas commented Jan 8, 2024

@MellyGray is right. The citation string must come from the js-dataverse package, as for datasets, so the way it is composed must be opaque to the SPA. This is something to address in the upcoming API and js-dataverse issues and not here.

@GPortas GPortas removed their assignment Jan 8, 2024
@ekraffmiller ekraffmiller self-assigned this Jan 10, 2024
@ekraffmiller
Copy link
Contributor

ekraffmiller commented Jan 10, 2024

@MellyGray can you resolve the conflicts in this PR?

@MellyGray MellyGray assigned ekraffmiller and unassigned MellyGray Jan 11, 2024
Base automatically changed from feature/249-boilerplate-file-page to develop January 19, 2024 09:21
@ekraffmiller
Copy link
Contributor

looks good!

@MellyGray MellyGray linked an issue Jan 21, 2024 that may be closed by this pull request
@ekraffmiller ekraffmiller merged commit c0516c5 into develop Jan 21, 2024
11 of 14 checks passed
@MellyGray MellyGray deleted the feature/261-file-citation-ui branch February 1, 2024 14:13
jayanthkomarraju pushed a commit to jayanthkomarraju/dataverse-frontend that referenced this pull request May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pm.GREI-d-2.7.1 NIH, yr2, aim7, task1: R&D UI modules for creating datasets and supporting publishing workflows pm.GREI-d-2.7.2 NIH, yr2, aim7, task2: Implement UI modules for creating datasets and publishing workflows Size: 3 A percentage of a sprint. 2.1 hours. UI Tasks related to the user interface (UI) or frontend development
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the FileCitation section to the File Page
5 participants