feat(frontend): add detail level dropdown and summary toggle to export controls
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -32,6 +32,8 @@ export function SessionDetailPage() {
|
|||||||
const [librarySteps, setLibrarySteps] = useState<Step[]>([])
|
const [librarySteps, setLibrarySteps] = useState<Step[]>([])
|
||||||
const [copiedStepIndex, setCopiedStepIndex] = useState<number | null>(null)
|
const [copiedStepIndex, setCopiedStepIndex] = useState<number | null>(null)
|
||||||
const [maxStepIndex, setMaxStepIndex] = useState<number | null>(null)
|
const [maxStepIndex, setMaxStepIndex] = useState<number | null>(null)
|
||||||
|
const [detailLevel, setDetailLevel] = useState<'standard' | 'full'>('standard')
|
||||||
|
const [includeSummary, setIncludeSummary] = useState(false)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (id) {
|
if (id) {
|
||||||
@@ -96,6 +98,8 @@ export function SessionDetailPage() {
|
|||||||
include_timestamps: true,
|
include_timestamps: true,
|
||||||
include_tree_info: true,
|
include_tree_info: true,
|
||||||
...(maxStepIndex !== null && { max_step_index: maxStepIndex }),
|
...(maxStepIndex !== null && { max_step_index: maxStepIndex }),
|
||||||
|
detail_level: detailLevel,
|
||||||
|
include_summary: includeSummary,
|
||||||
}
|
}
|
||||||
return await sessionsApi.export(session.id, options)
|
return await sessionsApi.export(session.id, options)
|
||||||
}
|
}
|
||||||
@@ -142,6 +146,8 @@ export function SessionDetailPage() {
|
|||||||
include_timestamps: true,
|
include_timestamps: true,
|
||||||
include_tree_info: true,
|
include_tree_info: true,
|
||||||
...(maxStepIndex !== null && { max_step_index: maxStepIndex }),
|
...(maxStepIndex !== null && { max_step_index: maxStepIndex }),
|
||||||
|
detail_level: detailLevel,
|
||||||
|
include_summary: includeSummary,
|
||||||
}
|
}
|
||||||
const content = await sessionsApi.export(session.id, options)
|
const content = await sessionsApi.export(session.id, options)
|
||||||
if (content) {
|
if (content) {
|
||||||
@@ -156,9 +162,9 @@ export function SessionDetailPage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleDownload = () => {
|
const handleDownload = (content: string) => {
|
||||||
if (!exportContent || !session) return
|
if (!session) return
|
||||||
const blob = new Blob([exportContent], { type: 'text/plain' })
|
const blob = new Blob([content], { type: 'text/plain' })
|
||||||
const url = URL.createObjectURL(blob)
|
const url = URL.createObjectURL(blob)
|
||||||
const a = document.createElement('a')
|
const a = document.createElement('a')
|
||||||
a.href = url
|
a.href = url
|
||||||
@@ -169,6 +175,30 @@ export function SessionDetailPage() {
|
|||||||
URL.revokeObjectURL(url)
|
URL.revokeObjectURL(url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleToggleSummary = async (include: boolean) => {
|
||||||
|
setIncludeSummary(include)
|
||||||
|
if (!session) return
|
||||||
|
const options: SessionExport = {
|
||||||
|
format: exportFormat,
|
||||||
|
include_timestamps: true,
|
||||||
|
include_tree_info: true,
|
||||||
|
...(maxStepIndex !== null && { max_step_index: maxStepIndex }),
|
||||||
|
detail_level: detailLevel,
|
||||||
|
include_summary: include,
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const content = await sessionsApi.export(session.id, options)
|
||||||
|
if (content) {
|
||||||
|
setExportContent(content)
|
||||||
|
toast.success(include ? 'Summary added' : 'Summary removed')
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to re-fetch export:', err)
|
||||||
|
toast.error('Failed to update export')
|
||||||
|
setIncludeSummary(!include)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const handleSaveAsTree = async (data: SaveAsTreeRequest) => {
|
const handleSaveAsTree = async (data: SaveAsTreeRequest) => {
|
||||||
if (!session) return
|
if (!session) return
|
||||||
setIsSavingTree(true)
|
setIsSavingTree(true)
|
||||||
@@ -406,6 +436,18 @@ export function SessionDetailPage() {
|
|||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
)}
|
)}
|
||||||
|
<select
|
||||||
|
value={detailLevel}
|
||||||
|
onChange={(e) => setDetailLevel(e.target.value as 'standard' | 'full')}
|
||||||
|
aria-label="Detail level"
|
||||||
|
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="standard">Standard</option>
|
||||||
|
<option value="full">Full Detail</option>
|
||||||
|
</select>
|
||||||
<button
|
<button
|
||||||
onClick={handleCopy}
|
onClick={handleCopy}
|
||||||
disabled={isExporting}
|
disabled={isExporting}
|
||||||
@@ -520,6 +562,8 @@ export function SessionDetailPage() {
|
|||||||
filename={getFilename()}
|
filename={getFilename()}
|
||||||
format={exportFormat}
|
format={exportFormat}
|
||||||
onDownload={handleDownload}
|
onDownload={handleDownload}
|
||||||
|
includeSummary={includeSummary}
|
||||||
|
onToggleSummary={handleToggleSummary}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Save as Tree Modal */}
|
{/* Save as Tree Modal */}
|
||||||
|
|||||||
Reference in New Issue
Block a user