From 5849a2778671dcc4da06b13f4a91b2051b1439d7 Mon Sep 17 00:00:00 2001 From: zurdi Date: Thu, 17 Sep 2026 11:41:02 +0200 Subject: [PATCH 1/6] fix(v2): move the soundtrack and manual upload into a section header The Soundtrack and Manual subtabs put Upload in a full-width button under their viewer, unlike the Files, Screenshots and Save data tabs, which host it in a header above the content. Both now use that header, with Upload pushed to the right next to the manual entry selector when there is one. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01CZ7NE6z9cJ8zsT3TsCtQds --- .../components/GameDetails/ManualSubtab.vue | 38 ++++++++++------- .../v2/components/GameDetails/MediaTab.vue | 41 +++++++++++-------- 2 files changed, 47 insertions(+), 32 deletions(-) diff --git a/frontend/src/v2/components/GameDetails/ManualSubtab.vue b/frontend/src/v2/components/GameDetails/ManualSubtab.vue index 6312d57a1..8365333bf 100644 --- a/frontend/src/v2/components/GameDetails/ManualSubtab.vue +++ b/frontend/src/v2/components/GameDetails/ManualSubtab.vue @@ -125,6 +125,9 @@ const manualItems = computed(() => // The filled viewer is wrapped in an overlay RDropzone (drag files onto the // manual to add another); the header's Upload button opens its picker. const manualDz = ref | null>(null); +const canUploadMore = computed( + () => manualEntries.value.length > 0 && canEdit.value, +); const redownloadingManual = ref(false); function handleManualFiles(files: File[]) { @@ -167,10 +170,13 @@ function requestDeleteManual() { @@ -300,6 +304,10 @@ function requestDeleteManual() { flex-shrink: 1; } +.r-v2-manual__upload { + margin-left: auto; +} + /* Overlay-mode RDropzone wrapping the viewer must fill the panel height so the inner viewer can stretch to 100%. The min-height keeps the flex chain from collapsing the viewer to zero. */ diff --git a/frontend/src/v2/components/GameDetails/MediaTab.vue b/frontend/src/v2/components/GameDetails/MediaTab.vue index cac190673..24ee79601 100644 --- a/frontend/src/v2/components/GameDetails/MediaTab.vue +++ b/frontend/src/v2/components/GameDetails/MediaTab.vue @@ -231,6 +231,22 @@ async function deleteSoundtrack(fileId: number) {
+
+
+ + {{ t("common.upload") }} + +
+
+ - -
-
- - {{ t("common.upload") }} - -
-
@@ -373,9 +375,14 @@ async function deleteSoundtrack(fileId: number) { min-height: 0; } -/* Section footer. The sidebar's subtab label already - names the section, so the header skips the title and hosts the - contextual controls only: the action cluster pushed to the right. */ +/* The sidebar's subtab label already names the section, so the header skips + the title and pushes the action cluster to the right. */ +.r-v2-media__section-head { + display: flex; + align-items: center; + gap: 12px; + flex-shrink: 0; +} .r-v2-media__section-actions { margin-left: auto; display: flex; From 0d738e34352c3b455a7e8336494e3c2f0f1a484c Mon Sep 17 00:00:00 2001 From: zurdi Date: Thu, 17 Sep 2026 11:41:30 +0200 Subject: [PATCH 2/6] feat(v2): upload into a folder from All files through a grouped picker All files has no destination of its own, so its header now offers only "Upload to folder", styled like Upload, and folder subtabs keep only Upload. The destination picker leads with "New folder" set apart by a divider, defaults to Root, and shows each folder with its subtab icon. RSelect gains `dividerAfter` for grouped menus, plus an `#append-label` well mirroring the inline prefix label, which `info` fills with an info icon and tooltip read as the field's description. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01CZ7NE6z9cJ8zsT3TsCtQds --- frontend/src/locales/bg_BG/rom.json | 4 +- frontend/src/locales/cs_CZ/rom.json | 4 +- frontend/src/locales/de_DE/rom.json | 4 +- frontend/src/locales/en_GB/rom.json | 4 +- frontend/src/locales/en_US/rom.json | 4 +- frontend/src/locales/es_ES/rom.json | 4 +- frontend/src/locales/fr_FR/rom.json | 4 +- frontend/src/locales/hu_HU/rom.json | 4 +- frontend/src/locales/it_IT/rom.json | 4 +- frontend/src/locales/ja_JP/rom.json | 4 +- frontend/src/locales/ko_KR/rom.json | 4 +- frontend/src/locales/pl_PL/rom.json | 4 +- frontend/src/locales/pt_BR/rom.json | 4 +- frontend/src/locales/ro_RO/rom.json | 4 +- frontend/src/locales/ru_RU/rom.json | 4 +- frontend/src/locales/tr_TR/rom.json | 4 +- frontend/src/locales/zh_CN/rom.json | 4 +- frontend/src/locales/zh_TW/rom.json | 4 +- .../GameDetails/FilesTab/FilesTab.test.ts | 20 +- .../GameDetails/FilesTab/FilesTab.vue | 48 ++--- .../FilesTab/UploadFilesDialog.test.ts | 27 +-- .../FilesTab/UploadFilesDialog.vue | 48 ++++- .../v2/lib/forms/RSelect/RSelect.stories.ts | 48 +++++ .../src/v2/lib/forms/RSelect/RSelect.test.ts | 99 ++++++++++ frontend/src/v2/lib/forms/RSelect/RSelect.vue | 183 +++++++++++++----- 25 files changed, 410 insertions(+), 135 deletions(-) diff --git a/frontend/src/locales/bg_BG/rom.json b/frontend/src/locales/bg_BG/rom.json index 0ae98dc47..9074c6fec 100644 --- a/frontend/src/locales/bg_BG/rom.json +++ b/frontend/src/locales/bg_BG/rom.json @@ -487,7 +487,7 @@ "upload-file-failed": "Неуспешно качване на {name}: {error}", "upload-file-rejected": "{name} беше отхвърлен: {error}", "upload-manual": "Upload manual", - "upload-new-folder": "Нова папка…", + "upload-new-folder": "Нова папка", "upload-new-folder-hint": "Спрямо папката на играта, напр. hack/v2", "upload-overwrite-body": "{names} вече съществува в тази папка и ще бъде заменен от новото качване. | {names} вече съществуват в тази папка и ще бъдат заменени от новите качвания.", "upload-overwrite-title": "Презаписване на {n} съществуващ файл? | Презаписване на {n} съществуващи файла?", @@ -496,7 +496,7 @@ "upload-slot-hint": "Записите в слот се синхронизират с устройствата; без слот файлът остава ръчен архив.", "upload-soundtrack": "Upload soundtrack", "upload-states": "Качи бързи записи", - "upload-to-folder": "Качи в папка…", + "upload-to-folder": "Качи в папка", "upload-tracks": "Add tracks", "upload-walkthrough": "Upload walkthrough", "verification": "Потвърждение", diff --git a/frontend/src/locales/cs_CZ/rom.json b/frontend/src/locales/cs_CZ/rom.json index e5ddae9cd..65fca95e0 100644 --- a/frontend/src/locales/cs_CZ/rom.json +++ b/frontend/src/locales/cs_CZ/rom.json @@ -487,7 +487,7 @@ "upload-file-failed": "Nelze nahrát {name}: {error}", "upload-file-rejected": "{name} byl odmítnut: {error}", "upload-manual": "Upload manual", - "upload-new-folder": "Nová složka…", + "upload-new-folder": "Nová složka", "upload-new-folder-hint": "Relativně ke složce hry, např. hack/v2", "upload-overwrite-body": "{names} v této složce již existuje a bude nahrazen novým nahráním. | {names} v této složce již existují a budou nahrazeny novými nahráními.", "upload-overwrite-title": "Přepsat {n} existující soubor? | Přepsat {n} existující soubory?", @@ -496,7 +496,7 @@ "upload-slot-hint": "Uložené pozice ve slotu se synchronizují se zařízeními; bez slotu zůstává soubor ručním archivem.", "upload-soundtrack": "Upload soundtrack", "upload-states": "Nahrát stavy", - "upload-to-folder": "Nahrát do složky…", + "upload-to-folder": "Nahrát do složky", "upload-tracks": "Add tracks", "upload-walkthrough": "Upload walkthrough", "verification": "Ověření", diff --git a/frontend/src/locales/de_DE/rom.json b/frontend/src/locales/de_DE/rom.json index 65b6b2714..f276a517f 100644 --- a/frontend/src/locales/de_DE/rom.json +++ b/frontend/src/locales/de_DE/rom.json @@ -487,7 +487,7 @@ "upload-file-failed": "{name} konnte nicht hochgeladen werden: {error}", "upload-file-rejected": "{name} wurde abgelehnt: {error}", "upload-manual": "Upload manual", - "upload-new-folder": "Neuer Ordner…", + "upload-new-folder": "Neuer Ordner", "upload-new-folder-hint": "Relativ zum Spielordner, z. B. hack/v2", "upload-overwrite-body": "{names} existiert bereits in diesem Ordner und wird durch den neuen Upload ersetzt. | {names} existieren bereits in diesem Ordner und werden durch die neuen Uploads ersetzt.", "upload-overwrite-title": "{n} vorhandene Datei überschreiben? | {n} vorhandene Dateien überschreiben?", @@ -496,7 +496,7 @@ "upload-slot-hint": "Spielstände in einem Slot nehmen an der Gerätesynchronisierung teil; ohne Slot bleibt die Datei ein manuelles Archiv.", "upload-soundtrack": "Upload soundtrack", "upload-states": "Zustände hochladen", - "upload-to-folder": "In Ordner hochladen…", + "upload-to-folder": "In Ordner hochladen", "upload-tracks": "Add tracks", "upload-walkthrough": "Upload walkthrough", "verification": "Verifizierung", diff --git a/frontend/src/locales/en_GB/rom.json b/frontend/src/locales/en_GB/rom.json index 3c0d36fe0..69f42ceaf 100644 --- a/frontend/src/locales/en_GB/rom.json +++ b/frontend/src/locales/en_GB/rom.json @@ -487,7 +487,7 @@ "upload-file-failed": "Unable to upload {name}: {error}", "upload-file-rejected": "{name} was rejected: {error}", "upload-manual": "Upload manual", - "upload-new-folder": "New folder…", + "upload-new-folder": "New folder", "upload-new-folder-hint": "Relative to the game folder, e.g. hack/v2", "upload-overwrite-body": "{names} already exists in this folder and will be replaced by the new upload. | {names} already exist in this folder and will be replaced by the new uploads.", "upload-overwrite-title": "Overwrite {n} existing file? | Overwrite {n} existing files?", @@ -496,7 +496,7 @@ "upload-slot-hint": "Slotted saves join device sync; without a slot the file stays a manual archive.", "upload-soundtrack": "Upload soundtrack", "upload-states": "Upload states", - "upload-to-folder": "Upload to folder…", + "upload-to-folder": "Upload to folder", "upload-tracks": "Add tracks", "upload-walkthrough": "Upload walkthrough", "verification": "Verification", diff --git a/frontend/src/locales/en_US/rom.json b/frontend/src/locales/en_US/rom.json index 18b67a78d..efefc3a1e 100644 --- a/frontend/src/locales/en_US/rom.json +++ b/frontend/src/locales/en_US/rom.json @@ -487,7 +487,7 @@ "upload-file-failed": "Unable to upload {name}: {error}", "upload-file-rejected": "{name} was rejected: {error}", "upload-manual": "Upload manual", - "upload-new-folder": "New folder…", + "upload-new-folder": "New folder", "upload-new-folder-hint": "Relative to the game folder, e.g. hack/v2", "upload-overwrite-body": "{names} already exists in this folder and will be replaced by the new upload. | {names} already exist in this folder and will be replaced by the new uploads.", "upload-overwrite-title": "Overwrite {n} existing file? | Overwrite {n} existing files?", @@ -496,7 +496,7 @@ "upload-slot-hint": "Slotted saves join device sync; without a slot the file stays a manual archive.", "upload-soundtrack": "Upload soundtrack", "upload-states": "Upload states", - "upload-to-folder": "Upload to folder…", + "upload-to-folder": "Upload to folder", "upload-tracks": "Upload tracks", "upload-walkthrough": "Upload walkthrough", "verification": "Verification", diff --git a/frontend/src/locales/es_ES/rom.json b/frontend/src/locales/es_ES/rom.json index 1aa17506f..f16aee7ac 100644 --- a/frontend/src/locales/es_ES/rom.json +++ b/frontend/src/locales/es_ES/rom.json @@ -487,7 +487,7 @@ "upload-file-failed": "No se pudo subir {name}: {error}", "upload-file-rejected": "{name} fue rechazado: {error}", "upload-manual": "Upload manual", - "upload-new-folder": "Nueva carpeta…", + "upload-new-folder": "Nueva carpeta", "upload-new-folder-hint": "Relativa a la carpeta del juego, p. ej. hack/v2", "upload-overwrite-body": "{names} ya existe en esta carpeta y se reemplazará con la nueva subida. | {names} ya existen en esta carpeta y se reemplazarán con las nuevas subidas.", "upload-overwrite-title": "¿Sobrescribir {n} archivo existente? | ¿Sobrescribir {n} archivos existentes?", @@ -496,7 +496,7 @@ "upload-slot-hint": "Las partidas con ranura entran en la sincronización de dispositivos; sin ranura el archivo queda como copia manual.", "upload-soundtrack": "Upload soundtrack", "upload-states": "Subir estados", - "upload-to-folder": "Subir a carpeta…", + "upload-to-folder": "Subir a carpeta", "upload-tracks": "Add tracks", "upload-walkthrough": "Upload walkthrough", "verification": "Verificación", diff --git a/frontend/src/locales/fr_FR/rom.json b/frontend/src/locales/fr_FR/rom.json index a2b6d7304..92cbf7a50 100644 --- a/frontend/src/locales/fr_FR/rom.json +++ b/frontend/src/locales/fr_FR/rom.json @@ -487,7 +487,7 @@ "upload-file-failed": "Impossible de téléverser {name} : {error}", "upload-file-rejected": "{name} a été rejeté : {error}", "upload-manual": "Upload manual", - "upload-new-folder": "Nouveau dossier…", + "upload-new-folder": "Nouveau dossier", "upload-new-folder-hint": "Relatif au dossier du jeu, par ex. hack/v2", "upload-overwrite-body": "{names} existe déjà dans ce dossier et sera remplacé par le nouvel envoi. | {names} existent déjà dans ce dossier et seront remplacés par les nouveaux envois.", "upload-overwrite-title": "Écraser {n} fichier existant ? | Écraser {n} fichiers existants ?", @@ -496,7 +496,7 @@ "upload-slot-hint": "Les sauvegardes dans un emplacement rejoignent la synchronisation des appareils ; sans emplacement, le fichier reste une archive manuelle.", "upload-soundtrack": "Upload soundtrack", "upload-states": "Téléverser des états", - "upload-to-folder": "Téléverser dans un dossier…", + "upload-to-folder": "Téléverser dans un dossier", "upload-tracks": "Add tracks", "upload-walkthrough": "Upload walkthrough", "verification": "Vérification", diff --git a/frontend/src/locales/hu_HU/rom.json b/frontend/src/locales/hu_HU/rom.json index c4bc50b95..2c7f2cedb 100644 --- a/frontend/src/locales/hu_HU/rom.json +++ b/frontend/src/locales/hu_HU/rom.json @@ -487,7 +487,7 @@ "upload-file-failed": "{name} feltöltése nem sikerült: {error}", "upload-file-rejected": "{name} elutasítva: {error}", "upload-manual": "Upload manual", - "upload-new-folder": "Új mappa…", + "upload-new-folder": "Új mappa", "upload-new-folder-hint": "A játék mappájához képest, pl. hack/v2", "upload-overwrite-body": "{names} már létezik ebben a mappában, és az új feltöltés felülírja. | {names} már léteznek ebben a mappában, és az új feltöltések felülírják.", "upload-overwrite-title": "Felülírja a(z) {n} meglévő fájlt? | Felülírja a(z) {n} meglévő fájlt?", @@ -496,7 +496,7 @@ "upload-slot-hint": "A helyre tett mentések részt vesznek az eszközszinkronban; hely nélkül a fájl kézi archívum marad.", "upload-soundtrack": "Upload soundtrack", "upload-states": "Állások feltöltése", - "upload-to-folder": "Feltöltés mappába…", + "upload-to-folder": "Feltöltés mappába", "upload-tracks": "Add tracks", "upload-walkthrough": "Upload walkthrough", "verification": "Ellenőrzés", diff --git a/frontend/src/locales/it_IT/rom.json b/frontend/src/locales/it_IT/rom.json index b3d8c61a8..b5912dcfc 100644 --- a/frontend/src/locales/it_IT/rom.json +++ b/frontend/src/locales/it_IT/rom.json @@ -487,7 +487,7 @@ "upload-file-failed": "Impossibile caricare {name}: {error}", "upload-file-rejected": "{name} è stato rifiutato: {error}", "upload-manual": "Upload manual", - "upload-new-folder": "Nuova cartella…", + "upload-new-folder": "Nuova cartella", "upload-new-folder-hint": "Relativo alla cartella del gioco, es. hack/v2", "upload-overwrite-body": "{names} esiste già in questa cartella e verrà sostituito dal nuovo caricamento. | {names} esistono già in questa cartella e verranno sostituiti dai nuovi caricamenti.", "upload-overwrite-title": "Sovrascrivere {n} file esistente? | Sovrascrivere {n} file esistenti?", @@ -496,7 +496,7 @@ "upload-slot-hint": "I salvataggi in uno slot entrano nella sincronizzazione dei dispositivi; senza slot il file resta un archivio manuale.", "upload-soundtrack": "Upload soundtrack", "upload-states": "Carica stati", - "upload-to-folder": "Carica in cartella…", + "upload-to-folder": "Carica in cartella", "upload-tracks": "Add tracks", "upload-walkthrough": "Upload walkthrough", "verification": "Verifica", diff --git a/frontend/src/locales/ja_JP/rom.json b/frontend/src/locales/ja_JP/rom.json index d49c2eafc..256329e55 100644 --- a/frontend/src/locales/ja_JP/rom.json +++ b/frontend/src/locales/ja_JP/rom.json @@ -487,7 +487,7 @@ "upload-file-failed": "{name} をアップロードできません: {error}", "upload-file-rejected": "{name} は拒否されました: {error}", "upload-manual": "Upload manual", - "upload-new-folder": "新しいフォルダ…", + "upload-new-folder": "新しいフォルダ", "upload-new-folder-hint": "ゲームフォルダからの相対パス (例: hack/v2)", "upload-overwrite-body": "{names} はこのフォルダにすでに存在し、新しいアップロードで置き換えられます。 | {names} はこのフォルダにすでに存在し、新しいアップロードで置き換えられます。", "upload-overwrite-title": "既存の {n} 件のファイルを上書きしますか? | 既存の {n} 件のファイルを上書きしますか?", @@ -496,7 +496,7 @@ "upload-slot-hint": "スロット付きのセーブは端末間で同期されます。スロットなしのファイルは手動のアーカイブとして保持されます。", "upload-soundtrack": "Upload soundtrack", "upload-states": "ステートセーブをアップロード", - "upload-to-folder": "フォルダにアップロード…", + "upload-to-folder": "フォルダにアップロード", "upload-tracks": "Add tracks", "upload-walkthrough": "Upload walkthrough", "verification": "検証", diff --git a/frontend/src/locales/ko_KR/rom.json b/frontend/src/locales/ko_KR/rom.json index f75dcd700..0ec7d1e34 100644 --- a/frontend/src/locales/ko_KR/rom.json +++ b/frontend/src/locales/ko_KR/rom.json @@ -487,7 +487,7 @@ "upload-file-failed": "{name}을(를) 업로드할 수 없습니다: {error}", "upload-file-rejected": "{name}이(가) 거부되었습니다: {error}", "upload-manual": "Upload manual", - "upload-new-folder": "새 폴더…", + "upload-new-folder": "새 폴더", "upload-new-folder-hint": "게임 폴더 기준 상대 경로, 예: hack/v2", "upload-overwrite-body": "{names}은(는) 이 폴더에 이미 존재하며 새 업로드로 대체됩니다. | {names}은(는) 이 폴더에 이미 존재하며 새 업로드로 대체됩니다.", "upload-overwrite-title": "기존 파일 {n}개를 덮어쓸까요? | 기존 파일 {n}개를 덮어쓸까요?", @@ -496,7 +496,7 @@ "upload-slot-hint": "슬롯이 있는 세이브는 기기 동기화에 포함됩니다. 슬롯이 없으면 파일은 수동 보관본으로 남습니다.", "upload-soundtrack": "Upload soundtrack", "upload-states": "상태 업로드", - "upload-to-folder": "폴더에 업로드…", + "upload-to-folder": "폴더에 업로드", "upload-tracks": "Add tracks", "upload-walkthrough": "Upload walkthrough", "verification": "검증", diff --git a/frontend/src/locales/pl_PL/rom.json b/frontend/src/locales/pl_PL/rom.json index 91b37ca00..ecf2bb762 100644 --- a/frontend/src/locales/pl_PL/rom.json +++ b/frontend/src/locales/pl_PL/rom.json @@ -487,7 +487,7 @@ "upload-file-failed": "Nie można przesłać {name}: {error}", "upload-file-rejected": "{name} został odrzucony: {error}", "upload-manual": "Upload manual", - "upload-new-folder": "Nowy folder…", + "upload-new-folder": "Nowy folder", "upload-new-folder-hint": "Względem folderu gry, np. hack/v2", "upload-overwrite-body": "{names} już istnieje w tym folderze i zostanie zastąpiony nowym plikiem. | {names} już istnieją w tym folderze i zostaną zastąpione nowymi plikami.", "upload-overwrite-title": "Nadpisać {n} istniejący plik? | Nadpisać {n} istniejące pliki?", @@ -496,7 +496,7 @@ "upload-slot-hint": "Zapisy w slocie biorą udział w synchronizacji urządzeń; bez slotu plik pozostaje ręcznym archiwum.", "upload-soundtrack": "Upload soundtrack", "upload-states": "Prześlij stany", - "upload-to-folder": "Prześlij do folderu…", + "upload-to-folder": "Prześlij do folderu", "upload-tracks": "Add tracks", "upload-walkthrough": "Upload walkthrough", "verification": "Weryfikacja", diff --git a/frontend/src/locales/pt_BR/rom.json b/frontend/src/locales/pt_BR/rom.json index 3948c45fa..1411d1301 100644 --- a/frontend/src/locales/pt_BR/rom.json +++ b/frontend/src/locales/pt_BR/rom.json @@ -487,7 +487,7 @@ "upload-file-failed": "Não foi possível enviar {name}: {error}", "upload-file-rejected": "{name} foi rejeitado: {error}", "upload-manual": "Enviar manual", - "upload-new-folder": "Nova pasta…", + "upload-new-folder": "Nova pasta", "upload-new-folder-hint": "Relativo à pasta do jogo, ex.: hack/v2", "upload-overwrite-body": "{names} já existe nesta pasta e será substituído pelo novo envio. | {names} já existem nesta pasta e serão substituídos pelos novos envios.", "upload-overwrite-title": "Sobrescrever {n} arquivo existente? | Sobrescrever {n} arquivos existentes?", @@ -496,7 +496,7 @@ "upload-slot-hint": "Saves em um slot entram na sincronização de dispositivos; sem slot o arquivo fica como cópia manual.", "upload-soundtrack": "Enviar trilha sonora", "upload-states": "Enviar states", - "upload-to-folder": "Enviar para pasta…", + "upload-to-folder": "Enviar para pasta", "upload-tracks": "Enviar faixas", "upload-walkthrough": "Upload walkthrough", "verification": "Verificação", diff --git a/frontend/src/locales/ro_RO/rom.json b/frontend/src/locales/ro_RO/rom.json index a4b04940f..97fb6e4c3 100644 --- a/frontend/src/locales/ro_RO/rom.json +++ b/frontend/src/locales/ro_RO/rom.json @@ -487,7 +487,7 @@ "upload-file-failed": "Nu s-a putut încărca {name}: {error}", "upload-file-rejected": "{name} a fost respins: {error}", "upload-manual": "Upload manual", - "upload-new-folder": "Folder nou…", + "upload-new-folder": "Folder nou", "upload-new-folder-hint": "Relativ la folderul jocului, de ex. hack/v2", "upload-overwrite-body": "{names} există deja în acest folder și va fi înlocuit de noua încărcare. | {names} există deja în acest folder și vor fi înlocuite de noile încărcări.", "upload-overwrite-title": "Suprascrii {n} fișier existent? | Suprascrii {n} fișiere existente?", @@ -496,7 +496,7 @@ "upload-slot-hint": "Salvările dintr-un slot intră în sincronizarea dispozitivelor; fără slot fișierul rămâne o arhivă manuală.", "upload-soundtrack": "Upload soundtrack", "upload-states": "Încarcă stări", - "upload-to-folder": "Încarcă în folder…", + "upload-to-folder": "Încarcă în folder", "upload-tracks": "Add tracks", "upload-walkthrough": "Upload walkthrough", "verification": "Verificare", diff --git a/frontend/src/locales/ru_RU/rom.json b/frontend/src/locales/ru_RU/rom.json index 2c436e476..b8a8b56a0 100644 --- a/frontend/src/locales/ru_RU/rom.json +++ b/frontend/src/locales/ru_RU/rom.json @@ -487,7 +487,7 @@ "upload-file-failed": "Не удалось загрузить {name}: {error}", "upload-file-rejected": "{name} отклонён: {error}", "upload-manual": "Upload manual", - "upload-new-folder": "Новая папка…", + "upload-new-folder": "Новая папка", "upload-new-folder-hint": "Относительно папки игры, например hack/v2", "upload-overwrite-body": "{names} уже существует в этой папке и будет заменён новой загрузкой. | {names} уже существуют в этой папке и будут заменены новыми загрузками.", "upload-overwrite-title": "Перезаписать {n} существующий файл? | Перезаписать {n} существующих файлов?", @@ -496,7 +496,7 @@ "upload-slot-hint": "Сохранения в слоте участвуют в синхронизации устройств; без слота файл остаётся ручным архивом.", "upload-soundtrack": "Upload soundtrack", "upload-states": "Загрузить состояния", - "upload-to-folder": "Загрузить в папку…", + "upload-to-folder": "Загрузить в папку", "upload-tracks": "Add tracks", "upload-walkthrough": "Upload walkthrough", "verification": "Проверка", diff --git a/frontend/src/locales/tr_TR/rom.json b/frontend/src/locales/tr_TR/rom.json index 2fbb88b80..114073d6a 100644 --- a/frontend/src/locales/tr_TR/rom.json +++ b/frontend/src/locales/tr_TR/rom.json @@ -487,7 +487,7 @@ "upload-file-failed": "{name} yüklenemedi: {error}", "upload-file-rejected": "{name} reddedildi: {error}", "upload-manual": "Kılavuz yükle", - "upload-new-folder": "Yeni klasör…", + "upload-new-folder": "Yeni klasör", "upload-new-folder-hint": "Oyun klasörüne göre, örn. hack/v2", "upload-overwrite-body": "{names} bu klasörde zaten mevcut ve yeni yüklemeyle değiştirilecek. | {names} bu klasörde zaten mevcut ve yeni yüklemelerle değiştirilecek.", "upload-overwrite-title": "{n} mevcut dosyanın üzerine yazılsın mı? | {n} mevcut dosyanın üzerine yazılsın mı?", @@ -496,7 +496,7 @@ "upload-slot-hint": "Yuvadaki kayıtlar cihaz eşitlemesine katılır; yuva yoksa dosya elle alınmış bir arşiv olarak kalır.", "upload-soundtrack": "Müzik paketi yükle", "upload-states": "Durum kaydı yükle", - "upload-to-folder": "Klasöre yükle…", + "upload-to-folder": "Klasöre yükle", "upload-tracks": "Parça yükle", "upload-walkthrough": "Upload walkthrough", "verification": "Doğrulama", diff --git a/frontend/src/locales/zh_CN/rom.json b/frontend/src/locales/zh_CN/rom.json index a4b888733..71ca7ee8f 100644 --- a/frontend/src/locales/zh_CN/rom.json +++ b/frontend/src/locales/zh_CN/rom.json @@ -487,7 +487,7 @@ "upload-file-failed": "无法上传 {name}:{error}", "upload-file-rejected": "{name} 已被拒绝:{error}", "upload-manual": "上传手册", - "upload-new-folder": "新建文件夹…", + "upload-new-folder": "新建文件夹", "upload-new-folder-hint": "相对于游戏文件夹,例如 hack/v2", "upload-overwrite-body": "{names} 已存在于此文件夹中,将被新上传的文件替换。 | {names} 已存在于此文件夹中,将被新上传的文件替换。", "upload-overwrite-title": "覆盖 {n} 个已有文件? | 覆盖 {n} 个已有文件?", @@ -496,7 +496,7 @@ "upload-slot-hint": "带存档位的存档会参与设备同步;没有存档位的文件将作为手动存档保留。", "upload-soundtrack": "上传原声音乐", "upload-states": "上传状态", - "upload-to-folder": "上传到文件夹…", + "upload-to-folder": "上传到文件夹", "upload-tracks": "Add tracks", "upload-walkthrough": "上传攻略", "verification": "验证", diff --git a/frontend/src/locales/zh_TW/rom.json b/frontend/src/locales/zh_TW/rom.json index bde18aff4..6eca6bc5f 100644 --- a/frontend/src/locales/zh_TW/rom.json +++ b/frontend/src/locales/zh_TW/rom.json @@ -487,7 +487,7 @@ "upload-file-failed": "無法上傳 {name}:{error}", "upload-file-rejected": "{name} 已被拒絕:{error}", "upload-manual": "Upload manual", - "upload-new-folder": "新增資料夾…", + "upload-new-folder": "新增資料夾", "upload-new-folder-hint": "相對於遊戲資料夾,例如 hack/v2", "upload-overwrite-body": "{names} 已存在於此資料夾中,將被新上傳的檔案取代。 | {names} 已存在於此資料夾中,將被新上傳的檔案取代。", "upload-overwrite-title": "覆蓋 {n} 個現有檔案? | 覆蓋 {n} 個現有檔案?", @@ -496,7 +496,7 @@ "upload-slot-hint": "有存檔槽的存檔會參與裝置同步;沒有存檔槽的檔案將作為手動存檔保留。", "upload-soundtrack": "Upload soundtrack", "upload-states": "上傳即時存檔", - "upload-to-folder": "上傳至資料夾…", + "upload-to-folder": "上傳至資料夾", "upload-tracks": "Add tracks", "upload-walkthrough": "Upload walkthrough", "verification": "驗證", diff --git a/frontend/src/v2/components/GameDetails/FilesTab/FilesTab.test.ts b/frontend/src/v2/components/GameDetails/FilesTab/FilesTab.test.ts index 6d4e38ab3..5b9c3e21b 100644 --- a/frontend/src/v2/components/GameDetails/FilesTab/FilesTab.test.ts +++ b/frontend/src/v2/components/GameDetails/FilesTab/FilesTab.test.ts @@ -94,9 +94,6 @@ function mountTab(r = rom()) { RCheckbox: true, REmptyState: true, RIcon: true, - RTooltip: { - template: `
`, - }, RBtn: { props: ["disabled", "icon"], emits: ["click"], @@ -108,10 +105,16 @@ function mountTab(r = rom()) { }); } +function buttonByLabel(wrapper: ReturnType, label: string) { + return wrapper.findAll("button.btn").find((b) => b.text() === label); +} + function uploadButton(wrapper: ReturnType) { - return wrapper - .findAll("button.btn") - .find((b) => b.text() === "common.upload"); + return buttonByLabel(wrapper, "common.upload"); +} + +function uploadToFolderButton(wrapper: ReturnType) { + return buttonByLabel(wrapper, "rom.upload-to-folder"); } async function pickFile(wrapper: ReturnType, name: string) { @@ -140,6 +143,7 @@ describe("FilesTab uploads", () => { const wrapper = mountTab(); expect(uploadButton(wrapper)).toBeUndefined(); + expect(uploadToFolderButton(wrapper)).toBeUndefined(); }); it("sends files straight into the active folder", async () => { @@ -147,6 +151,7 @@ describe("FilesTab uploads", () => { const click = vi.spyOn(HTMLInputElement.prototype, "click"); const wrapper = mountTab(); + expect(uploadToFolderButton(wrapper)).toBeUndefined(); await uploadButton(wrapper)!.trigger("click"); expect(click).toHaveBeenCalled(); await pickFile(wrapper, "fix.ips"); @@ -179,7 +184,8 @@ describe("FilesTab uploads", () => { it("asks for a destination from All files", async () => { const wrapper = mountTab(); - await uploadButton(wrapper)!.trigger("click"); + expect(uploadButton(wrapper)).toBeUndefined(); + await uploadToFolderButton(wrapper)!.trigger("click"); expect(wrapper.get(".dialog").attributes("data-open")).toBe("true"); const dialog = wrapper.findComponent(UploadFilesDialogStub); diff --git a/frontend/src/v2/components/GameDetails/FilesTab/FilesTab.vue b/frontend/src/v2/components/GameDetails/FilesTab/FilesTab.vue index 31c54a744..91b651a2a 100644 --- a/frontend/src/v2/components/GameDetails/FilesTab/FilesTab.vue +++ b/frontend/src/v2/components/GameDetails/FilesTab/FilesTab.vue @@ -19,8 +19,9 @@ // inside each row. // // Section header (per active subtab): -// * Upload: the active subtab supplies the destination folder; "All -// files" has none, so the dialog asks for one. +// * Upload: a folder subtab supplies the destination folder. +// * Upload to folder: "All files" has no destination of its own, so its +// dialog asks for one. // // Content column: // * Section header (Upload + Patch) @@ -35,7 +36,7 @@ // Selected files in the Files tab can be deleted by users with the // `rom.delete` permission. Each file is removed from disk and the DB // row is dropped via `DELETE /roms/{rom_id}/files/{file_id}`. -import { RBtn, RCheckbox, REmptyState, RIcon, RTooltip } from "@v2/lib"; +import { RBtn, RCheckbox, REmptyState, RIcon } from "@v2/lib"; import { computed, ref, watch } from "vue"; import { useI18n } from "vue-i18n"; import { useRoute, useRouter } from "vue-router"; @@ -549,11 +550,13 @@ const { uploading, uploadFiles: uploadRomFiles } = useRomFileUpload(); const uploadDialogOpen = ref(false); const alive = useIsAlive(); -const uploadFolders = computed(() => - subtabDefs.value +// Root is always a destination, even before any file sits there. +const uploadFolders = computed(() => [ + { value: "", label: folderLabel(ROOT), icon: folderIcon(ROOT) }, + ...subtabDefs.value .filter((s) => s.id !== "all" && s.id !== ROOT) - .map((s) => ({ value: s.id, label: s.label })), -); + .map((s) => ({ value: s.id, label: s.label, icon: s.icon })), +]); // Destination implied by the active subtab: "" for the ROM root, null // when there is none ("All files") and the dialog has to ask. @@ -565,8 +568,7 @@ const activeUploadFolder = computed(() => { function triggerUpload() { if (uploading.value) return; - if (activeUploadFolder.value === null) uploadDialogOpen.value = true; - else fileInput.value?.click(); + fileInput.value?.click(); } function onFilePick(event: Event) { @@ -607,7 +609,6 @@ async function refreshRom() { @@ -642,7 +643,7 @@ async function refreshRom() {
+ {{ t("rom.upload-to-folder") }} + + {{ t("common.upload") }} - - -
diff --git a/frontend/src/v2/components/GameDetails/FilesTab/UploadFilesDialog.test.ts b/frontend/src/v2/components/GameDetails/FilesTab/UploadFilesDialog.test.ts index 5489c6683..8d90853f0 100644 --- a/frontend/src/v2/components/GameDetails/FilesTab/UploadFilesDialog.test.ts +++ b/frontend/src/v2/components/GameDetails/FilesTab/UploadFilesDialog.test.ts @@ -48,12 +48,14 @@ const RBtn = { template: ``, }; -function mountDialog(initialFolder = "") { +function mountDialog() { return mount(UploadFilesDialog, { props: { modelValue: true, - folders: [{ value: "hack", label: "Hack", icon: "mdi-pencil-ruler" }], - initialFolder, + folders: [ + { value: "", label: "Root", icon: "mdi-folder-home-outline" }, + { value: "hack", label: "Hack", icon: "mdi-pencil-ruler" }, + ], }, global: { stubs: { @@ -92,14 +94,12 @@ describe("UploadFilesDialog", () => { expect(payload.files.map((f) => f.name)).toEqual(["fix.ips"]); }); - it("preselects the active folder", async () => { - const wrapper = mountDialog("hack"); - await wrapper.get(".dropzone").trigger("click"); - await uploadButton(wrapper).trigger("click"); - await nextTick(); + it("offers a new folder ahead of the existing destinations", () => { + const wrapper = mountDialog(); - const [payload] = wrapper.emitted("submit")![0] as [{ folder: string }]; - expect(payload.folder).toBe("hack"); + expect( + wrapper.findAll("select.dest option").map((o) => o.attributes("value")), + ).toEqual(["__new__", "", "hack"]); }); it("trims a new folder path before emitting it", async () => { @@ -127,15 +127,16 @@ describe("UploadFilesDialog", () => { formValid.value = true; }); - it("starts fresh every time it opens", async () => { + it("starts fresh on the root every time it opens", async () => { const wrapper = mountDialog(); + await wrapper.get("select.dest").setValue("hack"); await wrapper.get(".dropzone").trigger("click"); await wrapper.setProps({ modelValue: false }); - await wrapper.setProps({ modelValue: true, initialFolder: "hack" }); + await wrapper.setProps({ modelValue: true }); expect(uploadButton(wrapper).attributes("disabled")).toBeDefined(); expect( (wrapper.get("select.dest").element as HTMLSelectElement).value, - ).toBe("hack"); + ).toBe(""); }); }); diff --git a/frontend/src/v2/components/GameDetails/FilesTab/UploadFilesDialog.vue b/frontend/src/v2/components/GameDetails/FilesTab/UploadFilesDialog.vue index d506a350a..06ad5afda 100644 --- a/frontend/src/v2/components/GameDetails/FilesTab/UploadFilesDialog.vue +++ b/frontend/src/v2/components/GameDetails/FilesTab/UploadFilesDialog.vue @@ -1,7 +1,7 @@
@@ -1556,13 +1620,13 @@ const hasPrependInner = computed( align-self: flex-start; padding-inline-start: 2px; } -.r-select__label--inline { +.r-select__label--inline, +.r-select__label--append { align-self: stretch; display: inline-flex; align-items: center; padding: 0 10px; background: var(--r-color-bg-elevated); - border-right: 1px solid var(--r-color-border); font-size: 11px; font-weight: var(--r-font-weight-bold); letter-spacing: 0.08em; @@ -1573,15 +1637,42 @@ const hasPrependInner = computed( text-overflow: ellipsis; transition: background var(--r-motion-fast) var(--r-motion-ease-out), - border-right-color var(--r-motion-fast) var(--r-motion-ease-out), + border-color var(--r-motion-fast) var(--r-motion-ease-out), color var(--r-motion-fast) var(--r-motion-ease-out); } +.r-select__label--inline { + border-right: 1px solid var(--r-color-border); +} +.r-select__label--append { + flex-shrink: 0; + border-left: 1px solid var(--r-color-border); + cursor: default; +} .r-select--inline.r-select--focused .r-select__label--inline { border-right-color: var(--r-tf-color); } .r-select--inline.r-select--error .r-select__label--inline { border-right-color: var(--r-color-danger); } +.r-select--focused .r-select__label--append { + border-left-color: var(--r-tf-color); +} +.r-select--error .r-select__label--append { + border-left-color: var(--r-color-danger); +} +.r-select__field:has(.r-select__label--append) { + overflow: hidden; +} +/* Read through the field's aria-describedby; the tooltip shows it on + screen. */ +.r-select__info-text { + position: absolute; + width: 1px; + height: 1px; + overflow: hidden; + clip-path: inset(50%); + white-space: nowrap; +} .r-select--inline .r-select__field { padding-inline-start: 0; overflow: hidden; From 393e8bd08cb85c91003893293b9df6a831be2179 Mon Sep 17 00:00:00 2001 From: zurdi Date: Thu, 17 Sep 2026 11:41:33 +0200 Subject: [PATCH 3/6] feat(v2): lead slot pickers with a new slot and default uploads to autosave Both slot pickers, in the save upload dialog and the EmulatorJS player, list "+ New slot" first behind a divider. A save upload now starts on autosave, with No slot moved to the end, matching the slot grouping in the save list. The player's slot info moves from a loose button into the select's info well. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01CZ7NE6z9cJ8zsT3TsCtQds --- frontend/src/locales/bg_BG/play.json | 2 +- frontend/src/locales/cs_CZ/play.json | 2 +- frontend/src/locales/de_DE/play.json | 2 +- frontend/src/locales/en_GB/play.json | 2 +- frontend/src/locales/en_US/play.json | 2 +- frontend/src/locales/es_ES/play.json | 2 +- frontend/src/locales/fr_FR/play.json | 2 +- frontend/src/locales/hu_HU/play.json | 2 +- frontend/src/locales/it_IT/play.json | 2 +- frontend/src/locales/ja_JP/play.json | 2 +- frontend/src/locales/ko_KR/play.json | 2 +- frontend/src/locales/pl_PL/play.json | 2 +- frontend/src/locales/pt_BR/play.json | 2 +- frontend/src/locales/ro_RO/play.json | 2 +- frontend/src/locales/ru_RU/play.json | 2 +- frontend/src/locales/tr_TR/play.json | 2 +- frontend/src/locales/zh_CN/play.json | 2 +- frontend/src/locales/zh_TW/play.json | 2 +- .../GameDetails/UploadAssetDialog.test.ts | 25 ++++-- .../GameDetails/UploadAssetDialog.vue | 11 ++- frontend/src/v2/utils/saveSlots.test.ts | 6 +- frontend/src/v2/utils/saveSlots.ts | 9 +- frontend/src/v2/views/Player/EmulatorJS.vue | 82 +++++-------------- 23 files changed, 74 insertions(+), 95 deletions(-) diff --git a/frontend/src/locales/bg_BG/play.json b/frontend/src/locales/bg_BG/play.json index c9cf14826..696eb403d 100644 --- a/frontend/src/locales/bg_BG/play.json +++ b/frontend/src/locales/bg_BG/play.json @@ -107,7 +107,7 @@ "multiplayer-hint": "Показва бутон „Присъединяване“ на страницата на играта и запазва чата и уеб камерата видими.", "mute": "Заглушаване", "new-memory-card": "Нова карта", - "new-slot": "Нов слот…", + "new-slot": "+ Нов слот", "newer-save-warning": "Има запис от {time}, по-нов от избрания. Продължаването от избрания може да върне напредъка ти назад.", "newer-state-warning": "Има бърз запис от {time}, по-нов от избрания. Продължаването от избрания може да върне напредъка ти назад.", "no-memory-cards": "Все още няма карти памет", diff --git a/frontend/src/locales/cs_CZ/play.json b/frontend/src/locales/cs_CZ/play.json index 7900423a6..a51e1f780 100644 --- a/frontend/src/locales/cs_CZ/play.json +++ b/frontend/src/locales/cs_CZ/play.json @@ -107,7 +107,7 @@ "multiplayer-hint": "Na stránce hry se zobrazí tlačítko Připojit se a chat i webkamera zůstanou viditelné.", "mute": "Ztlumit", "new-memory-card": "Nová karta", - "new-slot": "Nový slot…", + "new-slot": "+ Nový slot", "newer-save-warning": "Uložená pozice z {time} je novější než vaše volba. Pokračování z ní může vrátit váš postup zpět.", "newer-state-warning": "Stav z {time} je novější než vaše volba. Pokračování z ní může vrátit váš postup zpět.", "no-memory-cards": "Zatím žádné paměťové karty", diff --git a/frontend/src/locales/de_DE/play.json b/frontend/src/locales/de_DE/play.json index b3e38202c..0cd2ad70b 100644 --- a/frontend/src/locales/de_DE/play.json +++ b/frontend/src/locales/de_DE/play.json @@ -107,7 +107,7 @@ "multiplayer-hint": "Zeigt auf der Seite dieses Spiels eine Schaltfläche zum Beitreten und hält Chat und Webcam sichtbar.", "mute": "Stummschalten", "new-memory-card": "Neue Karte", - "new-slot": "Neuer Slot…", + "new-slot": "+ Neuer Slot", "newer-save-warning": "Ein Spielstand von {time} ist neuer als deine Auswahl. Damit fortzusetzen kann deinen Fortschritt zurücksetzen.", "newer-state-warning": "Ein Zustand von {time} ist neuer als deine Auswahl. Damit fortzusetzen kann deinen Fortschritt zurücksetzen.", "no-memory-cards": "Noch keine Speicherkarten", diff --git a/frontend/src/locales/en_GB/play.json b/frontend/src/locales/en_GB/play.json index e8838a0f0..015cd3cbd 100644 --- a/frontend/src/locales/en_GB/play.json +++ b/frontend/src/locales/en_GB/play.json @@ -107,7 +107,7 @@ "multiplayer-hint": "Shows a Join button on this game's page and keeps chat and webcam visible.", "mute": "Mute", "new-memory-card": "New card", - "new-slot": "New slot…", + "new-slot": "+ New slot", "newer-save-warning": "A save from {time} is newer than your pick. Resuming it may roll your progress back.", "newer-state-warning": "A state from {time} is newer than your pick. Resuming it may roll your progress back.", "no-memory-cards": "No memory cards yet", diff --git a/frontend/src/locales/en_US/play.json b/frontend/src/locales/en_US/play.json index 9a8fecf31..65efe65cb 100644 --- a/frontend/src/locales/en_US/play.json +++ b/frontend/src/locales/en_US/play.json @@ -107,7 +107,7 @@ "multiplayer-hint": "Shows a Join button on this game's page and keeps chat and webcam visible.", "mute": "Mute", "new-memory-card": "New card", - "new-slot": "New slot…", + "new-slot": "+ New slot", "newer-save-warning": "A save from {time} is newer than your pick. Resuming it may roll your progress back.", "newer-state-warning": "A state from {time} is newer than your pick. Resuming it may roll your progress back.", "no-memory-cards": "No memory cards yet", diff --git a/frontend/src/locales/es_ES/play.json b/frontend/src/locales/es_ES/play.json index 3d99765df..b1c372f57 100644 --- a/frontend/src/locales/es_ES/play.json +++ b/frontend/src/locales/es_ES/play.json @@ -107,7 +107,7 @@ "multiplayer-hint": "Muestra un botón Unirse en la página de este juego y mantiene visibles el chat y la cámara web.", "mute": "Silenciar", "new-memory-card": "Nueva tarjeta", - "new-slot": "Nueva ranura…", + "new-slot": "+ Nueva ranura", "newer-save-warning": "Hay una partida guardada de {time} más reciente que tu elección. Continuar con ella puede hacerte perder progreso.", "newer-state-warning": "Hay un estado de {time} más reciente que tu elección. Continuar con ella puede hacerte perder progreso.", "no-memory-cards": "Aún no hay tarjetas de memoria", diff --git a/frontend/src/locales/fr_FR/play.json b/frontend/src/locales/fr_FR/play.json index 7ac252e27..fe84f5371 100644 --- a/frontend/src/locales/fr_FR/play.json +++ b/frontend/src/locales/fr_FR/play.json @@ -107,7 +107,7 @@ "multiplayer-hint": "Affiche un bouton Rejoindre sur la page de ce jeu et garde le chat et la webcam visibles.", "mute": "Couper le son", "new-memory-card": "Nouvelle carte", - "new-slot": "Nouvel emplacement…", + "new-slot": "+ Nouvel emplacement", "newer-save-warning": "Une sauvegarde de {time} est plus récente que votre choix. Reprendre avec ce choix peut vous faire perdre de la progression.", "newer-state-warning": "Un état de {time} est plus récent que votre choix. Reprendre avec ce choix peut vous faire perdre de la progression.", "no-memory-cards": "Aucune carte mémoire pour le moment", diff --git a/frontend/src/locales/hu_HU/play.json b/frontend/src/locales/hu_HU/play.json index e195df718..1483bc9d6 100644 --- a/frontend/src/locales/hu_HU/play.json +++ b/frontend/src/locales/hu_HU/play.json @@ -107,7 +107,7 @@ "multiplayer-hint": "Csatlakozás gombot jelenít meg a játék oldalán, és láthatóan tartja a csevegést és a webkamerát.", "mute": "Némítás", "new-memory-card": "Új kártya", - "new-slot": "Új hely…", + "new-slot": "+ Új hely", "newer-save-warning": "Egy {time} mentés újabb a választottnál. A választott folytatása visszavetheti a haladásodat.", "newer-state-warning": "Egy {time} állás újabb a választottnál. A választott folytatása visszavetheti a haladásodat.", "no-memory-cards": "Még nincsenek memóriakártyák", diff --git a/frontend/src/locales/it_IT/play.json b/frontend/src/locales/it_IT/play.json index d886afe61..b1149f1bb 100644 --- a/frontend/src/locales/it_IT/play.json +++ b/frontend/src/locales/it_IT/play.json @@ -107,7 +107,7 @@ "multiplayer-hint": "Mostra un pulsante Partecipa nella pagina di questo gioco e mantiene visibili chat e webcam.", "mute": "Disattiva audio", "new-memory-card": "Nuova card", - "new-slot": "Nuovo slot…", + "new-slot": "+ Nuovo slot", "newer-save-warning": "Un salvataggio di {time} è più recente della tua scelta. Riprenderla può farti perdere progressi.", "newer-state-warning": "Uno stato di {time} è più recente della tua scelta. Riprenderla può farti perdere progressi.", "no-memory-cards": "Nessuna memory card", diff --git a/frontend/src/locales/ja_JP/play.json b/frontend/src/locales/ja_JP/play.json index 467f430a5..8595044ac 100644 --- a/frontend/src/locales/ja_JP/play.json +++ b/frontend/src/locales/ja_JP/play.json @@ -107,7 +107,7 @@ "multiplayer-hint": "このゲームのページに参加ボタンを表示し、チャットとウェブカメラを表示したままにします。", "mute": "ミュート", "new-memory-card": "新しいカード", - "new-slot": "新しいスロット…", + "new-slot": "+ 新しいスロット", "newer-save-warning": "{time}のセーブは選択したものより新しいです。このまま再開すると進行状況が戻る可能性があります。", "newer-state-warning": "{time}のステートセーブは選択したものより新しいです。このまま再開すると進行状況が戻る可能性があります。", "no-memory-cards": "メモリーカードはまだありません", diff --git a/frontend/src/locales/ko_KR/play.json b/frontend/src/locales/ko_KR/play.json index e169a4d0e..b396e6d40 100644 --- a/frontend/src/locales/ko_KR/play.json +++ b/frontend/src/locales/ko_KR/play.json @@ -107,7 +107,7 @@ "multiplayer-hint": "이 게임 페이지에 참가 버튼을 표시하고 채팅과 웹캠을 계속 보이게 합니다.", "mute": "음소거", "new-memory-card": "새 카드", - "new-slot": "새 슬롯…", + "new-slot": "+ 새 슬롯", "newer-save-warning": "{time}의 세이브가 선택한 항목보다 최신입니다. 그대로 이어하면 진행 상황이 되돌아갈 수 있습니다.", "newer-state-warning": "{time}의 상태가 선택한 항목보다 최신입니다. 그대로 이어하면 진행 상황이 되돌아갈 수 있습니다.", "no-memory-cards": "메모리 카드가 아직 없습니다", diff --git a/frontend/src/locales/pl_PL/play.json b/frontend/src/locales/pl_PL/play.json index 94f8876bb..d1b368b27 100644 --- a/frontend/src/locales/pl_PL/play.json +++ b/frontend/src/locales/pl_PL/play.json @@ -107,7 +107,7 @@ "multiplayer-hint": "Wyświetla przycisk Dołącz na stronie tej gry i utrzymuje widoczny czat oraz kamerę internetową.", "mute": "Wycisz", "new-memory-card": "Nowa karta", - "new-slot": "Nowy slot…", + "new-slot": "+ Nowy slot", "newer-save-warning": "Zapis z {time} jest nowszy niż twój wybór. Wznowienie go może cofnąć twój postęp.", "newer-state-warning": "Stan z {time} jest nowszy niż twój wybór. Wznowienie go może cofnąć twój postęp.", "no-memory-cards": "Brak kart pamięci", diff --git a/frontend/src/locales/pt_BR/play.json b/frontend/src/locales/pt_BR/play.json index a1ce89d92..ac63aebea 100644 --- a/frontend/src/locales/pt_BR/play.json +++ b/frontend/src/locales/pt_BR/play.json @@ -107,7 +107,7 @@ "multiplayer-hint": "Mostra um botão Entrar na página deste jogo e mantém o chat e a webcam visíveis.", "mute": "Silenciar", "new-memory-card": "Novo cartão", - "new-slot": "Novo slot…", + "new-slot": "+ Novo slot", "newer-save-warning": "Um save de {time} é mais recente que sua escolha. Retomá-la pode desfazer seu progresso.", "newer-state-warning": "Um state de {time} é mais recente que sua escolha. Retomá-la pode desfazer seu progresso.", "no-memory-cards": "Nenhum cartão de memória ainda", diff --git a/frontend/src/locales/ro_RO/play.json b/frontend/src/locales/ro_RO/play.json index a7364d276..62c4e2dc1 100644 --- a/frontend/src/locales/ro_RO/play.json +++ b/frontend/src/locales/ro_RO/play.json @@ -107,7 +107,7 @@ "multiplayer-hint": "Afișează un buton Alătură-te pe pagina acestui joc și păstrează vizibile chatul și camera web.", "mute": "Dezactivează sunetul", "new-memory-card": "Card nou", - "new-slot": "Slot nou…", + "new-slot": "+ Slot nou", "newer-save-warning": "O salvare de {time} este mai nouă decât alegerea ta. Reluarea ei îți poate da progresul înapoi.", "newer-state-warning": "O stare de {time} este mai nouă decât alegerea ta. Reluarea ei îți poate da progresul înapoi.", "no-memory-cards": "Încă niciun card de memorie", diff --git a/frontend/src/locales/ru_RU/play.json b/frontend/src/locales/ru_RU/play.json index 446b37161..2383a587e 100644 --- a/frontend/src/locales/ru_RU/play.json +++ b/frontend/src/locales/ru_RU/play.json @@ -107,7 +107,7 @@ "multiplayer-hint": "Показывает кнопку «Присоединиться» на странице этой игры и оставляет чат и веб-камеру видимыми.", "mute": "Отключить звук", "new-memory-card": "Новая карта", - "new-slot": "Новый слот…", + "new-slot": "+ Новый слот", "newer-save-warning": "Сохранение от {time} новее вашего выбора. Продолжение с него может откатить ваш прогресс.", "newer-state-warning": "Состояние от {time} новее вашего выбора. Продолжение с него может откатить ваш прогресс.", "no-memory-cards": "Пока нет карт памяти", diff --git a/frontend/src/locales/tr_TR/play.json b/frontend/src/locales/tr_TR/play.json index be975af73..1028183f0 100644 --- a/frontend/src/locales/tr_TR/play.json +++ b/frontend/src/locales/tr_TR/play.json @@ -107,7 +107,7 @@ "multiplayer-hint": "Bu oyunun sayfasında bir Katıl düğmesi gösterir, sohbeti ve web kamerasını görünür tutar.", "mute": "Sessize al", "new-memory-card": "Yeni kart", - "new-slot": "Yeni yuva…", + "new-slot": "+ Yeni yuva", "newer-save-warning": "{time} tarihli kayıt seçiminizden daha yeni. Seçiminizle devam etmek ilerlemenizi geri alabilir.", "newer-state-warning": "{time} tarihli durum kaydı seçiminizden daha yeni. Seçiminizle devam etmek ilerlemenizi geri alabilir.", "no-memory-cards": "Henüz hafıza kartı yok", diff --git a/frontend/src/locales/zh_CN/play.json b/frontend/src/locales/zh_CN/play.json index 340afc9a7..6993fd2f2 100644 --- a/frontend/src/locales/zh_CN/play.json +++ b/frontend/src/locales/zh_CN/play.json @@ -107,7 +107,7 @@ "multiplayer-hint": "在该游戏页面显示“加入”按钮,并保持聊天和摄像头可见。", "mute": "静音", "new-memory-card": "新建卡", - "new-slot": "新建存档位…", + "new-slot": "+ 新建存档位", "newer-save-warning": "{time}的存档比你选择的更新。继续当前选择可能会回退你的进度。", "newer-state-warning": "{time}的状态比你选择的更新。继续当前选择可能会回退你的进度。", "no-memory-cards": "尚无记忆卡", diff --git a/frontend/src/locales/zh_TW/play.json b/frontend/src/locales/zh_TW/play.json index b177b84a6..d22aea8f4 100644 --- a/frontend/src/locales/zh_TW/play.json +++ b/frontend/src/locales/zh_TW/play.json @@ -107,7 +107,7 @@ "multiplayer-hint": "在此遊戲頁面顯示「加入」按鈕,並保持聊天與網路攝影機可見。", "mute": "靜音", "new-memory-card": "新增卡", - "new-slot": "新增存檔格…", + "new-slot": "+ 新增存檔格", "newer-save-warning": "{time}的存檔比你選擇的更新。繼續目前選擇可能會回退你的進度。", "newer-state-warning": "{time}的即時存檔比你選擇的更新。繼續目前選擇可能會回退你的進度。", "no-memory-cards": "尚無記憶卡", diff --git a/frontend/src/v2/components/GameDetails/UploadAssetDialog.test.ts b/frontend/src/v2/components/GameDetails/UploadAssetDialog.test.ts index c40d97537..7639ac9b5 100644 --- a/frontend/src/v2/components/GameDetails/UploadAssetDialog.test.ts +++ b/frontend/src/v2/components/GameDetails/UploadAssetDialog.test.ts @@ -131,7 +131,7 @@ describe("UploadAssetDialog", () => { formValid.value = true; }); - it("keeps Upload disabled until a file is picked, then uploads as an archive", async () => { + it("keeps Upload disabled until a file is picked, then uploads into autosave", async () => { const wrapper = mountDialog("save"); expect(uploadButton(wrapper).attributes("disabled")).toBeDefined(); @@ -139,29 +139,40 @@ describe("UploadAssetDialog", () => { expect(uploadButton(wrapper).attributes("disabled")).toBeUndefined(); const payload = await submitted(wrapper); - expect(payload).toMatchObject({ type: "save", slot: null, emulator: null }); + expect(payload).toMatchObject({ + type: "save", + slot: "autosave", + emulator: null, + }); expect(payload!.files.map((f) => f.name)).toEqual(["game.srm"]); }); - it("offers autosave, the slots in use and a new one", async () => { + it("offers a new slot first, then autosave, the slots in use and no slot", async () => { const wrapper = mountDialog("save", [new File(["x"], "a.srm")]); const options = wrapper.findAll("select")[0].findAll("option"); expect(options.map((o) => o.text())).toEqual([ - "play.slot-none", + "play.new-slot", "autosave", "main_quest", - "play.new-slot", + "play.slot-none", ]); await choose(wrapper, 0, 2); expect(await submitted(wrapper)).toMatchObject({ slot: "main_quest" }); }); + it("uploads as an archive when no slot is picked", async () => { + const wrapper = mountDialog("save", [new File(["x"], "a.srm")]); + await choose(wrapper, 0, 3); + + expect(await submitted(wrapper)).toMatchObject({ slot: null }); + }); + it("names a new slot and asks saves for nothing else", async () => { const wrapper = mountDialog("save", [new File(["x"], "a.srm")]); expect(wrapper.findAll("select")).toHaveLength(1); - await choose(wrapper, 0, 3); + await choose(wrapper, 0, 0); await wrapper.get("input.slot-name").setValue(" speedrun "); expect(await submitted(wrapper)).toMatchObject({ @@ -173,7 +184,7 @@ describe("UploadAssetDialog", () => { it("does not submit while the form is invalid", async () => { formValid.value = false; const wrapper = mountDialog("save", [new File(["x"], "a.srm")]); - await choose(wrapper, 0, 3); + await choose(wrapper, 0, 0); expect(await submitted(wrapper)).toBeUndefined(); }); diff --git a/frontend/src/v2/components/GameDetails/UploadAssetDialog.vue b/frontend/src/v2/components/GameDetails/UploadAssetDialog.vue index 44f02e384..419066d63 100644 --- a/frontend/src/v2/components/GameDetails/UploadAssetDialog.vue +++ b/frontend/src/v2/components/GameDetails/UploadAssetDialog.vue @@ -5,11 +5,13 @@ import { RBtn, RDialog, RForm, RIcon, RSelect, RTextField } from "@v2/lib"; import { computed, ref, watch } from "vue"; import { useI18n } from "vue-i18n"; import type { SaveSchema } from "@/__generated__"; -import { SAVE_SLOT_MAX_LENGTH } from "@/services/api/save"; +import { AUTOSAVE_SLOT, SAVE_SLOT_MAX_LENGTH } from "@/services/api/save"; import PendingFilesDropzone from "@/v2/components/shared/PendingFilesDropzone.vue"; import type { AssetType } from "@/v2/utils/assets"; import { chosenSlot, + existingSlot, + isNewSlotChoice, isSlotChoice, slotChoiceKey, slotChoiceTitle, @@ -47,15 +49,15 @@ const emit = defineEmits<{ const { t } = useI18n(); -const slot = ref(NO_SLOT); +const slot = ref(existingSlot(AUTOSAVE_SLOT)); const newSlotName = ref(""); const core = ref(""); const files = ref([]); const formRef = ref | null>(null); const slotItems = computed(() => [ - NO_SLOT, ...slotChoices(props.saves), + NO_SLOT, ]); const slotTitle = (choice: UploadSlot) => choice.kind === "none" ? t("play.slot-none") : slotChoiceTitle(choice); @@ -83,7 +85,7 @@ watch( () => props.modelValue, (open) => { if (!open) return; - slot.value = NO_SLOT; + slot.value = existingSlot(AUTOSAVE_SLOT); newSlotName.value = ""; core.value = ""; files.value = []; @@ -139,6 +141,7 @@ async function submit() { :item-title="slotTitle" :item-value="slotKey" return-object + :divider-after="isNewSlotChoice" prefix-label="inline" :hint="t('rom.upload-slot-hint')" @update:model-value="onSlot" diff --git a/frontend/src/v2/utils/saveSlots.test.ts b/frontend/src/v2/utils/saveSlots.test.ts index 3be20220b..d42f5e646 100644 --- a/frontend/src/v2/utils/saveSlots.test.ts +++ b/frontend/src/v2/utils/saveSlots.test.ts @@ -28,8 +28,8 @@ describe("preferredSlot", () => { describe("slotChoices", () => { it("offers autosave and a new slot even when no save exists yet", () => { expect(slotChoices([])).toEqual([ - existingSlot("autosave"), NEW_SLOT_CHOICE, + existingSlot("autosave"), ]); }); @@ -43,18 +43,18 @@ describe("slotChoices", () => { ]; expect(slotChoices(saves)).toEqual([ + NEW_SLOT_CHOICE, existingSlot("autosave"), existingSlot("main_quest"), existingSlot("speedrun"), - NEW_SLOT_CHOICE, ]); }); it("matches slot names exactly, like the backend", () => { expect(slotChoices([save(1, "Autosave")])).toEqual([ + NEW_SLOT_CHOICE, existingSlot("autosave"), existingSlot("Autosave"), - NEW_SLOT_CHOICE, ]); }); }); diff --git a/frontend/src/v2/utils/saveSlots.ts b/frontend/src/v2/utils/saveSlots.ts index 60ebccbe1..7ca461031 100644 --- a/frontend/src/v2/utils/saveSlots.ts +++ b/frontend/src/v2/utils/saveSlots.ts @@ -28,7 +28,7 @@ export function isSlotChoice(value: unknown): value is SlotChoice { ); } -/** Autosave first, then every slot in use, then the entry for a new slot. */ +/** The entry for a new slot first, then autosave and every slot in use. */ export function slotChoices( saves: readonly Pick[], ): SlotChoice[] { @@ -36,11 +36,16 @@ export function slotChoices( .map((save) => save.slot) .filter((slot): slot is string => !!slot && slot !== AUTOSAVE_SLOT); return [ - ...[AUTOSAVE_SLOT, ...new Set(named)].map(existingSlot), NEW_SLOT_CHOICE, + ...[AUTOSAVE_SLOT, ...new Set(named)].map(existingSlot), ]; } +/** Pickers set the new-slot entry apart from the slots that already exist. */ +export function isNewSlotChoice(choice: { kind: string }): boolean { + return choice.kind === "new"; +} + export function slotChoiceTitle(choice: SlotChoice): string { return choice.kind === "new" ? i18n.global.t("play.new-slot") : choice.slot; } diff --git a/frontend/src/v2/views/Player/EmulatorJS.vue b/frontend/src/v2/views/Player/EmulatorJS.vue index d2ff1dda3..9766dbbb6 100644 --- a/frontend/src/v2/views/Player/EmulatorJS.vue +++ b/frontend/src/v2/views/Player/EmulatorJS.vue @@ -23,7 +23,6 @@ import { RSpinner, RSwitch, RTextField, - RTooltip, } from "@v2/lib"; import { useEventListener, useLocalStorage } from "@vueuse/core"; import type { Emitter } from "mitt"; @@ -88,6 +87,7 @@ import { suppressVirtualGamepadZoneTouch } from "@/v2/utils/playerTouchGuard"; import { chosenSlot, existingSlot, + isNewSlotChoice, isSlotChoice, preferredSlot, slotChoiceKey, @@ -658,37 +658,26 @@ const saveSlot = computed(() => chosenSlot(slotChoice.value, customSlot.value));
-
- - - - -
+ + + Date: Thu, 17 Sep 2026 11:41:35 +0200 Subject: [PATCH 4/6] fix(v2): fold select notes into info wells and unwrap scan settings copy The memory card and scan media notes sat as loose hints under their select; both now live in the select's info well. Scan settings section descriptions were capped at 680px and wrapped early on wide screens; they now take the section width and only wrap when it runs out. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01CZ7NE6z9cJ8zsT3TsCtQds --- .../v2/components/Player/MemoryCardPicker.vue | 17 ++--------------- frontend/src/v2/views/Settings/ScanSettings.vue | 17 ++--------------- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/frontend/src/v2/components/Player/MemoryCardPicker.vue b/frontend/src/v2/components/Player/MemoryCardPicker.vue index 30dcac285..9b622d1fc 100644 --- a/frontend/src/v2/components/Player/MemoryCardPicker.vue +++ b/frontend/src/v2/components/Player/MemoryCardPicker.vue @@ -12,7 +12,7 @@ // Cards key HARD on `emulator` (that is what claim-time lookup uses); the // optional `platformId` is a display/creation hint only and never scopes the // fetch. -import { RBtn, RDialog, RIcon, RSelect } from "@v2/lib"; +import { RBtn, RDialog, RSelect } from "@v2/lib"; import { computed, ref, watch } from "vue"; import { useI18n } from "vue-i18n"; import type { MemoryCardSchema } from "@/__generated__"; @@ -141,6 +141,7 @@ async function submitCreate(name: string): Promise { :placeholder=" cards.length === 0 ? t('play.no-memory-cards') : undefined " + :info="t('play.memory-card-hint')" @update:model-value="onSelect" /> { - -

- - {{ t("play.memory-card-hint") }} -

@@ -216,13 +212,4 @@ async function submitCreate(name: string): Promise { flex: 1 1 auto; min-width: 0; } - -.r-mc-picker__hint { - display: flex; - align-items: center; - gap: 5px; - margin: 0; - color: var(--r-color-fg-muted); - font-size: var(--r-font-size-xs); -} diff --git a/frontend/src/v2/views/Settings/ScanSettings.vue b/frontend/src/v2/views/Settings/ScanSettings.vue index 2afed0731..58d024e65 100644 --- a/frontend/src/v2/views/Settings/ScanSettings.vue +++ b/frontend/src/v2/views/Settings/ScanSettings.vue @@ -5,7 +5,7 @@ // // Provider / region / language identifiers are proper nouns or codes, so // they stay as data constants; only descriptive prose goes through i18n. -import { RAlert, RIcon, RSelect, RBtn, RSpinner } from "@v2/lib"; +import { RAlert, RSelect, RBtn, RSpinner } from "@v2/lib"; import { storeToRefs } from "pinia"; import { computed, onBeforeUnmount, onMounted, reactive, ref } from "vue"; import { useI18n } from "vue-i18n"; @@ -503,13 +503,10 @@ onBeforeUnmount(() => searchable :disabled="!canEdit" :placeholder="t('settings.scan-media-placeholder')" + :info="t('settings.scan-media-note')" hide-details @update:model-value="setMedia" /> -

- - {{ t("settings.scan-media-note") }} -

@@ -618,7 +615,6 @@ onBeforeUnmount(() => color: var(--r-color-fg-muted); font-size: 13px; line-height: 1.5; - max-width: 680px; } /* When a description sits directly above a field block, drop its bottom padding so the field's own padding provides the gap. */ @@ -636,15 +632,6 @@ onBeforeUnmount(() => border-top: 1px solid var(--r-color-border); } -.r-v2-scan-settings__note { - margin: 0; - display: flex; - align-items: center; - gap: 6px; - font-size: 12px; - color: var(--r-color-fg-faint); -} - .r-v2-scan-settings__toggle-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); From a342bccd13c458456fc8e0a74d866f059faac469 Mon Sep 17 00:00:00 2001 From: zurdi Date: Thu, 17 Sep 2026 12:23:17 +0200 Subject: [PATCH 5/6] test(e2e): expect Upload to folder in All files and Upload in folder subtabs The Files tab no longer offers a plain Upload from All files, which has no destination of its own. The admin spec now checks "Upload to folder" there and Upload in a folder subtab, and the read-only spec checks that neither appears once the tab has rendered. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01CZ7NE6z9cJ8zsT3TsCtQds --- frontend/e2e/game-media-files.spec.ts | 36 ++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/frontend/e2e/game-media-files.spec.ts b/frontend/e2e/game-media-files.spec.ts index f8c8ccc6a..789ca6c53 100644 --- a/frontend/e2e/game-media-files.spec.ts +++ b/frontend/e2e/game-media-files.spec.ts @@ -113,6 +113,16 @@ test.describe("Media tab write affordances (admin)", () => { }); }); +// "All files" has no destination of its own, so it offers "Upload to folder"; +// a folder subtab offers Upload straight into that folder. +function uploadButton(page: Page): Locator { + return page.getByRole("button", { name: "Upload", exact: true }); +} + +function uploadToFolderButton(page: Page): Locator { + return page.getByRole("button", { name: "Upload to folder", exact: true }); +} + test.describe("Files tab write affordances", () => { test.describe("read-only user", () => { test.use({ storageState: STORAGE_STATE.viewer }); @@ -123,22 +133,36 @@ test.describe("Files tab write affordances", () => { await openTab(page, "Files"); await expect( - page.getByRole("button", { name: "Upload", exact: true }), - ).toHaveCount(0); + page.locator(".r-v2-files__subtab-btn").first(), + ).toBeVisible(); + await expect(uploadButton(page)).toHaveCount(0); + await expect(uploadToFolderButton(page)).toHaveCount(0); }); }); test.describe("admin", () => { test.use({ storageState: STORAGE_STATE.admin }); - test("gets the upload button", async ({ page }) => { + test("gets Upload to folder from All files", async ({ page }) => { await seedUiState(page, "dark"); await gotoFirstRom(page); await openTab(page, "Files"); - await expect( - page.getByRole("button", { name: "Upload", exact: true }), - ).toBeVisible(); + await expect(uploadToFolderButton(page)).toBeVisible(); + await expect(uploadButton(page)).toHaveCount(0); + }); + + test("gets Upload from a folder subtab", async ({ page }) => { + await seedUiState(page, "dark"); + await gotoFirstRom(page); + await openTab(page, "Files"); + await page + .locator(".r-v2-files__subtab-btn:not(.r-v2-files__subtab-btn--active)") + .first() + .click(); + + await expect(uploadButton(page)).toBeVisible(); + await expect(uploadToFolderButton(page)).toHaveCount(0); }); }); }); From c1e6ce5424f63298bd32482d1879f6b0e3537287 Mon Sep 17 00:00:00 2001 From: zurdi Date: Thu, 17 Sep 2026 12:37:05 +0200 Subject: [PATCH 6/6] fix(v2): describe RSelect info from a node outside aria-hidden The field's aria-describedby pointed at the info well, which was marked aria-hidden, so assistive technology could drop the description. The info text now lives in its own hidden node that the field references, and the well is no longer aria-hidden since its default content is decorative already. Also cover the info tooltip reveal: keyboard and pad focus open it, mouse focus does not, and blur or opening the menu closes it. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01CZ7NE6z9cJ8zsT3TsCtQds --- .../src/v2/lib/forms/RSelect/RSelect.test.ts | 66 ++++++++++++++++--- frontend/src/v2/lib/forms/RSelect/RSelect.vue | 21 ++---- 2 files changed, 62 insertions(+), 25 deletions(-) diff --git a/frontend/src/v2/lib/forms/RSelect/RSelect.test.ts b/frontend/src/v2/lib/forms/RSelect/RSelect.test.ts index 94addbbcb..954b44e06 100644 --- a/frontend/src/v2/lib/forms/RSelect/RSelect.test.ts +++ b/frontend/src/v2/lib/forms/RSelect/RSelect.test.ts @@ -1,9 +1,15 @@ import { mount } from "@vue/test-utils"; -import { describe, expect, it } from "vitest"; +import { afterEach, describe, expect, it } from "vitest"; import { nextTick } from "vue"; +import { useInputModality } from "@/v2/composables/useInputModality"; +import RTooltip from "@/v2/lib/structural/RTooltip/RTooltip.vue"; import RSelect from "./RSelect.vue"; describe("RSelect append label", () => { + const { setModality } = useInputModality(); + + afterEach(() => setModality("mouse")); + function mountWith(options: { info?: string; slot?: string }) { return mount(RSelect, { props: { @@ -17,15 +23,21 @@ describe("RSelect append label", () => { }); } - it("reads the info as the field's description, not its name", () => { - const wrapper = mountWith({ info: "Slot info" }); - const well = wrapper.get(".r-select__label--append"); + function infoOpen(wrapper: ReturnType) { + return wrapper.getComponent(RTooltip).props("modelValue"); + } - expect(well.attributes("aria-hidden")).toBe("true"); - expect(well.text()).toBe("Slot info"); - expect(wrapper.get(".r-select__field").attributes("aria-describedby")).toBe( - well.attributes("id"), - ); + it("describes the field with the info outside any aria-hidden subtree", () => { + const wrapper = mountWith({ info: "Slot info" }); + const field = wrapper.get(".r-select__field"); + const id = field.attributes("aria-describedby"); + const description = document.getElementById(id ?? ""); + + expect(description?.textContent).toBe("Slot info"); + expect(description?.closest("[aria-hidden='true']")).toBeNull(); + expect( + wrapper.get(".r-select__label--append").attributes("aria-hidden"), + ).toBeUndefined(); wrapper.unmount(); }); @@ -56,6 +68,42 @@ describe("RSelect append label", () => { ).toBeUndefined(); wrapper.unmount(); }); + + it.each(["key", "pad"] as const)( + "reveals the info when the field takes %s focus", + async (modality) => { + setModality(modality); + const wrapper = mountWith({ info: "Slot info" }); + + await wrapper.get(".r-select__field").trigger("focus"); + expect(infoOpen(wrapper)).toBe(true); + + await wrapper.get(".r-select__field").trigger("blur"); + expect(infoOpen(wrapper)).toBe(false); + wrapper.unmount(); + }, + ); + + it("keeps the info closed on mouse focus", async () => { + const wrapper = mountWith({ info: "Slot info" }); + + await wrapper.get(".r-select__field").trigger("focus"); + + expect(infoOpen(wrapper)).toBe(false); + wrapper.unmount(); + }); + + it("closes the info once the menu opens", async () => { + setModality("key"); + const wrapper = mountWith({ info: "Slot info" }); + + await wrapper.get(".r-select__field").trigger("focus"); + await wrapper.get(".r-select__field").trigger("click"); + + expect(wrapper.emitted("open")).toHaveLength(1); + expect(infoOpen(wrapper)).toBe(false); + wrapper.unmount(); + }); }); describe("RSelect dividerAfter", () => { diff --git a/frontend/src/v2/lib/forms/RSelect/RSelect.vue b/frontend/src/v2/lib/forms/RSelect/RSelect.vue index 4863a3687..6dd58f429 100644 --- a/frontend/src/v2/lib/forms/RSelect/RSelect.vue +++ b/frontend/src/v2/lib/forms/RSelect/RSelect.vue @@ -889,7 +889,7 @@ const hasAppendLabel = computed(() => !!slots["append-label"] || !!props.info); const describedBy = computed(() => { const ids = [ showDetails.value && `${fieldId}-details`, - hasAppendLabel.value && `${fieldId}-append-label`, + props.info && `${fieldId}-info`, ].filter(Boolean); return ids.length > 0 ? ids.join(" ") : undefined; }); @@ -1123,19 +1123,15 @@ const describedBy = computed(() => { /> - + + + @@ -1663,16 +1662,6 @@ const describedBy = computed(() => { .r-select__field:has(.r-select__label--append) { overflow: hidden; } -/* Read through the field's aria-describedby; the tooltip shows it on - screen. */ -.r-select__info-text { - position: absolute; - width: 1px; - height: 1px; - overflow: hidden; - clip-path: inset(50%); - white-space: nowrap; -} .r-select--inline .r-select__field { padding-inline-start: 0; overflow: hidden;