mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-20 12:23:22 +00:00
fix(ui): list existing source folders as tags instead of a native datalist
The browser's datalist drew its own arrow and a black popup that matched nothing else in the dashboard. Folders other single-file extras use are now tags under the field; a click fills it in, and typing still names a new folder. Refs #300
This commit is contained in:
@@ -1076,6 +1076,7 @@
|
||||
"extras.modal.sourceFolder": "Quellordner",
|
||||
"extras.modal.sourceFolderHint": "Extras im selben Ordner synchronisieren jeweils ihre eigene Datei.",
|
||||
"extras.modal.sourceFolderInvalid": "Gib einen Ordnernamen ein, keinen Pfad.",
|
||||
"extras.modal.existingFolders": "Vorhanden:",
|
||||
"extras.modal.agentsNote": "Ein Extra mit der Datei AGENTS.md erscheint im Tab AGENTS.md.",
|
||||
"extras.hint.fileAs": "Lass den Dateinamen leer, um {file} zu behalten.",
|
||||
"extras.hint.fileModes": "merge verlinkt die Datei · copy schreibt eine Kopie · import fügt eine @-Zeile hinzu, nur für Tools, die @-Importe lesen.",
|
||||
|
||||
@@ -1076,6 +1076,7 @@
|
||||
"extras.modal.sourceFolder": "Source folder",
|
||||
"extras.modal.sourceFolderHint": "Extras in the same folder each sync their own file.",
|
||||
"extras.modal.sourceFolderInvalid": "Enter a folder name, not a path.",
|
||||
"extras.modal.existingFolders": "Existing:",
|
||||
"extras.modal.agentsNote": "An extra whose file is AGENTS.md appears on the AGENTS.md tab.",
|
||||
"extras.hint.fileAs": "Leave File name empty to keep {file}.",
|
||||
"extras.hint.fileModes": "merge links the file · copy writes a copy · import adds an @ line, only for tools that read @ imports.",
|
||||
|
||||
@@ -1076,6 +1076,7 @@
|
||||
"extras.modal.sourceFolder": "Carpeta de origen",
|
||||
"extras.modal.sourceFolderHint": "Los extras de la misma carpeta sincronizan cada uno su propio archivo.",
|
||||
"extras.modal.sourceFolderInvalid": "Escribe un nombre de carpeta, no una ruta.",
|
||||
"extras.modal.existingFolders": "Existentes:",
|
||||
"extras.modal.agentsNote": "Un extra cuyo archivo es AGENTS.md aparece en la pestaña AGENTS.md.",
|
||||
"extras.hint.fileAs": "Deja vacío el nombre de archivo para conservar {file}.",
|
||||
"extras.hint.fileModes": "merge enlaza el archivo · copy escribe una copia · import añade una línea @, solo para herramientas que leen importaciones @.",
|
||||
|
||||
@@ -1076,6 +1076,7 @@
|
||||
"extras.modal.sourceFolder": "پوشه منبع",
|
||||
"extras.modal.sourceFolderHint": "extraهایی که در یک پوشهاند هر کدام فایل خودشان را همگام میکنند.",
|
||||
"extras.modal.sourceFolderInvalid": "نام پوشه را وارد کنید، نه مسیر.",
|
||||
"extras.modal.existingFolders": "موجود:",
|
||||
"extras.modal.agentsNote": "extraای که فایلش AGENTS.md است در زبانه AGENTS.md نمایش داده میشود.",
|
||||
"extras.hint.fileAs": "برای نگه داشتن {file}، نام فایل را خالی بگذارید.",
|
||||
"extras.hint.fileModes": "merge فایل را پیوند میدهد · copy یک نسخه مینویسد · import یک خط @ اضافه میکند، فقط برای ابزارهایی که importهای @ را میخوانند.",
|
||||
|
||||
@@ -1076,6 +1076,7 @@
|
||||
"extras.modal.sourceFolder": "Dossier source",
|
||||
"extras.modal.sourceFolderHint": "Les extras d'un même dossier synchronisent chacun leur propre fichier.",
|
||||
"extras.modal.sourceFolderInvalid": "Saisissez un nom de dossier, pas un chemin.",
|
||||
"extras.modal.existingFolders": "Existants :",
|
||||
"extras.modal.agentsNote": "Un extra dont le fichier est AGENTS.md apparaît dans l'onglet AGENTS.md.",
|
||||
"extras.hint.fileAs": "Laissez le nom du fichier vide pour garder {file}.",
|
||||
"extras.hint.fileModes": "merge crée un lien vers le fichier · copy écrit une copie · import ajoute une ligne @, uniquement pour les outils qui lisent les imports @.",
|
||||
|
||||
@@ -1076,6 +1076,7 @@
|
||||
"extras.modal.sourceFolder": "Folder sumber",
|
||||
"extras.modal.sourceFolderHint": "Extra dalam folder yang sama masing-masing menyinkronkan filenya sendiri.",
|
||||
"extras.modal.sourceFolderInvalid": "Masukkan nama folder, bukan path.",
|
||||
"extras.modal.existingFolders": "Yang ada:",
|
||||
"extras.modal.agentsNote": "Extra dengan file AGENTS.md muncul di tab AGENTS.md.",
|
||||
"extras.hint.fileAs": "Kosongkan Nama file untuk tetap memakai {file}.",
|
||||
"extras.hint.fileModes": "merge menautkan file · copy menulis salinan · import menambahkan baris @, hanya untuk alat yang membaca impor @.",
|
||||
|
||||
@@ -1076,6 +1076,7 @@
|
||||
"extras.modal.sourceFolder": "ソースフォルダー",
|
||||
"extras.modal.sourceFolderHint": "同じフォルダーの extra は、それぞれ自分のファイルを同期します。",
|
||||
"extras.modal.sourceFolderInvalid": "パスではなくフォルダー名を入力してください。",
|
||||
"extras.modal.existingFolders": "既存のフォルダ:",
|
||||
"extras.modal.agentsNote": "ファイルが AGENTS.md の extra は「AGENTS.md」タブに表示されます。",
|
||||
"extras.hint.fileAs": "ファイル名を空にすると {file} のままになります。",
|
||||
"extras.hint.fileModes": "merge はファイルをリンク · copy はコピーを書き込み · import は @ 行を追加(@ インポートを読むツールのみ)。",
|
||||
|
||||
@@ -1076,6 +1076,7 @@
|
||||
"extras.modal.sourceFolder": "소스 폴더",
|
||||
"extras.modal.sourceFolderHint": "같은 폴더의 extra는 각자 자기 파일을 동기화합니다.",
|
||||
"extras.modal.sourceFolderInvalid": "경로가 아닌 폴더 이름을 입력하세요.",
|
||||
"extras.modal.existingFolders": "기존 폴더:",
|
||||
"extras.modal.agentsNote": "파일이 AGENTS.md인 extra는 AGENTS.md 탭에 표시됩니다.",
|
||||
"extras.hint.fileAs": "파일 이름을 비워 두면 {file}을(를) 그대로 사용합니다.",
|
||||
"extras.hint.fileModes": "merge는 파일을 링크 · copy는 사본을 작성 · import는 @ 줄을 추가하며, @ import를 읽는 도구에서만 동작합니다.",
|
||||
|
||||
@@ -1076,6 +1076,7 @@
|
||||
"extras.modal.sourceFolder": "Pasta de origem",
|
||||
"extras.modal.sourceFolderHint": "Extras na mesma pasta sincronizam cada um o seu próprio arquivo.",
|
||||
"extras.modal.sourceFolderInvalid": "Digite um nome de pasta, não um caminho.",
|
||||
"extras.modal.existingFolders": "Existentes:",
|
||||
"extras.modal.agentsNote": "Um extra cujo arquivo é AGENTS.md aparece na aba AGENTS.md.",
|
||||
"extras.hint.fileAs": "Deixe o nome do arquivo vazio para manter {file}.",
|
||||
"extras.hint.fileModes": "merge cria um link para o arquivo · copy grava uma cópia · import adiciona uma linha @, só para ferramentas que leem imports @.",
|
||||
|
||||
@@ -1076,6 +1076,7 @@
|
||||
"extras.modal.sourceFolder": "源文件夹",
|
||||
"extras.modal.sourceFolderHint": "同一文件夹中的 extra 各自同步自己的文件。",
|
||||
"extras.modal.sourceFolderInvalid": "请输入文件夹名称,而不是路径。",
|
||||
"extras.modal.existingFolders": "现有文件夹:",
|
||||
"extras.modal.agentsNote": "文件为 AGENTS.md 的 extra 会显示在“AGENTS.md”标签页。",
|
||||
"extras.hint.fileAs": "文件名留空则保留 {file}。",
|
||||
"extras.hint.fileModes": "merge 链接文件 · copy 写入副本 · import 添加一行 @,仅适用于读取 @ import 的工具。",
|
||||
|
||||
@@ -1076,6 +1076,7 @@
|
||||
"extras.modal.sourceFolder": "來源資料夾",
|
||||
"extras.modal.sourceFolderHint": "同一個資料夾裡的 extra 各自同步自己的檔案。",
|
||||
"extras.modal.sourceFolderInvalid": "請輸入資料夾名稱,不是路徑。",
|
||||
"extras.modal.existingFolders": "現有資料夾:",
|
||||
"extras.modal.agentsNote": "檔案是 AGENTS.md 的 extra 會顯示在「AGENTS.md」分頁。",
|
||||
"extras.hint.fileAs": "檔名留空就沿用 {file}。",
|
||||
"extras.hint.fileModes": "merge 連結檔案 · copy 寫入副本 · import 加一行 @,只適用於會讀 @ import 的工具。",
|
||||
|
||||
@@ -98,7 +98,7 @@ describe('Extras page in a project', () => {
|
||||
await user.click(within(dialog).getByRole('radio', { name: 'Single file' }));
|
||||
const [fileInput] = within(dialog).getAllByRole('textbox', { name: 'File name' });
|
||||
await user.type(fileInput, 'review.md');
|
||||
await user.type(within(dialog).getByRole('combobox', { name: 'Source folder' }), 'prompts');
|
||||
await user.type(within(dialog).getByRole('textbox', { name: 'Source folder' }), 'prompts');
|
||||
await user.type(within(dialog).getByRole('textbox', { name: 'Folder' }), '.claude/commands');
|
||||
expect(within(dialog).getByText(/\/extras\/prompts\/review\.md/)).toBeInTheDocument();
|
||||
await user.click(within(dialog).getByRole('button', { name: 'Create' }));
|
||||
@@ -110,4 +110,16 @@ describe('Extras page in a project', () => {
|
||||
targets: [{ path: '.claude/commands', mode: 'merge' }],
|
||||
});
|
||||
});
|
||||
|
||||
it('fills the source folder from a folder another single-file extra uses', async () => {
|
||||
vi.mocked(api.getOverview).mockResolvedValue({ extrasSource: '/p/.skillshare/extras' } as never);
|
||||
const user = userEvent.setup();
|
||||
renderPage();
|
||||
await user.click(await screen.findByRole('button', { name: 'Add extra' }));
|
||||
const dialog = screen.getByRole('dialog');
|
||||
await user.click(within(dialog).getByRole('radio', { name: 'Single file' }));
|
||||
await user.click(await within(dialog).findByRole('button', { name: 'conventions' }));
|
||||
expect(within(dialog).getByRole('textbox', { name: 'Source folder' })).toHaveValue('conventions');
|
||||
vi.mocked(api.getOverview).mockResolvedValue({} as never);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -296,11 +296,17 @@ function AddExtraDialog({ onClose, onCreated, extensions, known, sharedDir, fold
|
||||
) : single ? (
|
||||
<>
|
||||
<span className={`ss-inp ${isPathLike(folderName) ? 'err' : ''}`}>
|
||||
<input value={folder} onChange={(e) => setFolder(e.target.value)} list="extra-folders" placeholder={name.trim() || t('extras.modal.namePlaceholder')} aria-label={t('extras.modal.sourceFolder')} aria-invalid={isPathLike(folderName)} disabled={saving} />
|
||||
<input value={folder} onChange={(e) => setFolder(e.target.value)} placeholder={name.trim() || t('extras.modal.namePlaceholder')} aria-label={t('extras.modal.sourceFolder')} aria-invalid={isPathLike(folderName)} disabled={saving} />
|
||||
</span>
|
||||
<datalist id="extra-folders">
|
||||
{folders.map((f) => <option key={f} value={f} />)}
|
||||
</datalist>
|
||||
{/* Folders other single-file extras use, one click to share one. */}
|
||||
{folders.length > 0 && (
|
||||
<span className="flex flex-wrap items-center gap-1.5 text-[12.5px] text-ink-3">
|
||||
{t('extras.modal.existingFolders')}
|
||||
{folders.map((f) => (
|
||||
<button key={f} type="button" className={`ss-tag font-mono hover:text-ink ${folderName === f ? '!text-ink' : ''}`} aria-pressed={folderName === f} onClick={() => setFolder(f)} disabled={saving}>{f}</button>
|
||||
))}
|
||||
</span>
|
||||
)}
|
||||
<span className={`hp ${isPathLike(folderName) ? 'text-bad' : ''}`}>{t(isPathLike(folderName) ? 'extras.modal.sourceFolderInvalid' : 'extras.modal.sourceFolderHint')}</span>
|
||||
</>
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user