diff --git a/react-common/components/controls/Button.tsx b/react-common/components/controls/Button.tsx index eeee5ab0f21e..143d693092ce 100644 --- a/react-common/components/controls/Button.tsx +++ b/react-common/components/controls/Button.tsx @@ -21,6 +21,7 @@ export interface ButtonViewProps extends ContainerProps { ariaPosInSet?: number; ariaSetSize?: number; ariaSelected?: boolean; + ariaPressed?: boolean | "mixed"; } @@ -44,6 +45,7 @@ export const Button = (props: ButtonProps) => { ariaPosInSet, ariaSetSize, ariaSelected, + ariaPressed, role, onClick, onKeydown, @@ -101,7 +103,8 @@ export const Button = (props: ButtonProps) => { aria-posinset={ariaPosInSet} aria-setsize={ariaSetSize} aria-describedby={ariaDescribedBy} - aria-selected={ariaSelected}> + aria-selected={ariaSelected} + aria-pressed={ariaPressed}> {(leftIcon || rightIcon || label) && ( {leftIcon && } diff --git a/teachertool/src/App.tsx b/teachertool/src/App.tsx index 893c2fbfe5c9..bcf40daf2830 100644 --- a/teachertool/src/App.tsx +++ b/teachertool/src/App.tsx @@ -6,12 +6,10 @@ import * as Actions from "./state/actions"; import * as NotificationService from "./services/notificationService"; import { downloadTargetConfigAsync } from "./services/backendRequests"; import { logDebug } from "./services/loggingService"; - import { HeaderBar } from "./components/HeaderBar"; import { MainPanel } from "./components/MainPanel"; import { Notifications } from "./components/Notifications"; import { CatalogModal } from "./components/CatalogModal"; - import { postNotification } from "./transforms/postNotification"; import { loadCatalogAsync } from "./transforms/loadCatalogAsync"; import { loadValidatorPlansAsync } from "./transforms/loadValidatorPlansAsync"; @@ -27,6 +25,7 @@ export const App = () => { useEffect(() => { if (ready && !inited) { NotificationService.initialize(); + Promise.resolve().then(async () => { const cfg = await downloadTargetConfigAsync(); dispatch(Actions.setTargetConfig(cfg || {})); @@ -35,17 +34,13 @@ export const App = () => { // Load catalog and validator plans into state. await loadCatalogAsync(); await loadValidatorPlansAsync(); - await tryLoadLastActiveRubricAsync(); - // TODO: Remove this. Delay app init to expose any startup race conditions. - setTimeout(() => { - // Test notification - postNotification(makeNotification("🎓", 2000)); - setInited(true); + // Test notification + postNotification(makeNotification("🎓", 2000)); - logDebug("App initialized"); - }, 10); + setInited(true); + logDebug("App initialized"); }); } }, [ready, inited]); diff --git a/teachertool/src/components/RubricWorkspace.tsx b/teachertool/src/components/RubricWorkspace.tsx index 62ed16b03cb8..92af155282b3 100644 --- a/teachertool/src/components/RubricWorkspace.tsx +++ b/teachertool/src/components/RubricWorkspace.tsx @@ -9,7 +9,6 @@ import { TabGroup, TabButton } from "./TabGroup"; import { TabPanel } from "./TabPanel"; import { EvalResultDisplay } from "./EvalResultDisplay"; import { ActiveRubricDisplay } from "./ActiveRubricDisplay"; -import { ToolbarControlGroup, ToolbarButton, ToolbarMenuDropdown } from "./ToolbarControls"; import { MenuItem } from "react-common/components/controls/MenuDropdown"; import { TabName } from "../types"; import { runEvaluateAsync } from "../transforms/runEvaluateAsync"; @@ -17,6 +16,7 @@ import { writeRubricToFile } from "../services/fileSystemService"; import { showModal } from "../transforms/showModal"; import { isProjectLoaded } from "../state/helpers"; import { setActiveTab } from "../transforms/setActiveTab"; +import { setAutorun } from "../transforms/setAutorun"; function handleImportRubricClicked() { showModal("import-rubric"); @@ -58,6 +58,21 @@ const WorkspaceTabPanels: React.FC = () => { ); }; +const WorkspaceAutorun: React.FC = () => { + const { state: teacherTool } = useContext(AppStateContext); + const { autorun } = teacherTool; + + const onChange = (checked: boolean) => { + setAutorun(checked); + }; + + return ( + + + + ); +}; + function getActionMenuItems(tab: TabName): MenuItem[] { switch (tab) { case "rubric": @@ -87,20 +102,20 @@ const WorkspaceToolbarButtons: React.FC = () => { const actionItems = getActionMenuItems(activeTab); return ( - + {activeTab === "results" && ( - console.log("Print")} /> + console.log("Print")} /> )} - - - + + ); }; @@ -109,7 +124,7 @@ interface IProps {} export const RubricWorkspace: React.FC = () => { return (
- } right={} /> + } center={} right={} />
); diff --git a/teachertool/src/components/Toolbar.tsx b/teachertool/src/components/Toolbar.tsx index a0ffaa21ce38..0db4a28f6222 100644 --- a/teachertool/src/components/Toolbar.tsx +++ b/teachertool/src/components/Toolbar.tsx @@ -3,14 +3,72 @@ import * as React from "react"; import css from "./styling/Toolbar.module.scss"; import { classList } from "react-common/components/util"; +import { Button, ButtonProps } from "react-common/components/controls/Button"; +import { MenuDropdown, MenuDropdownProps } from "react-common/components/controls/MenuDropdown"; -interface IProps { +interface ToolbarButtonProps extends ButtonProps { + icon: string; +} + +const ToolbarButton: React.FC = props => { + return ( +