File tree Expand file tree Collapse file tree
apps/quartz-app/src/components/layout Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ type HeaderProps = {};
1313const Header : React . FC < HeaderProps > = ( ) => {
1414 const { showUserMenu, setShowUserMenu } = useUserMenu ( ) ;
1515 const [ combinedData ] = useGlobalState ( "combinedData" ) ;
16+ const [ forecastHorizon ] = useGlobalState ( "forecastHorizon" ) ;
17+ const [ forecastHorizonMinutes ] = useGlobalState ( "forecastHorizonMinutes" ) ;
1618 const { user } = useUser ( ) ;
1719 const downloadCsv = async ( ) => {
1820 console . log ( "Download CSV" ) ;
@@ -78,7 +80,14 @@ const Header: React.FC<HeaderProps> = () => {
7880 const a = document . createElement ( "a" ) ;
7981 a . href = URL . createObjectURL ( new Blob ( [ csv ] , { type : "text/csv" } ) ) ;
8082 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
8291 . toString ( )
8392 . slice ( 0 , 16 )
8493 . replaceAll ( "T" , "_" ) } .csv`;
You can’t perform that action at this time.
0 commit comments