UNPKG

@datalayer/core

Version:
19 lines (18 loc) 1.34 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; /* * Copyright (c) 2023-2025 Datalayer, Inc. * Distributed under the terms of the Modified BSD License. */ import { Button, Box } from '@primer/react'; import { RepoPushIcon, PlayIcon, StopIcon } from '@primer/octicons-react'; import { notebookStore } from '@datalayer/jupyter-react'; import { useGradeStore } from '../../state'; export const AssignmentEditorToolbar = (props) => { const { notebookId } = props; const { grade } = useGradeStore(); const notebook = notebookStore.getState().selectNotebook(notebookId); return (_jsxs(Box, { display: "flex", children: [_jsx(Box, { children: _jsx(Button, { variant: "invisible", size: "small", leadingVisual: RepoPushIcon, onClick: () => grade(new Date()), children: "Grade" }) }), notebook?.kernelStatus !== 'busy' && _jsx(Box, { children: _jsx(Button, { variant: "invisible", size: "small", leadingVisual: PlayIcon, onClick: e => notebookStore.getState().runAll(notebookId), children: "Run all" }) }), notebook?.kernelStatus === 'busy' && _jsx(Box, { children: _jsx(Button, { variant: "danger", size: "small", leadingVisual: StopIcon, onClick: e => notebookStore.getState().interrupt(notebookId), children: "Interrupt" }) })] })); }; export default AssignmentEditorToolbar;