-
Notifications
You must be signed in to change notification settings - Fork 433
fix: vue nodes image preview widget, better multi image gallery support #7178
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
Open
simula-r
wants to merge
4
commits into
main
Choose a base branch
from
fix/save-image-misc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| <template> | ||
| <div | ||
| v-if="imageUrls.length > 0" | ||
| class="image-preview group relative flex size-full min-h-16 min-w-16 flex-col px-2 justify-center" | ||
| class="image-preview outline-none group relative flex size-full min-h-16 min-w-16 flex-col px-2 justify-center" | ||
| tabindex="0" | ||
| role="region" | ||
| :aria-label="$t('g.imagePreview')" | ||
|
|
@@ -11,7 +11,7 @@ | |
| > | ||
| <!-- Image Wrapper --> | ||
| <div | ||
| class="h-full w-full overflow-hidden rounded-[5px] bg-node-component-surface" | ||
| class="h-full w-full overflow-hidden rounded-[5px] bg-node-component-surface relative" | ||
| > | ||
| <!-- Error State --> | ||
| <div | ||
|
|
@@ -24,16 +24,13 @@ | |
| {{ getImageFilename(currentImageUrl) }} | ||
| </p> | ||
| </div> | ||
|
|
||
| <!-- Loading State --> | ||
| <Skeleton | ||
| v-if="isLoading && !imageError" | ||
| class="absolute inset-0 size-full" | ||
| border-radius="5px" | ||
| width="16rem" | ||
| height="16rem" | ||
| width="100%" | ||
| height="100%" | ||
| /> | ||
|
|
||
| <!-- Main Image --> | ||
| <img | ||
| v-if="!imageError" | ||
|
|
@@ -83,29 +80,10 @@ | |
| <i class="icon-[lucide--x] h-4 w-4" /> | ||
| </button> | ||
| </div> | ||
|
|
||
| <!-- Multiple Images Navigation --> | ||
| <div | ||
| v-if="hasMultipleImages" | ||
| class="absolute right-2 bottom-2 left-2 flex justify-center gap-1" | ||
| > | ||
| <button | ||
| v-for="(_, index) in imageUrls" | ||
| :key="index" | ||
| :class="getNavigationDotClass(index)" | ||
| :aria-label=" | ||
| $t('g.viewImageOfTotal', { | ||
| index: index + 1, | ||
| total: imageUrls.length | ||
| }) | ||
| " | ||
| @click="setCurrentIndex(index)" | ||
| /> | ||
| </div> | ||
| </div> | ||
|
|
||
| <!-- Image Dimensions --> | ||
| <div class="mt-2 text-center text-xs text-white"> | ||
| <div class="pt-2 text-center text-xs text-white"> | ||
| <span v-if="imageError" class="text-red-400"> | ||
| {{ $t('g.errorLoadingImage') }} | ||
| </span> | ||
|
|
@@ -116,6 +94,21 @@ | |
| {{ actualDimensions || $t('g.calculatingDimensions') }} | ||
| </span> | ||
| </div> | ||
| <!-- Multiple Images Navigation --> | ||
| <div v-if="hasMultipleImages" class="flex justify-center gap-1 pt-4"> | ||
| <button | ||
| v-for="(_, index) in imageUrls" | ||
| :key="index" | ||
| :class="getNavigationDotClass(index)" | ||
| :aria-label=" | ||
| $t('g.viewImageOfTotal', { | ||
| index: index + 1, | ||
| total: imageUrls.length | ||
| }) | ||
| " | ||
| @click="setCurrentIndex(index)" | ||
| /> | ||
| </div> | ||
|
Comment on lines
+102
to
+115
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Multi-image navigation block is solid; consider small ARIA/semantics tweaks The new navigation below the image with translated
Example (non-blocking): - <button
+ <button
+ type="button"
v-for="(_, index) in imageUrls"
:key="index"
:class="getNavigationDotClass(index)"
+ :aria-current="index === currentIndex ? 'true' : undefined"🤖 Prompt for AI Agents |
||
| </div> | ||
| </template> | ||
|
|
||
|
|
@@ -230,6 +223,7 @@ const handleRemove = () => { | |
| } | ||
|
|
||
| const setCurrentIndex = (index: number) => { | ||
| if (currentIndex.value === index) return | ||
| if (index >= 0 && index < props.imageUrls.length) { | ||
| currentIndex.value = index | ||
| actualDimensions.value = null | ||
|
|
@@ -248,7 +242,7 @@ const handleMouseLeave = () => { | |
|
|
||
| const getNavigationDotClass = (index: number) => { | ||
| return [ | ||
| 'w-2 h-2 rounded-full transition-all duration-200 border-0 cursor-pointer', | ||
| 'w-2 h-2 rounded-full transition-all duration-200 border-0 cursor-pointer p-0', | ||
| index === currentIndex.value ? 'bg-white' : 'bg-white/50 hover:bg-white/80' | ||
simula-r marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ] | ||
| } | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.