Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

teacher tool: autorun placement #9856

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}