Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Fix icon of dropdown button #1208

Merged
merged 7 commits into from
Apr 11, 2022
Merged

Fix icon of dropdown button #1208

merged 7 commits into from
Apr 11, 2022

Conversation

krysal
Copy link
Member

@krysal krysal commented Mar 30, 2022

Fixes

Fixes #1180 by @zackkrida

Description

This PR:

  • Standardize the caret icon with the g container element
  • Adds the icon to the dropdown button
  • Renames components with the V prefix

Testing Instructions

Visit the following link and observe that the button has the caret icon:
http://localhost:8443/audio/9af3243a-e4d4-4254-95d9-a3d53a0158c3

Checklist

  • My pull request has a descriptive title (not a vague title like Update 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).
  • [N/A] I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.

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.

@krysal krysal requested a review from a team as a code owner March 30, 2022 22:34
@krysal krysal self-assigned this Mar 30, 2022
@openverse-bot openverse-bot added 💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix 🟧 priority: high Stalls work on the project or its dependents labels Mar 30, 2022
Copy link
Contributor

@obulat obulat left a comment

Choose a reason for hiding this comment

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

I think we still do need to add format filter on the front end as well for correctly handling duplicate alt_files. Something like this in the fullLayout getFormats can work

const getFormats = (audio) => {
      if (audio.alt_files?.length) {
        let extensions = new Set()
        const filteredAltFiles = audio.alt_files.filter((altFile) => {
          const isUnique =
            altFile.filetype !== audio.filetype &&
            !extensions.has(altFile.filetype)
          extensions.add(altFile.filetype)
          return isUnique
        })
        if (filteredAltFiles.length) {
          return filteredAltFiles.map((altFile) => ({
            extension_name: displayFormat(audio.provider, altFile.filetype),
            download_url: altFile.url,
          }))
        }
      }

      return [
        {
          extension_name: displayFormat(audio.provider, audio.filetype),
          download_url: audio.url,
        },
      ]
    }

@sarayourfriend
Copy link
Contributor

@obulat For the duplicate formats are they the various mp3 bitrates that some providers have? In that sense they're not "duplicates", we're just missing information that should be encoded in them.

I thought we'd discussed mapping this by hand on the frontend somewhere but I can't remember when that conversation happened or if an issue ever was created for it.

@zackkrida
Copy link
Member

I thought we'd discussed mapping this by hand on the frontend somewhere but I can't remember when that conversation happened or if an issue ever was created for it.

FWIW I recall this too.

Copy link
Contributor

@sarayourfriend sarayourfriend left a comment

Choose a reason for hiding this comment

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

LGTM, fixed the dropdown icon issue which is the only part in scope for this.

Let's open a separate issue/continue the discussion about how to handle download file types elsewhere.

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.

lgtm!

@krysal
Copy link
Member Author

krysal commented Apr 11, 2022

I thought about the different bit rates too and it seems that those are duplicated in the catalog/from the API: https://api.openverse.engineering/v1/audio/9af3243a-e4d4-4254-95d9-a3d53a0158c3/

Response
{ ...
"alt_files": [
        {
            "url": "https://freesound.org/apiv2/sounds/20015/download/",
            "bit_rate": "192000",
            "filesize": "2397312",
            "filetype": "mp3",
            "sample_rate": "44100"
        },
        {
            "url": "https://freesound.org/apiv2/sounds/20015/download/",
            "bit_rate": "192000",
            "filesize": "2397312",
            "filetype": "mp3",
            "sample_rate": "44100"
        }
    ],
}

So hiding it here is not the final solution although we could do it while solving the ingestion step, but I prefer to tackle that in the catalog first.

@krysal krysal merged commit 2fe5c4d into main Apr 11, 2022
@krysal krysal deleted the fix/VDropdownButton-icon branch April 11, 2022 20:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix 🟧 priority: high Stalls work on the project or its dependents
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Odd audio download behavior (missing dropdown icon, repeated format)
5 participants