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

Combine related media component using VMediaCollection.vue #3831

Merged
merged 5 commits into from Mar 6, 2024

Conversation

obulat
Copy link
Contributor

@obulat obulat commented Feb 27, 2024

Fixes

Extracted from #3785 to make it easier to review.
Fixes #3832 by @obulat

Note: 428 lines of the 987 added lines are from "tapes" (saved API responses used for tests)

Description

We currently have two separate components for related images and related audio that are basically duplicating each other. This PR combines the 2 related components.

A bigger change is the new VMediaCollection component (originally introduced in #3785, but split from it to make reviewing simpler).

This component handles displaying the header, grid skeleton if fetching or the media collection if fetched, and the footer with load more button and the external search form, if necessary.

To simplify this component, I used slots for header and footer, and created wrapper components (similar to the audio templates) for the related, search and collection results. This PR contains the VMediaCollection and the VRelatedMedia.vue wrapper component. It does not use footer because the related media does not have load more button (or the external search form).

This PR renames the "old" components for audio and image grid to minimize the number of changes (VImageGrid and VAudioList are "old", and VImageCollection and VAudioCollection are the new ones).

There's also a tiny unrelated change: the loading skeleton for image single result is now centered (using mx-auto class).

Testing Instructions

Select an audio result and click on one of the related audios. You should see the SELECT_RESULT event with the relatedTo set correctly. The related images/audio should look correct.

Look at the single result pages. The related media section should look and behave correctly.

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.
  • I ran the DAG documentation generator (if applicable).

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@openverse-bot openverse-bot added the 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work label Feb 27, 2024
@github-actions github-actions bot added the 🧱 stack: frontend Related to the Nuxt frontend label Feb 27, 2024
@obulat obulat added 💻 aspect: code Concerns the software code in the repository 🧰 goal: internal improvement Improvement that benefits maintainers, not users 🟧 priority: high Stalls work on the project or its dependents and removed 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work labels Feb 27, 2024
@obulat obulat self-assigned this Feb 27, 2024
@obulat obulat force-pushed the refactor/combine-related-media branch 2 times, most recently from 5a7abcb to c7ff123 Compare February 27, 2024 11:51
@obulat obulat marked this pull request as ready for review February 27, 2024 12:14
@obulat obulat requested a review from a team as a code owner February 27, 2024 12:14
@zackkrida
Copy link
Member

I'll review this in the next day! Somehow didn't see that I was on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the old VAudioCollection.vue component.

@obulat obulat force-pushed the refactor/combine-related-media branch 2 times, most recently from f533da2 to 6bb70dd Compare March 1, 2024 18:49
Comment on lines +90 to +91
? "audioDetails.relatedAudios"
: "imageDetails.relatedImages"
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 impact our line number matching in the .pot files? I don't think so, because it's the full strings, but want to confirm.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know, will need to check. Would the line numbers make the strings fuzzy in GlotPress?

Copy link
Member

@zackkrida zackkrida left a comment

Choose a reason for hiding this comment

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

This is really nice work. The type improvements and tests look good too. I left a minor suggestion and a design question.

obulat and others added 5 commits March 3, 2024 16:00
Signed-off-by: Olga Bulat <obulat@gmail.com>
And also relatedTo to the related images
Signed-off-by: Olga Bulat <obulat@gmail.com>
Signed-off-by: Olga Bulat <obulat@gmail.com>
Co-authored-by: zack <6351754+zackkrida@users.noreply.github.com>
@openverse-bot
Copy link
Collaborator

Based on the high urgency of this PR, the following reviewers are being gently reminded to review this PR:

@dhruvkb
This reminder is being automatically generated due to the urgency configuration.

Excluding weekend1 days, this PR was ready for review 5 day(s) ago. PRs labelled with high urgency are expected to be reviewed within 2 weekday(s)2.

@obulat, if this PR is not ready for a review, please draft it to prevent reviewers from getting further unnecessary pings.

Footnotes

  1. Specifically, Saturday and Sunday.

  2. For the purpose of these reminders we treat Monday - Friday as weekdays. Please note that the operation that generates these reminders runs at midnight UTC on Monday - Friday. This means that depending on your timezone, you may be pinged outside of the expected range.

@obulat obulat merged commit 9bba31a into main Mar 6, 2024
40 checks passed
@obulat obulat deleted the refactor/combine-related-media branch March 6, 2024 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🧰 goal: internal improvement Improvement that benefits maintainers, not users 🟧 priority: high Stalls work on the project or its dependents 🧱 stack: frontend Related to the Nuxt frontend
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Related audio does not send relatedTo prop in analytics
4 participants