Spaces:
Running
Running
RemiFabre commited on
Commit Β·
0bff0b6
1
Parent(s): 9f9e605
Improve HF upload discoverability and sharing CTA
Browse files- marionette/static/index.html +5 -2
- marionette/static/main.js +20 -5
- marionette/static/style.css +11 -3
- tests/e2e/test_ui.py +4 -3
marionette/static/index.html
CHANGED
|
@@ -133,9 +133,12 @@
|
|
| 133 |
<button class="dataset-btn" id="cancel-dataset-btn">Cancel</button>
|
| 134 |
</div>
|
| 135 |
</div>
|
| 136 |
-
<div class="upload-bar" id="upload-bar"
|
| 137 |
<span class="upload-count" id="upload-count">0 selected</span>
|
| 138 |
-
<
|
|
|
|
|
|
|
|
|
|
| 139 |
</div>
|
| 140 |
</div>
|
| 141 |
<div id="moves-list">
|
|
|
|
| 133 |
<button class="dataset-btn" id="cancel-dataset-btn">Cancel</button>
|
| 134 |
</div>
|
| 135 |
</div>
|
| 136 |
+
<div class="upload-bar" id="upload-bar">
|
| 137 |
<span class="upload-count" id="upload-count">0 selected</span>
|
| 138 |
+
<span class="upload-hint" id="upload-hint">
|
| 139 |
+
Create your first move, then select it to share with the community.
|
| 140 |
+
</span>
|
| 141 |
+
<button class="upload-btn" id="upload-btn" disabled>Upload to HF</button>
|
| 142 |
</div>
|
| 143 |
</div>
|
| 144 |
<div id="moves-list">
|
marionette/static/main.js
CHANGED
|
@@ -77,6 +77,7 @@ const $libraryDatasetSelect = document.getElementById('library-dataset-select');
|
|
| 77 |
const $libraryMovesList = document.getElementById('library-moves-list');
|
| 78 |
const $uploadBar = document.getElementById('upload-bar');
|
| 79 |
const $uploadCount = document.getElementById('upload-count');
|
|
|
|
| 80 |
const $uploadBtn = document.getElementById('upload-btn');
|
| 81 |
const $datasetSelect = document.getElementById('dataset-select');
|
| 82 |
const $newDatasetBtn = document.getElementById('new-dataset-btn');
|
|
@@ -290,6 +291,9 @@ function updateConfigUI(config) {
|
|
| 290 |
|
| 291 |
// Lead compensation
|
| 292 |
updateLeadCompUI(config);
|
|
|
|
|
|
|
|
|
|
| 293 |
}
|
| 294 |
|
| 295 |
|
|
@@ -574,13 +578,24 @@ function updateMoveCardStates(mode, activeMove) {
|
|
| 574 |
|
| 575 |
function updateUploadBar() {
|
| 576 |
const count = selectedMoves.size;
|
| 577 |
-
|
| 578 |
-
|
| 579 |
-
|
| 580 |
-
|
|
|
|
|
|
|
|
|
|
| 581 |
} else {
|
| 582 |
-
$
|
| 583 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 584 |
}
|
| 585 |
|
| 586 |
|
|
|
|
| 77 |
const $libraryMovesList = document.getElementById('library-moves-list');
|
| 78 |
const $uploadBar = document.getElementById('upload-bar');
|
| 79 |
const $uploadCount = document.getElementById('upload-count');
|
| 80 |
+
const $uploadHint = document.getElementById('upload-hint');
|
| 81 |
const $uploadBtn = document.getElementById('upload-btn');
|
| 82 |
const $datasetSelect = document.getElementById('dataset-select');
|
| 83 |
const $newDatasetBtn = document.getElementById('new-dataset-btn');
|
|
|
|
| 291 |
|
| 292 |
// Lead compensation
|
| 293 |
updateLeadCompUI(config);
|
| 294 |
+
|
| 295 |
+
// Keep upload CTA in sync when HF auth changes.
|
| 296 |
+
updateUploadBar();
|
| 297 |
}
|
| 298 |
|
| 299 |
|
|
|
|
| 578 |
|
| 579 |
function updateUploadBar() {
|
| 580 |
const count = selectedMoves.size;
|
| 581 |
+
const totalMoves = Array.isArray(lastState?.moves) ? lastState.moves.length : 0;
|
| 582 |
+
let hint = '';
|
| 583 |
+
|
| 584 |
+
if (totalMoves === 0) {
|
| 585 |
+
hint = 'Create your first move, then select it to share with the community.';
|
| 586 |
+
} else if (count === 0) {
|
| 587 |
+
hint = 'Select one or more moves to upload and share with the community.';
|
| 588 |
} else {
|
| 589 |
+
hint = `Ready to share ${count} ${count === 1 ? 'move' : 'moves'} with the community.`;
|
| 590 |
}
|
| 591 |
+
if (!hfUsername) {
|
| 592 |
+
hint += ' Log in to Hugging Face in Settings to publish.';
|
| 593 |
+
}
|
| 594 |
+
|
| 595 |
+
$uploadBar.style.display = 'flex';
|
| 596 |
+
$uploadCount.textContent = count + ' selected';
|
| 597 |
+
if ($uploadHint) $uploadHint.textContent = hint;
|
| 598 |
+
$uploadBtn.disabled = !hfUsername || count === 0;
|
| 599 |
}
|
| 600 |
|
| 601 |
|
marionette/static/style.css
CHANGED
|
@@ -552,8 +552,8 @@ input[type=number] { -moz-appearance: textfield; }
|
|
| 552 |
Layout per move card:
|
| 553 |
[checkbox] [name + metadata] [play] [delete]
|
| 554 |
|
| 555 |
-
Checkboxes are for batch upload to Hugging Face.
|
| 556 |
-
|
| 557 |
|
| 558 |
INTEGRATION: renderMoves() is called from updateUI() on every
|
| 559 |
state poll. It rebuilds the DOM from state.moves[]. The move
|
|
@@ -587,10 +587,12 @@ input[type=number] { -moz-appearance: textfield; }
|
|
| 587 |
flex-wrap: wrap;
|
| 588 |
}
|
| 589 |
|
| 590 |
-
/* Orange upload bar β
|
| 591 |
.upload-bar {
|
| 592 |
display: flex;
|
| 593 |
align-items: center;
|
|
|
|
|
|
|
| 594 |
gap: .75rem;
|
| 595 |
padding: .5rem .85rem;
|
| 596 |
background: rgba(251,146,60,.06);
|
|
@@ -602,6 +604,12 @@ input[type=number] { -moz-appearance: textfield; }
|
|
| 602 |
color: var(--orange);
|
| 603 |
font-weight: 600;
|
| 604 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 605 |
.upload-btn {
|
| 606 |
padding: .45rem 1rem;
|
| 607 |
border-radius: 8px;
|
|
|
|
| 552 |
Layout per move card:
|
| 553 |
[checkbox] [name + metadata] [play] [delete]
|
| 554 |
|
| 555 |
+
Checkboxes are for batch upload to Hugging Face. The upload bar stays
|
| 556 |
+
visible above the list so users discover the selection workflow.
|
| 557 |
|
| 558 |
INTEGRATION: renderMoves() is called from updateUI() on every
|
| 559 |
state poll. It rebuilds the DOM from state.moves[]. The move
|
|
|
|
| 587 |
flex-wrap: wrap;
|
| 588 |
}
|
| 589 |
|
| 590 |
+
/* Orange upload bar β always visible to hint batch-upload workflow */
|
| 591 |
.upload-bar {
|
| 592 |
display: flex;
|
| 593 |
align-items: center;
|
| 594 |
+
flex-wrap: wrap;
|
| 595 |
+
justify-content: flex-end;
|
| 596 |
gap: .75rem;
|
| 597 |
padding: .5rem .85rem;
|
| 598 |
background: rgba(251,146,60,.06);
|
|
|
|
| 604 |
color: var(--orange);
|
| 605 |
font-weight: 600;
|
| 606 |
}
|
| 607 |
+
.upload-bar .upload-hint {
|
| 608 |
+
font-size: .75rem;
|
| 609 |
+
color: var(--text-muted);
|
| 610 |
+
max-width: 22rem;
|
| 611 |
+
line-height: 1.35;
|
| 612 |
+
}
|
| 613 |
.upload-btn {
|
| 614 |
padding: .45rem 1rem;
|
| 615 |
border-radius: 8px;
|
tests/e2e/test_ui.py
CHANGED
|
@@ -713,10 +713,11 @@ class TestHfUploadSection:
|
|
| 713 |
def test_upload_button_disabled_without_selection(self, page: Page, base_url: str):
|
| 714 |
page.goto(base_url)
|
| 715 |
page.wait_for_timeout(2000)
|
| 716 |
-
# Upload bar is hidden when no moves are selected
|
| 717 |
upload_bar = page.locator("#upload-bar")
|
| 718 |
-
|
| 719 |
-
expect(
|
|
|
|
|
|
|
| 720 |
|
| 721 |
|
| 722 |
# ββββββββ Responsiveness tests βββββββββββββββββββββββββββββββββββββββ
|
|
|
|
| 713 |
def test_upload_button_disabled_without_selection(self, page: Page, base_url: str):
|
| 714 |
page.goto(base_url)
|
| 715 |
page.wait_for_timeout(2000)
|
|
|
|
| 716 |
upload_bar = page.locator("#upload-bar")
|
| 717 |
+
expect(upload_bar).to_be_visible()
|
| 718 |
+
expect(page.locator("#upload-count")).to_have_text("0 selected")
|
| 719 |
+
expect(page.locator("#upload-hint")).to_contain_text("community")
|
| 720 |
+
expect(page.locator("#upload-btn")).to_be_disabled()
|
| 721 |
|
| 722 |
|
| 723 |
# ββββββββ Responsiveness tests βββββββββββββββββββββββββββββββββββββββ
|