feat(frontend): add step cutoff control to export options

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Michael Chihlas
2026-02-13 09:39:20 -05:00
parent 7dab7d7782
commit 441ff2ae40

View File

@@ -31,6 +31,7 @@ export function SessionDetailPage() {
const [isSavingRatings, setIsSavingRatings] = useState(false)
const [librarySteps, setLibrarySteps] = useState<Step[]>([])
const [copiedStepIndex, setCopiedStepIndex] = useState<number | null>(null)
const [maxStepIndex, setMaxStepIndex] = useState<number | null>(null)
useEffect(() => {
if (id) {
@@ -94,6 +95,7 @@ export function SessionDetailPage() {
format: exportFormat,
include_timestamps: true,
include_tree_info: true,
...(maxStepIndex !== null && { max_step_index: maxStepIndex }),
}
return await sessionsApi.export(session.id, options)
}
@@ -139,6 +141,7 @@ export function SessionDetailPage() {
format: 'psa',
include_timestamps: true,
include_tree_info: true,
...(maxStepIndex !== null && { max_step_index: maxStepIndex }),
}
const content = await sessionsApi.export(session.id, options)
if (content) {
@@ -385,6 +388,24 @@ export function SessionDetailPage() {
<option value="html">HTML</option>
<option value="psa">PSA / Ticket Note</option>
</select>
{session.decisions.length > 1 && (
<select
value={maxStepIndex ?? ''}
onChange={(e) => setMaxStepIndex(e.target.value ? Number(e.target.value) : null)}
aria-label="Export through step"
className={cn(
'rounded-md border border-white/10 bg-black/50 px-3 py-2 text-sm text-white',
'focus:border-white/30 focus:outline-none focus:ring-1 focus:ring-white/20'
)}
>
<option value="">All steps</option>
{session.decisions.map((_, idx) => (
<option key={idx + 1} value={idx + 1}>
Through step {idx + 1}
</option>
))}
</select>
)}
<button
onClick={handleCopy}
disabled={isExporting}