Skip to content

Commit

Permalink
autorun placement (#9856)
Browse files Browse the repository at this point in the history
  • Loading branch information
eanders-ms authored Feb 7, 2024
1 parent 360c7bf commit ecd7091
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 23 deletions.
27 changes: 8 additions & 19 deletions teachertool/src/components/RubricWorkspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,6 @@ const WorkspaceTabPanels: React.FC = () => {
);
};

const WorkspaceAutorun: React.FC = () => {
const { state: teacherTool } = useContext(AppStateContext);
const { autorun } = teacherTool;

const onChange = (checked: boolean) => {
setAutorun(checked);
};

return (
<Toolbar.ControlGroup>
<Toolbar.Toggle label={lf("auto-run")} isChecked={autorun} onChange={onChange} />
</Toolbar.ControlGroup>
);
};

function getActionMenuItems(tab: TabName): MenuItem[] {
switch (tab) {
case "rubric":
Expand All @@ -97,23 +82,27 @@ function getActionMenuItems(tab: TabName): MenuItem[] {

const WorkspaceToolbarButtons: React.FC = () => {
const { state: teacherTool } = useContext(AppStateContext);
const { activeTab } = teacherTool;
const { activeTab, autorun } = teacherTool;

const actionItems = getActionMenuItems(activeTab);

const onAutorunChange = (checked: boolean) => {
setAutorun(checked);
};

return (
<Toolbar.ControlGroup>
{activeTab === "results" && (
<Toolbar.Button icon="fas fa-print" title={lf("Print")} onClick={() => console.log("Print")} />
)}

{/* Conditional buttons go above this line */}
<Toolbar.Toggle label={lf("auto-run")} isChecked={autorun} onChange={onAutorunChange} />
<Toolbar.Button
icon="fas fa-play"
title={lf("Evaluate")}
onClick={handleEvaluateClickedAsync}
disabled={!isProjectLoaded(teacherTool)}
/>

<Toolbar.MenuDropdown title={lf("More Actions")} items={actionItems} disabled={!actionItems.length} />
</Toolbar.ControlGroup>
);
Expand All @@ -124,7 +113,7 @@ interface IProps {}
export const RubricWorkspace: React.FC<IProps> = () => {
return (
<div className={css.panel}>
<Toolbar left={<WorkspaceTabButtons />} center={<WorkspaceAutorun />} right={<WorkspaceToolbarButtons />} />
<Toolbar left={<WorkspaceTabButtons />} right={<WorkspaceToolbarButtons />} />
<WorkspaceTabPanels />
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,4 @@
div[class*="tt-tabview"] {
flex: 1 1 0%;
}

div[class*="tt-toolbar-center"] {
flex-grow: 1;
}
}

0 comments on commit ecd7091

Please sign in to comment.