feat: polish speaker material upload control

This commit is contained in:
Lago committed 2026-10-07 19:58:00 +02:00
1 parent 8d8d3ae4b8
commit ef0121a3e4
6 files changed
+180 -10

No files matched your search

+10
View File
@@ -10,6 +10,7 @@
"dependencies": {
"@supabase/supabase-js": "^2.45.4",
"html5-qrcode": "^2.3.8",
"lucide-react": "^1.14.0",
"qrcode.react": "^4.0.1",
"react": "^18.3.1",
"react-dom": "^18.3.1"
@@ -1604,6 +1605,15 @@
"yallist": "^3.0.2"
}
},
"node_modules/lucide-react": {
"version": "1.14.0",
"resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-1.14.0.tgz",
"integrity": "sha512-+1mdWcfSJVUsaTIjN9zoezmUhfXo5l0vP7ekBMPo3jcS/aIkxHnXqAPsByszMZx/Y8oQBRJxJx5xg+RH3urzxA==",
"license": "ISC",
"peerDependencies": {
"react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"
}
},
"node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+1
View File
@@ -11,6 +11,7 @@
"dependencies": {
"@supabase/supabase-js": "^2.45.4",
"html5-qrcode": "^2.3.8",
"lucide-react": "^1.14.0",
"qrcode.react": "^4.0.1",
"react": "^18.3.1",
"react-dom": "^18.3.1"
+12 -8
View File
@@ -1,5 +1,6 @@
import { useEffect, useState, type FormEvent } from 'react';
import type { Session } from '@supabase/supabase-js';
import { LoaderCircle, Paperclip } from 'lucide-react';
import { supabase } from '../lib/supabase';
import { getSpeakerPortalSessions, speakerPortalSession, type SpeakerSession } from '../lib/speakerPortal';
import { removeSessionMaterial, sessionMaterialUrl, uploadSessionMaterial } from '../lib/api';
@@ -110,13 +111,16 @@ export function SpeakerPortal() {
<h3 className="h2">{talk.title}</h3>
<p className="small">{talk.slot_date} · {talk.start_time.slice(0, 5)} - {talk.end_time.slice(0, 5)}{talk.room && ` · ${talk.room}`}</p>
{talk.material_path ? <a className="speaker-download" href={sessionMaterialUrl(talk.material_path)} target="_blank" rel="noreferrer">Download material</a> : <p className="small muted">No material uploaded</p>}
<label className="small" htmlFor={`material-${talk.session_id}`}>{talk.material_path ? 'Replace material' : 'Upload material'}</label>
<input className="input" id={`material-${talk.session_id}`} aria-label={`${talk.material_path ? 'Replace' : 'Upload'} material for ${talk.title}`} type="file" accept={FILE_TYPES} disabled={!!workingTalk || busy} onChange={(event) => {
const file = event.target.files?.[0];
event.target.value = '';
if (file) void changeMaterial(talk, file);
}} />
<p className="small muted">PDF, PowerPoint, ODP, ZIP, TXT · Max 50 MB</p>
<label className="speaker-upload" htmlFor={`material-${talk.session_id}`}>
{workingTalk === talk.session_id ? <LoaderCircle aria-hidden="true" className="speaker-upload-spinner" /> : <Paperclip aria-hidden="true" />}
<span>{workingTalk === talk.session_id ? 'Saving material...' : talk.material_path ? 'Replace material' : 'Upload material'}</span>
<input className="input" id={`material-${talk.session_id}`} aria-label={`${talk.material_path ? 'Replace' : 'Upload'} material for ${talk.title}`} aria-describedby={`material-help-${talk.session_id}`} type="file" accept={FILE_TYPES} disabled={!!workingTalk || busy} onChange={(event) => {
const file = event.target.files?.[0];
event.target.value = '';
if (file) void changeMaterial(talk, file);
}} />
</label>
<p id={`material-help-${talk.session_id}`} className="small muted">PDF, PowerPoint, ODP, ZIP, TXT · Max 50 MB</p>
{workingTalk === talk.session_id && <><progress aria-label="Saving material" /><p role="status">Saving material...</p></>}
{talk.material_path && <button className="btn small danger" disabled={!!workingTalk || busy} onClick={() => void changeMaterial(talk)}>Remove material</button>}
</article>)}
@@ -126,4 +130,4 @@ export function SpeakerPortal() {
<button className="btn primary" type="submit" disabled={busy}>{busy ? 'Sending...' : 'Send sign-in link'}</button>
</form>}
</main></div>;
}
}
+64 -1
View File
@@ -6,9 +6,72 @@
.speaker-portal p, .speaker-portal h3, .speaker-download { overflow-wrap: anywhere; }
.speaker-talk { display: grid; gap: 10px; padding: 18px 0; border-top: 1px solid var(--line); }
.speaker-portal input { width: 100%; min-width: 0; }
.speaker-portal input[type="file"] { font-size: 12px; padding: 10px; }
.speaker-portal progress { width: 100%; accent-color: var(--accent-2); }
.speaker-download { color: var(--accent-2); }
.speaker-upload {
position: relative;
display: flex;
align-items: center;
gap: 8px;
min-height: 46px;
padding: 12px;
border: 1px solid var(--accent);
border-radius: 8px;
background: var(--accent-soft);
color: var(--accent);
font-size: 13px;
font-weight: 600;
cursor: pointer;
}
.speaker-upload svg {
flex-shrink: 0;
}
.speaker-upload span {
min-width: 0;
overflow-wrap: anywhere;
}
.speaker-portal .speaker-upload input[type="file"] {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
opacity: 0;
padding: 0;
cursor: pointer;
}
.speaker-upload:focus-within {
outline: 2px solid var(--accent);
outline-offset: 3px;
}
.speaker-upload:has(input:disabled) {
opacity: 0.55;
cursor: not-allowed;
}
.speaker-upload:has(input:disabled) input[type="file"] {
cursor: not-allowed;
}
.speaker-upload-spinner {
animation: speaker-upload-rotate 900ms linear infinite;
}
@keyframes speaker-upload-rotate {
to {
transform: rotate(360deg);
}
}
@media (prefers-reduced-motion: reduce) {
.speaker-upload-spinner {
animation: none;
}
}
:root {
--bg: #f0f2f6; --phone-bg: #ffffff; --surface: #ffffff; --surface-2: #f4f5f9;
--line: #e4e6ee; --text: #423c3c; --muted: #8a8484;