@@ -74,6 +74,7 @@ const ExportProgress = ({ id }: { id: string }) => {
74
74
export type ExportDialogProps = {
75
75
results ?: Result [ ] | ( ( isSamePageEnabled : boolean ) => Promise < Result [ ] > ) ;
76
76
title ?: string ;
77
+ isExportDiscourseGraph ?: boolean ;
77
78
} ;
78
79
79
80
type ExportDialogComponent = (
@@ -94,6 +95,7 @@ const ExportDialog: ExportDialogComponent = ({
94
95
isOpen,
95
96
results = [ ] ,
96
97
title = "Share Data" ,
98
+ isExportDiscourseGraph = false ,
97
99
} ) => {
98
100
const exportId = useMemo ( ( ) => nanoid ( ) , [ ] ) ;
99
101
useEffect ( ( ) => {
@@ -137,6 +139,10 @@ const ExportDialog: ExportDialogComponent = ({
137
139
const isCanvasPage = checkForCanvasPage ( selectedPageTitle ) ;
138
140
const [ isSendToGraph , setIsSendToGraph ] = useState ( false ) ;
139
141
const [ livePages , setLivePages ] = useState < Result [ ] > ( [ ] ) ;
142
+ const [ selectedTabId , setSelectedTabId ] = useState ( "sendto" ) ;
143
+ useEffect ( ( ) => {
144
+ if ( isExportDiscourseGraph ) setSelectedTabId ( "export" ) ;
145
+ } , [ isExportDiscourseGraph ] ) ;
140
146
const getDiscourseGraphSetting = ( ) =>
141
147
getExtensionAPI ( ) . settings . get ( "discourse-graphs" ) ;
142
148
const [ discourseGraphSetting , setDiscourseGraphSetting ] = useState (
@@ -294,48 +300,65 @@ const ExportDialog: ExportDialogComponent = ({
294
300
onChange = { ( e ) => setFilename ( e . target . value ) }
295
301
/>
296
302
</ Label >
297
- < FormGroup
298
- className = { discourseGraphEnabled ? "" : "hidden" }
299
- label = "Include Discourse Context"
300
- inline
301
- >
302
- < Checkbox
303
- checked = { includeDiscourseContext }
304
- onChange = { ( e ) => {
305
- setIncludeDiscourseContext (
306
- ( e . target as HTMLInputElement ) . checked
307
- ) ;
308
- } }
309
- />
310
- </ FormGroup >
311
- < div className = "text-right" >
303
+
304
+ < div className = "flex justify-between items-end" >
312
305
< span >
313
306
{ typeof results === "function"
314
307
? "Calculating number of results..."
315
308
: `Exporting ${ results . length } results` }
316
309
</ span >
317
- { window . samepage && (
318
- < Checkbox
319
- checked = { isSamePageEnabled }
320
- onChange = { ( e ) =>
321
- setIsSamePageEnabled ( ( e . target as HTMLInputElement ) . checked )
322
- }
323
- style = { { marginBottom : 0 } }
324
- labelElement = {
325
- < Tooltip
326
- content = {
327
- "Use SamePage's backend to gather this export [EXPERIMENTAL]."
310
+ < div className = "flex flex-col items-end" >
311
+ < FormGroup
312
+ className = { `m-0 ${ discourseGraphEnabled ? "" : "hidden" } ` }
313
+ inline
314
+ >
315
+ < Checkbox
316
+ alignIndicator = { "right" }
317
+ checked = { includeDiscourseContext }
318
+ onChange = { ( e ) => {
319
+ setIncludeDiscourseContext (
320
+ ( e . target as HTMLInputElement ) . checked
321
+ ) ;
322
+ } }
323
+ labelElement = {
324
+ < Tooltip
325
+ className = "m-0"
326
+ content = {
327
+ "Include the Discourse Context of each result in the export."
328
+ }
329
+ >
330
+ < span > Discourse Context</ span >
331
+ </ Tooltip >
332
+ }
333
+ />
334
+ </ FormGroup >
335
+ { window . samepage && (
336
+ < FormGroup className = "m-0 " inline >
337
+ < Checkbox
338
+ alignIndicator = { "right" }
339
+ checked = { isSamePageEnabled }
340
+ onChange = { ( e ) =>
341
+ setIsSamePageEnabled ( ( e . target as HTMLInputElement ) . checked )
328
342
}
329
- >
330
- < img
331
- src = "https://samepage.network/images/logo.png"
332
- height = { 24 }
333
- width = { 24 }
334
- />
335
- </ Tooltip >
336
- }
337
- />
338
- ) }
343
+ style = { { marginBottom : 0 } }
344
+ labelElement = {
345
+ < Tooltip
346
+ className = "m-0"
347
+ content = {
348
+ "Use SamePage's backend to gather this export [EXPERIMENTAL]."
349
+ }
350
+ >
351
+ < img
352
+ src = "https://samepage.network/images/logo.png"
353
+ height = { 24 }
354
+ width = { 24 }
355
+ />
356
+ </ Tooltip >
357
+ }
358
+ />
359
+ </ FormGroup >
360
+ ) }
361
+ </ div >
339
362
</ div >
340
363
</ div >
341
364
< div className = { Classes . DIALOG_FOOTER } >
@@ -479,7 +502,12 @@ const ExportDialog: ExportDialogComponent = ({
479
502
enforceFocus = { false }
480
503
portalClassName = { "roamjs-export-dialog-body" }
481
504
>
482
- < Tabs id = "export-tabs" large = { true } >
505
+ < Tabs
506
+ id = "export-tabs"
507
+ large = { true }
508
+ selectedTabId = { selectedTabId }
509
+ onChange = { ( newTabId : string ) => setSelectedTabId ( newTabId ) }
510
+ >
483
511
< Tab id = "sendto" title = "Send To" panel = { SendToPanel } />
484
512
< Tab id = "export" title = "Export" panel = { ExportPanel } />
485
513
</ Tabs >
0 commit comments