Skip to content
Closed
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
42 changes: 42 additions & 0 deletions web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
AlertTriangle,
BarChart3,
CheckCircle2,
Copy,
Database,
Headphones,
ListChecks,
Expand Down Expand Up @@ -461,6 +462,10 @@ export function App() {
const [quickDemoError, setQuickDemoError] = useState<string | null>(null)
const [quickDemoTargetRms, setQuickDemoTargetRms] = useState(1600)
const [quickDemoScenario, setQuickDemoScenario] = useState<QuickDemoScenario>('rtp-gap')
const [copyLinkFeedback, setCopyLinkFeedback] = useState<{
kind: 'success' | 'error'
message: string
} | null>(null)
const stageDetailRef = useRef<HTMLDivElement>(null)

const timelineQuery = useQuery({
Expand Down Expand Up @@ -620,6 +625,25 @@ export function App() {
})
}

async function copyDeepLink() {
const url = new URL(window.location.href)
url.search = ''
url.searchParams.set('run_id', runId)
if (compareRunId) {
url.searchParams.set('compare_run_id', compareRunId)
}

try {
await navigator.clipboard.writeText(url.toString())
setCopyLinkFeedback({ kind: 'success', message: 'Run link copied.' })
} catch {
setCopyLinkFeedback({
kind: 'error',
message: 'Could not copy the run link. Check clipboard permissions and try again.',
})
}
}

async function loadExamplePayload() {
setExamplePayloadPending(true)
setAsyncRunError(null)
Expand Down Expand Up @@ -766,6 +790,24 @@ export function App() {
>
<RefreshCw size={17} />
</button>
<button
type="button"
title="Copy a link to the selected runs"
onClick={() => void copyDeepLink()}
disabled={!runId}
>
<Copy size={17} />
Copy link
</button>
{copyLinkFeedback ? (
<span
className={`copyLinkFeedback ${copyLinkFeedback.kind}`}
role="status"
aria-live="polite"
>
{copyLinkFeedback.message}
</span>
) : null}
</form>
</header>

Expand Down
14 changes: 13 additions & 1 deletion web/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ a {

.runForm {
display: grid;
grid-template-columns: minmax(130px, 190px) minmax(200px, 330px) minmax(200px, 330px) auto auto;
grid-template-columns: minmax(130px, 190px) minmax(200px, 330px) minmax(200px, 330px) auto auto auto;
align-items: end;
gap: 10px;
}
Expand All @@ -157,6 +157,18 @@ a {
background: #ffffff;
}

.copyLinkFeedback {
grid-column: 1 / -1;
color: #33665b;
font-size: 12px;
font-weight: 700;
text-align: right;
}

.copyLinkFeedback.error {
color: #8e2f35;
}

.summaryGrid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
Expand Down