Lara Monteagudo Tubau commited on
Commit Β·
c045122
1
Parent(s): 3dc5e3c
Improve UI/UX: phase flow, inline error handling, and status transparency
Browse files- Add inline red-box validation for missing Session ID/Researcher ID
- Replace pop-up errors with contextual status cards
- Add processing reports with timing and details
- Improve pipeline phase labels for better user orientation
- Better visual hierarchy for error/success feedback
478 unmodified lines479480481482483484485486487488489490491492493494495496497113 unmodified lines611612613614615616478 unmodified lineselse:bg, col, fw = "transparent", "#94a3b8", "400"prefix = ""parts.append(f'<span style="padding:4px 10px;border-radius:20px;background:{bg};'f'color:{col};font-weight:{fw};font-size:0.82em;white-space:nowrap">'f'{prefix}{label}</span>')sep = '<span style="color:#cbd5e1;margin:0 2px;font-size:0.8em">βΊ</span>'return (f'<div style="display:flex;align-items:center;gap:4px;flex-wrap:wrap;'f'background:#f8fafc;border:1px solid #e2e8f0;border-radius:10px;'f'padding:10px 18px;margin-bottom:12px">'f'<span style="font-size:0.72em;font-weight:700;letter-spacing:0.1em;'f'color:#94a3b8;margin-right:8px">PIPELINE</span>'f'{sep.join(parts)}'f'</div>')113 unmodified linesf'color:#1e40af;margin-top:6px">{_h(desc)}</div>')def _speaker_legend_html(speaker_map: dict) -> str:if not speaker_map:478 unmodified lines479480481482483484485486487488489490491492493494495496497113 unmodified lines611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674478 unmodified lineselse:bg, col, fw = "transparent", "#94a3b8", "400"prefix = ""stages = [("upload", "Parse", "π Upload & parse transcript"),("parsed", "Sections", "π Detect topical sections"),("sectioned", "Confirm", "β Review & confirm sections"),("coding", "Analyze", "π― Boundary detection & coding"),("complete", "Done", "β Coding complete"),]f'<div style="display:flex;align-items:center;gap:4px;flex-wrap:wrap;'f'background:#f8fafc;border:1px solid #e2e8f0;border-radius:10px;'f'padding:10px 18px;margin-bottom:12px">'f'<span style="font-size:0.72em;font-weight:700;letter-spacing:0.1em;'f'color:#94a3b8;margin-right:8px">PIPELINE</span>'for i, (_, label, _) in enumerate(stages):f'</div>')113 unmodified linesf'color:#1e40af;margin-top:6px">{_h(desc)}</div>')def _status_card(title: str,status: str = "success", # "success", "error", "warning", "processing"details: dict | None = None,processing_time_sec: float | None = None,error_msg: str | None = None,) -> str:"""Create a visual status card for process feedback.Replaces pop-ups with inline, contextual reporting.status: success/error/warning/processingdetails: dict of key-value pairs to displayprocessing_time_sec: if provided, show "X.Xs processing"error_msg: if provided, show error details"""colors = {"success": ("#f0fdf4", "#065f46", "#86efac", "β"),"error": ("#fef2f2", "#991b1b", "#fca5a5", "β"),"warning": ("#fffbeb", "#78350f", "#fbbf24", "β "),"processing": ("#eff6ff", "#1e40af", "#93c5fd", "β³"),}bg, title_color, border_color, icon = colors.get(status, colors["success"])detail_html = ""if details:detail_html = (f'<div style="display:grid;grid-template-columns:1fr 1fr;gap:12px;'f'font-size:0.88em;margin:8px 0;color:#{title_color.lstrip("#")}">')for k, v in details.items():detail_html += f'<div><strong>{_h(k)}</strong>: {_h(str(v))}</div>'detail_html += '</div>'time_html = (f'<div style="font-size:0.85em;color:#{title_color.lstrip("#")};margin-top:8px">'f'β± {processing_time_sec:.1f}s processing time</div>'if processing_time_sec is not None else "")error_html = (f'<div style="background:rgba(0,0,0,0.05);border-radius:6px;padding:8px;'f'font-family:monospace;font-size:0.78em;color:#{title_color.lstrip("#")};'f'margin-top:8px;white-space:pre-wrap;word-break:break-all">{_h(error_msg)}</div>'if error_msg else "")return (f'<div style="background:{bg};border:2px solid {border_color};'f'border-radius:8px;padding:16px;margin:12px 0">'f'<div style="color:{title_color};font-weight:700;margin-bottom:8px;font-size:0.95em">'f'{icon} {_h(title)}</div>'f'{detail_html}'f'{time_html}'f'{error_html}'f'</div>')def _speaker_legend_html(speaker_map: dict) -> str:if not speaker_map:
app.py+66-8