Skip to content

Commit f0f1c49

Browse files
committed
Add ability to choose export format in UI
1 parent 2f952b4 commit f0f1c49

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

desktop-app/src/routes/transcript/+page.svelte

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<script lang="ts">
22
import { invoke } from '@tauri-apps/api/core';
33
import { revealItemInDir } from '@tauri-apps/plugin-opener';
4-
import { Button } from 'carbon-components-svelte';
4+
import { Button, Select, SelectItem } from 'carbon-components-svelte';
55
import InlineNotification from '../../components/InlineNotification.svelte';
66
import { invokeIcaCsvToFile, MissingContactError } from '../../lib/cli';
77
8-
const baseFilename = 'transcript.csv';
8+
const baseFilename = 'transcript';
99
1010
let isExporting = $state(false);
11+
let format = $state<'csv' | 'xlsx'>('csv');
1112
let errorMessage = $state('');
1213
let successMessage = $state('');
1314
let exportedFilePath = $state('');
@@ -19,8 +20,9 @@
1920
successMessage = '';
2021
2122
try {
23+
const filename = `${baseFilename}.${format}`;
2224
const outputPath = await invoke<string>('resolve_download_output_path', {
23-
baseName: baseFilename
25+
baseName: filename
2426
});
2527
await invokeIcaCsvToFile(['transcript'], outputPath);
2628
exportedFilePath = outputPath;
@@ -54,14 +56,25 @@
5456
<header>
5557
<h2>Transcript</h2>
5658
<p class="transcript-export__description">
57-
Export your full conversation transcript to CSV in Downloads. The filename will be
58-
incremented when needed (for example, transcript-1.csv).
59+
Export your full conversation transcript in your selected format to Downloads. The
60+
filename will be incremented when needed (for example, transcript-1.csv).
5961
</p>
6062
</header>
6163

6264
<form class="transcript-export__form" onsubmit={exportTranscript}>
65+
<div class="transcript-export__format">
66+
<Select labelText="Format" bind:selected={format} disabled={isExporting}>
67+
<SelectItem value="csv" text="CSV" />
68+
<SelectItem value="xlsx" text="Excel" />
69+
</Select>
70+
</div>
71+
6372
<Button type="submit" kind="primary" disabled={isExporting}>
64-
{isExporting ? 'Exporting…' : 'Export Transcript CSV'}
73+
{#if isExporting}
74+
Exporting…
75+
{:else}
76+
Export Transcript
77+
{/if}
6578
</Button>
6679
</form>
6780

@@ -106,6 +119,15 @@
106119
107120
.transcript-export__form {
108121
margin-top: 1.5rem;
122+
display: flex;
123+
flex-direction: row;
124+
align-items: flex-end;
125+
justify-content: center;
126+
gap: 1rem;
127+
}
128+
129+
.transcript-export__format {
130+
width: 12rem;
109131
}
110132
111133
.transcript-export__notification {

0 commit comments

Comments
 (0)