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
Ensure source selection does not get hidden in overflow #6279
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
60d788a
add wrapper around content and source selection
hannahblair bbf1465
formatting
hannahblair b7c77a7
Merge branch 'main' into fix-source-styling
hannahblair 6955808
remove upload 100% height
hannahblair 2c52068
add changeset
gradio-pr-bot c8c9d7b
move source selection to atoms
hannahblair 3b83209
Merge branch 'fix-source-styling' of github.com:gradio-app/gradio int…
hannahblair bdc613a
formatting
hannahblair f48f9ea
add changeset
gradio-pr-bot f14fd86
Merge branch 'fix-source-styling' of github.com:gradio-app/gradio int…
hannahblair 5626f71
add changeset
gradio-pr-bot f42717d
add changeset
gradio-pr-bot c9b79a0
tweak <Upload /> height to accomodate source selection
hannahblair 7ba3d8e
Merge branch 'fix-source-styling' of github.com:gradio-app/gradio int…
hannahblair 7e1dd9f
add changeset
gradio-pr-bot 1054c41
calc new height with source selection
hannahblair b35ad20
Merge branch 'fix-source-styling' of github.com:gradio-app/gradio int…
hannahblair 560b0c1
Merge branch 'main' into fix-source-styling
hannahblair 2e259d8
formatting
hannahblair 4486b17
Merge branch 'fix-source-styling' of github.com:gradio-app/gradio int…
hannahblair 8e6513f
tweak
hannahblair 0f76527
Merge branch 'main' into fix-source-styling
hannahblair File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
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,9 @@ | ||
--- | ||
"@gradio/atoms": patch | ||
"@gradio/audio": patch | ||
"@gradio/upload": patch | ||
"@gradio/video": patch | ||
"gradio": patch | ||
--- | ||
|
||
fix:Ensure source selection does not get hidden in overflow |
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,74 @@ | ||
<script lang="ts"> | ||
import { Microphone, Upload, Video } from "@gradio/icons"; | ||
|
||
export let sources: string[]; | ||
export let active_source: string; | ||
export let handle_clear: () => void = () => {}; | ||
</script> | ||
|
||
{#if sources.length > 1} | ||
<span class="source-selection"> | ||
{#if sources.includes("upload")} | ||
<button | ||
class="icon" | ||
aria-label="Upload file" | ||
on:click={() => { | ||
handle_clear(); | ||
active_source = "upload"; | ||
}}><Upload /></button | ||
> | ||
{/if} | ||
|
||
{#if sources.includes("microphone")} | ||
<button | ||
class="icon" | ||
aria-label="Record audio" | ||
on:click={() => { | ||
handle_clear(); | ||
active_source = "microphone"; | ||
}}><Microphone /></button | ||
> | ||
{/if} | ||
|
||
{#if sources.includes("webcam")} | ||
<button | ||
class="icon" | ||
aria-label="Record video" | ||
on:click={() => { | ||
handle_clear(); | ||
active_source = "webcam"; | ||
}}><Video /></button | ||
> | ||
{/if} | ||
</span> | ||
{/if} | ||
|
||
<style> | ||
.source-selection { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
border-top: 1px solid var(--border-color-primary); | ||
width: 95%; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
margin-left: auto; | ||
margin-right: auto; | ||
align-self: flex-end; | ||
} | ||
|
||
.icon { | ||
width: 22px; | ||
height: 22px; | ||
margin: var(--spacing-lg) var(--spacing-xs); | ||
padding: var(--spacing-xs); | ||
color: var(--neutral-400); | ||
border-radius: var(--radius-md); | ||
} | ||
|
||
.icon:hover, | ||
.icon:focus { | ||
color: var(--color-accent); | ||
} | ||
</style> |
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
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 |
---|---|---|
|
@@ -3,14 +3,15 @@ | |
import { Upload, ModifyUpload } from "@gradio/upload"; | ||
import { upload, prepare_files, type FileData } from "@gradio/client"; | ||
import { BlockLabel } from "@gradio/atoms"; | ||
import { Music, Microphone, Upload as UploadIcon } from "@gradio/icons"; | ||
import { Music } from "@gradio/icons"; | ||
import AudioPlayer from "../player/AudioPlayer.svelte"; | ||
import { _ } from "svelte-i18n"; | ||
|
||
import type { IBlobEvent, IMediaRecorder } from "extendable-media-recorder"; | ||
import type { I18nFormatter } from "js/app/src/gradio_helper"; | ||
import AudioRecorder from "../recorder/AudioRecorder.svelte"; | ||
import StreamAudio from "../streaming/StreamAudio.svelte"; | ||
import { SelectSource } from "@gradio/atoms"; | ||
|
||
export let value: null | FileData = null; | ||
export let label: string; | ||
|
@@ -227,6 +228,7 @@ | |
bind:dragging | ||
on:error={({ detail }) => dispatch("error", detail)} | ||
{root} | ||
include_sources={sources.length > 1} | ||
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. not sure if there's a better name for this param |
||
> | ||
<slot /> | ||
</Upload> | ||
|
@@ -253,48 +255,4 @@ | |
/> | ||
{/if} | ||
|
||
{#if sources.length > 1} | ||
<span class="source-selection"> | ||
<button | ||
class="icon" | ||
aria-label="Upload audio" | ||
on:click={() => { | ||
clear(); | ||
active_source = "upload"; | ||
}}><UploadIcon /></button | ||
> | ||
<button | ||
class="icon" | ||
aria-label="Record audio" | ||
on:click={() => { | ||
clear(); | ||
active_source = "microphone"; | ||
}}><Microphone /></button | ||
> | ||
</span> | ||
{/if} | ||
|
||
<style> | ||
.source-selection { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
border-top: 1px solid var(--border-color-primary); | ||
width: 95%; | ||
margin: 0 auto; | ||
} | ||
|
||
.icon { | ||
width: 22px; | ||
height: 22px; | ||
margin: var(--spacing-lg) var(--spacing-xs); | ||
padding: var(--spacing-xs); | ||
color: var(--neutral-400); | ||
border-radius: var(--radius-md); | ||
} | ||
|
||
.icon:hover, | ||
.icon:focus { | ||
color: var(--color-accent); | ||
} | ||
</style> | ||
<SelectSource {sources} bind:active_source handle_clear={clear} /> |
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 |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
export let disable_click = false; | ||
export let root: string; | ||
export let hidden = false; | ||
export let include_sources = false; | ||
|
||
// Needed for wasm support | ||
const upload_fn = getContext<typeof upload_files>("upload_files"); | ||
|
@@ -94,6 +95,7 @@ | |
class:center | ||
class:boundedheight | ||
class:flex | ||
style:height={include_sources ? "calc(100% - 40px" : "100%"} | ||
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. This is the actual fix for the issue |
||
on:drag|preventDefault|stopPropagation | ||
on:dragstart|preventDefault|stopPropagation | ||
on:dragend|preventDefault|stopPropagation | ||
|
@@ -122,7 +124,6 @@ | |
button { | ||
cursor: pointer; | ||
width: var(--size-full); | ||
height: var(--size-full); | ||
} | ||
|
||
.hidden { | ||
|
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
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.
these changes are just moving the source selection over to a reusable component