fix: UI world map

This commit is contained in:
2026-06-16 22:31:17 +09:00
parent ed415a78a1
commit d614ddb322
5 changed files with 48 additions and 3 deletions

View File

@@ -7,18 +7,23 @@
let fileInput;
let uploading = $state(false);
let uploadError = $state('');
function remove(index) {
onchange(photos.filter((_, i) => i !== index));
uploadError = '';
}
async function addFiles(e) {
const files = Array.from(e.currentTarget.files ?? []);
if (!files.length) return;
uploading = true;
uploadError = '';
try {
const urls = await Promise.all(files.map(uploadPhoto));
onchange([...photos, ...urls]);
} catch (err) {
uploadError = err?.message ?? 'Upload failed. Check Firebase Storage rules.';
} finally {
uploading = false;
e.currentTarget.value = '';
@@ -68,6 +73,10 @@
</button>
</div>
{/if}
{#if uploadError}
<div class="upload-error">{uploadError}</div>
{/if}
</div>
<style>
@@ -183,4 +192,15 @@
transition: border-color 0.15s, color 0.15s;
}
.add-cell:hover { border-color: var(--accent-border); color: var(--accent); }
.upload-error {
font-size: 12px;
color: #ef4444;
background: #fef2f2;
border: 1px solid #fecaca;
border-radius: 6px;
padding: 8px 10px;
line-height: 1.4;
word-break: break-word;
}
</style>