File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
apps/quartz-app/src/components/layout Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ type HeaderProps = {};
13
13
const Header : React . FC < HeaderProps > = ( ) => {
14
14
const { showUserMenu, setShowUserMenu } = useUserMenu ( ) ;
15
15
const [ combinedData ] = useGlobalState ( "combinedData" ) ;
16
+ const [ forecastHorizon ] = useGlobalState ( "forecastHorizon" ) ;
17
+ const [ forecastHorizonMinutes ] = useGlobalState ( "forecastHorizonMinutes" ) ;
16
18
const { user } = useUser ( ) ;
17
19
const downloadCsv = async ( ) => {
18
20
console . log ( "Download CSV" ) ;
@@ -78,7 +80,14 @@ const Header: React.FC<HeaderProps> = () => {
78
80
const a = document . createElement ( "a" ) ;
79
81
a . href = URL . createObjectURL ( new Blob ( [ csv ] , { type : "text/csv" } ) ) ;
80
82
const now = DateTime . now ( ) . setZone ( "ist" ) ;
81
- a . download = `Quartz-Data_${ now
83
+ const forecastHorizonString = forecastHorizon
84
+ . split ( "_" )
85
+ . map ( ( type ) => type . charAt ( 0 ) . toUpperCase ( ) + type . slice ( 1 ) )
86
+ . join ( "-" ) ;
87
+ const forecastHorizonTimeString = forecastHorizon . includes ( "horizon" )
88
+ ? `${ String ( forecastHorizonMinutes / 60 ) . replace ( "." , "-" ) } h`
89
+ : "" ;
90
+ a . download = `Quartz-${ forecastHorizonString } ${ forecastHorizonTimeString } _${ now
82
91
. toString ( )
83
92
. slice ( 0 , 16 )
84
93
. replaceAll ( "T" , "_" ) } .csv`;
You can’t perform that action at this time.
0 commit comments