Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/src/components/History.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,8 @@ export default function History({ onShowHome, onShowLogger, onShowHistory, onSho
<div key={session.id} style={{ marginBottom: 4, opacity: muscleFilter.length > 0 && !isFilterMatch ? 0.45 : 1 }}>
<button
onClick={() => toggleExpand(session.id)}
aria-expanded={isExpanded}
aria-controls={`session-content-${session.id}`}
style={{
width: "100%", display: "flex", alignItems: "center", gap: 8,
background: "var(--cds-layer-01)",
Expand All @@ -453,7 +455,7 @@ export default function History({ onShowHome, onShowLogger, onShowHistory, onSho
</button>

{isExpanded && (
<div style={{ border: "1px solid var(--cds-border-subtle-01)", borderTop: "none", padding: "16px 14px", marginBottom: 0 }}>
<div id={`session-content-${session.id}`} aria-live="polite" style={{ border: "1px solid var(--cds-border-subtle-01)", borderTop: "none", padding: "16px 14px", marginBottom: 0 }}>

{/* Gym class tag (read) or selector (edit) */}
{isEditing ? (
Expand Down
26 changes: 18 additions & 8 deletions app/src/components/MuscleMap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,14 @@ export default function MuscleMap({ onShowHome, onShowLogger, onShowHistory, onS
Last opp ett eller flere bilder av treningsprogrammet.
</p>

<p aria-live="polite" style={{ position: "absolute", width: 1, height: 1, overflow: "hidden", clip: "rect(0,0,0,0)", whiteSpace: "nowrap" }}>
{images.length > 0 ? `${images.length} bilde${images.length !== 1 ? "r" : ""} valgt` : ""}
</p>

{images.length === 0 ? (
<div
role="region"
aria-label="Last opp treningsbilde"
onDragOver={(e) => { e.preventDefault(); dispatch({ type: "SET_DRAGGING", dragging: true }); }}
onDragLeave={() => dispatch({ type: "SET_DRAGGING", dragging: false })}
onDrop={(e) => { e.preventDefault(); dispatch({ type: "SET_DRAGGING", dragging: false }); handleFiles(e.dataTransfer.files); }}
Expand All @@ -277,23 +283,26 @@ export default function MuscleMap({ onShowHome, onShowLogger, onShowHistory, onS
}}
>
<div style={{ textAlign: "center", padding: "48px 20px 40px" }}>
<Camera size={40} style={{ color: "var(--cds-text-secondary)", marginBottom: 12 }} />
<Camera size={40} aria-hidden="true" style={{ color: "var(--cds-text-secondary)", marginBottom: 12 }} />
<p style={{ fontSize: 15, fontWeight: 600, marginBottom: 4 }}>Trykk for å velge bilde</p>
<p style={{ fontSize: 12, color: "var(--cds-text-secondary)" }}>eller dra og slipp · JPEG, PNG, WebP · flere bilder støttes</p>
</div>
</div>
) : (
<div
role="region"
aria-label="Last opp treningsbilde"
onDragOver={(e) => { e.preventDefault(); dispatch({ type: "SET_DRAGGING", dragging: true }); }}
onDragLeave={() => dispatch({ type: "SET_DRAGGING", dragging: false })}
onDrop={(e) => { e.preventDefault(); dispatch({ type: "SET_DRAGGING", dragging: false }); handleFiles(e.dataTransfer.files); }}
style={{ marginBottom: 14 }}
>
<div style={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 8 }}>
{images.map(img => (
{images.map((img, idx) => (
<div key={img.id} style={{ position: "relative", overflow: "hidden", aspectRatio: "1", background: "var(--cds-layer-01)" }}>
<img src={img.preview} alt="" style={{ width: "100%", height: "100%", objectFit: "cover", display: "block" }} />
<img src={img.preview} alt={`Treningsbilde ${idx + 1}`} style={{ width: "100%", height: "100%", objectFit: "cover", display: "block" }} />
<button
aria-label={`Fjern bilde ${idx + 1}`}
onClick={() => dispatch({ type: "REMOVE_IMAGE", id: img.id })}
style={{
position: "absolute", top: 4, right: 4,
Expand All @@ -306,18 +315,19 @@ export default function MuscleMap({ onShowHome, onShowLogger, onShowHistory, onS
</button>
</div>
))}
<div
<button
onClick={() => fileRef.current?.click()}
aria-label="Legg til flere bilder"
style={{
border: `1px dashed ${dragging ? "var(--cds-interactive)" : "#6f6f6f"}`,
background: dragging ? "var(--cds-layer-hover-01)" : "transparent",
display: "flex", flexDirection: "column",
alignItems: "center", justifyContent: "center",
aspectRatio: "1", cursor: "pointer", gap: 4,
}}>
<Add size={20} style={{ color: "var(--cds-text-secondary)" }} />
<Add size={20} aria-hidden="true" style={{ color: "var(--cds-text-secondary)" }} />
<span style={{ fontSize: 10, color: "var(--cds-text-secondary)", letterSpacing: "0.5px" }}>Legg til</span>
</div>
</button>
</div>
</div>
)}
Expand Down Expand Up @@ -372,7 +382,7 @@ export default function MuscleMap({ onShowHome, onShowLogger, onShowHistory, onS

{/* ── ANALYZING ── */}
{step === "analyzing" && (
<div style={{ textAlign: "center", padding: "70px 0" }}>
<div aria-live="polite" aria-busy="true" style={{ textAlign: "center", padding: "70px 0" }}>
<InlineLoading
description="Leser treningsprogram og identifiserer øvelser…"
status="active"
Expand Down Expand Up @@ -481,7 +491,7 @@ export default function MuscleMap({ onShowHome, onShowLogger, onShowHistory, onS
<div style={{ display: "flex", gap: 12, marginBottom: 18, alignItems: "center", flexWrap: "wrap" }}>
<Tag type="green" size="sm">Primær ({muscles.primary.length})</Tag>
<Tag type="blue" size="sm">Sekundær ({muscles.secondary.length})</Tag>
<div style={{ marginLeft: "auto" }}>
<div aria-live="polite" style={{ marginLeft: "auto" }}>
{saving && <InlineLoading description="Lagrer…" status="active" />}
{saved && <InlineLoading description="Lagret" status="finished" />}
{saveError && <InlineLoading description="Lagring feilet" status="error" />}
Expand Down
Loading