This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 64
Update license explanation tooltip #850
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
871c72a
Add icons for deprecated CC licenses
dhruvkb eb8ebb8
Replace hardcoded licenses with use of constant
dhruvkb e8c51b6
Add explanation for sampling
dhruvkb 524fe76
Update strings to match updated UI
dhruvkb ba944c9
Refactor and update the license elements component
dhruvkb 7a24d2a
Update the usage of the `VLicenseElements` component
dhruvkb 05d3c62
Update the contents of the explanation popover to match the UI
dhruvkb f5f96ed
Update the filter checklist to use `VPopover` for license explanations
dhruvkb b94e1ce
Update the license order putting public domain before CC
dhruvkb 09152b2
Replace @ imports with ~
dhruvkb c302831
Document the difference between licenses and marks
dhruvkb 17c8d26
Remove `atype` param from the link
dhruvkb 0a25092
Use element itself as the key instead of an additional index
dhruvkb 3cb81aa
Use props directly from `this`
dhruvkb f69df84
Remove class with no effect
dhruvkb 87d2262
Improve the UI for smaller screens
dhruvkb 11f0648
Use dynamic expression in return type
dhruvkb e8d9cdf
Only render license elements if the license is not `null`-ish
dhruvkb 803143a
Rectify the font size of the heading
dhruvkb ebf52ff
Fix non-existent max width
dhruvkb 0af7e0d
Add a close button to the license popover
dhruvkb a98e709
Fix bug with click outside
dhruvkb 03ed3bd
Fix inline popover content taking up space (#870)
sarayourfriend b13ea0c
Cleanup trigger button
dhruvkb beafb05
Add focus ring around the close button
dhruvkb 5523171
Explicitly register VButton to prevent test from failing
dhruvkb df66c76
Fix strange Safari bug with VoiceOver
dhruvkb 3f91c0e
Resolve lapses in accessibility
dhruvkb 99126ee
Merge branch 'main' of https://github.com/WordPress/openverse-fronten…
dhruvkb 0390c7c
Merge branch 'main' into licence_popover
dhruvkb 3df35cd
Only read the element title if there are more than one
dhruvkb 94eeda4
Merge branch 'main' into licence_popover
dhruvkb c1f5ccb
Merge branch 'main' into licence_popover
dhruvkb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<template> | ||
<div class="license-explanation w-full max-w-xs p-6"> | ||
<h5 class="text-base font-semibold"> | ||
<template v-if="isTechnicallyLicense">{{ | ||
$t('filters.license-explanation.license-definition') | ||
}}</template> | ||
<template v-else>{{ | ||
$t('filters.license-explanation.mark-definition', { | ||
mark: license.toUpperCase(), | ||
}) | ||
}}</template> | ||
</h5> | ||
|
||
<VLicenseElements | ||
sarayourfriend marked this conversation as resolved.
Show resolved
Hide resolved
|
||
v-if="license" | ||
size="small" | ||
class="my-4" | ||
:license="license" | ||
/> | ||
|
||
<i18n | ||
:path="`filters.license-explanation.more.${ | ||
isTechnicallyLicense ? 'license' : 'mark' | ||
}`" | ||
tag="p" | ||
class="text-sm" | ||
> | ||
<template #read-more> | ||
<VLink :href="`${getLicenseDeedLink(license)}`">{{ | ||
$t('filters.license-explanation.more.read-more') | ||
}}</VLink> | ||
</template> | ||
<template #mark>{{ license.toUpperCase() }}</template> | ||
</i18n> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { isLicense } from '~/utils/license' | ||
|
||
import VLicenseElements from '~/components/VLicenseElements.vue' | ||
|
||
import { DEPRECATED_LICENSES } from '~/constants/license' | ||
|
||
/** | ||
* Renders the explanation of the license passed to it by breaking it down to | ||
* its constituent clauses. | ||
*/ | ||
export default { | ||
name: 'VLicenseExplanation', | ||
components: { | ||
VLicenseElements, | ||
}, | ||
props: { | ||
/** | ||
* the code of the license whose elements need to be explained | ||
*/ | ||
license: { | ||
type: String, | ||
required: true, | ||
}, | ||
}, | ||
computed: { | ||
/** | ||
* Public domain marks such as CC0 and PDM are not technically licenses. | ||
* @return {boolean} true if the license is not CC0 or PDM, false otherwise | ||
*/ | ||
isTechnicallyLicense() { | ||
return isLicense(this.license) | ||
}, | ||
}, | ||
methods: { | ||
getLicenseDeedLink(licenseTerm) { | ||
let fragment | ||
if (licenseTerm === 'cc0') { | ||
fragment = 'publicdomain/zero/1.0' | ||
} else if (licenseTerm === 'pdm') { | ||
fragment = 'publicdomain/mark/1.0' | ||
} else if (DEPRECATED_LICENSES.includes(licenseTerm)) { | ||
fragment = `licenses/${licenseTerm}/1.0` | ||
} else { | ||
fragment = `licenses/${licenseTerm}/4.0` | ||
} | ||
return `https://creativecommons.org/${fragment}/?ref=openverse` | ||
}, | ||
}, | ||
} | ||
</script> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's pass the
label
prop here with the value of the license definition. That way the popover label is read out when it is opened and we don't have to mess with moving the focus away from the default of the close button (which I think makes the most sense ergonomically to auto-focus when the popover is opened).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not understand what you mean by license definition. A license can have several elements, each with their own definition (eg. BY-NC-SA with 3 elements & 3 definitions).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you're right. We might need to find a compromise for screen reader folks to get that information quickly upon opening the popover. Maybe something to explore later on though 🤔 Otherwise the aria-label would be a huge wall of text for multi-element licenses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we can separate this into a separate issue to at least move past the post-launch bugs milestone.