diff --git a/csm_web/frontend/src/components/data_export/DataExport.tsx b/csm_web/frontend/src/components/data_export/DataExport.tsx index 0e4a3d25..1ce3749c 100644 --- a/csm_web/frontend/src/components/data_export/DataExport.tsx +++ b/csm_web/frontend/src/components/data_export/DataExport.tsx @@ -8,15 +8,25 @@ export const DataExport = () => { return (
- {dataExportType === null ? ( - { - setDataExportType(exportType); - }} - /> - ) : ( - setDataExportType(null)} /> - )} +
+

Export Data

+
+
+
+ { + setDataExportType(exportType); + }} + /> +
+
+ {dataExportType === null ? ( +
Select export type to start.
+ ) : ( + + )} +
+
); }; diff --git a/csm_web/frontend/src/components/data_export/DataExportTypes.tsx b/csm_web/frontend/src/components/data_export/DataExportTypes.tsx index 2562ef74..abf627e4 100644 --- a/csm_web/frontend/src/components/data_export/DataExportTypes.tsx +++ b/csm_web/frontend/src/components/data_export/DataExportTypes.tsx @@ -12,10 +12,10 @@ export enum ExportType { * Object for displaying export types in the UI */ export const EXPORT_TYPE_DATA = new Map([ - [ExportType.STUDENT_DATA, "Student data"], - [ExportType.ATTENDANCE_DATA, "Attendance data"], - [ExportType.SECTION_DATA, "Section data"], - [ExportType.COURSE_DATA, "Course data"] + [ExportType.STUDENT_DATA, "Student"], + [ExportType.ATTENDANCE_DATA, "Attendance"], + [ExportType.SECTION_DATA, "Section"], + [ExportType.COURSE_DATA, "Course"] ]); export const EXPORT_COLUMNS: { diff --git a/csm_web/frontend/src/components/data_export/ExportPage.tsx b/csm_web/frontend/src/components/data_export/ExportPage.tsx index 17f30008..b9cea880 100644 --- a/csm_web/frontend/src/components/data_export/ExportPage.tsx +++ b/csm_web/frontend/src/components/data_export/ExportPage.tsx @@ -11,10 +11,9 @@ import RefreshIcon from "../../../static/frontend/img/refresh.svg"; interface ExportPageProps { dataExportType: ExportType; - onBack: () => void; } -export const ExportPage = ({ dataExportType, onBack }: ExportPageProps) => { +export const ExportPage = ({ dataExportType }: ExportPageProps) => { const { data: profiles, isSuccess: profilesLoaded, isError: profilesError } = useProfiles(); const [includedCourses, setIncludedCourses] = useState([]); const [includedFields, setIncludedFields] = useState( @@ -30,6 +29,10 @@ export const ExportPage = ({ dataExportType, onBack }: ExportPageProps) => { } }, [profilesLoaded, profiles]); + useEffect(() => { + setIncludedFields(Array.from(Object.keys(EXPORT_COLUMNS[dataExportType].optional))); + }, [dataExportType]); + if (profilesError) { return

Profiles not found

; } else if (!profilesLoaded) { @@ -121,12 +124,6 @@ export const ExportPage = ({ dataExportType, onBack }: ExportPageProps) => { return (
-
-

Export Data

- -
{courseSelection}
{columnSelection}
diff --git a/csm_web/frontend/src/components/data_export/ExportSelector.tsx b/csm_web/frontend/src/components/data_export/ExportSelector.tsx index 56cd5c6a..e05e215c 100644 --- a/csm_web/frontend/src/components/data_export/ExportSelector.tsx +++ b/csm_web/frontend/src/components/data_export/ExportSelector.tsx @@ -5,47 +5,35 @@ import { ExportType, EXPORT_TYPE_DATA } from "./DataExportTypes"; import "../../css/data-export.scss"; interface ExportSelectorProps { - onContinue: (exportType: ExportType) => void; + onSelect: (exportType: ExportType) => void; } /** * Component for selecting the courses to include in the export, * along with the export data config selection. */ -export const ExportSelector = ({ onContinue }: ExportSelectorProps) => { - const [dataExportType, setDataExportType] = useState(ExportType.ATTENDANCE_DATA); +export const ExportSelector = ({ onSelect }: ExportSelectorProps) => { + const [dataExportType, setDataExportType] = useState(null); - const handleContinue = () => { - onContinue(dataExportType); + const handleSelect = (exportType: ExportType) => { + onSelect(exportType); + setDataExportType(exportType); }; return (
-
-

Select Export Data

-
-
- {Array.from(EXPORT_TYPE_DATA.entries()) - .sort() - .map(([exportType, description]) => ( - - ))} -
-
-
-
-
- Continue -
+
+ {Array.from(EXPORT_TYPE_DATA.entries()) + .sort() + .map(([exportType, description]) => ( +
handleSelect(exportType)} + > + {description} +
+ ))}
); diff --git a/csm_web/frontend/src/css/data-export.scss b/csm_web/frontend/src/css/data-export.scss index 54f3417c..cf7dcb04 100644 --- a/csm_web/frontend/src/css/data-export.scss +++ b/csm_web/frontend/src/css/data-export.scss @@ -4,38 +4,40 @@ .data-export-container { display: flex; flex-direction: column; - gap: 40px; align-items: stretch; justify-content: center; + + padding-right: 16px; } -.export-selector-container { +.data-export-body { display: flex; - flex-direction: column; + flex-direction: row; - gap: 50px; + gap: 40px; } -.export-selector-footer { - display: flex; - align-items: center; - justify-content: center; +.data-export-sidebar { + min-width: 150px; } -.export-selector-section, -.export-page-section { +.data-export-content { + flex: 1; +} + +.export-selector-container { display: flex; flex-direction: column; - justify-content: center; + gap: 50px; + + padding-left: 24px; + margin-top: 16px; } -.export-selector-data-type-container { +.export-selector-footer { display: flex; - flex-direction: column; align-items: center; justify-content: center; - - padding-top: 15px; } .export-page-sidebar-container { @@ -52,7 +54,7 @@ .export-selector-data-type-options { display: flex; flex-direction: column; - gap: 8px; + gap: 24px; align-items: flex-start; justify-content: center; @@ -64,18 +66,27 @@ max-height: 25%; } -.export-selector-data-type-label, -.export-page-input-label { +.export-selector-data-type-label { display: block; width: 100%; + + font-size: 1.1rem; + white-space: nowrap; + + cursor: pointer; user-select: none; + + &.active { + color: $csm-green-darkened; + } } .export-page-container { display: flex; flex-direction: column; gap: 16px; + align-items: stretch; } .export-page-config { @@ -160,7 +171,7 @@ } .export-preview-table-container { - max-width: 90vw; + max-width: 80vw; overflow-x: auto; }