import * as React from 'react' import { useIntl } from 'react-intl' import { ArrowTopRightIcon, CursorArrowIcon, Pencil1Icon, Pencil2Icon, TextIcon, } from '@radix-ui/react-icons' import { TDSnapshot, TDShapeType } from '~types' import { useTldrawApp } from '~hooks' import { ToolButtonWithTooltip } from '~components/Primitives/ToolButton' import { Panel } from '~components/Primitives/Panel' import { ShapesMenu } from './ShapesMenu' import { EraserIcon } from '~components/Primitives/icons' const activeToolSelector = (s: TDSnapshot) => s.appState.activeTool const toolLockedSelector = (s: TDSnapshot) => s.appState.isToolLocked export const PrimaryTools = React.memo(function PrimaryTools() { const app = useTldrawApp() const intl = useIntl() const activeTool = app.useStore(activeToolSelector) const isToolLocked = app.useStore(toolLockedSelector) const selectSelectTool = React.useCallback(() => { app.selectTool('select') }, [app]) const selectEraseTool = React.useCallback(() => { app.selectTool('erase') }, [app]) const selectDrawTool = React.useCallback(() => { app.selectTool(TDShapeType.Draw) }, [app]) const selectArrowTool = React.useCallback(() => { app.selectTool(TDShapeType.Arrow) }, [app]) const selectTextTool = React.useCallback(() => { app.selectTool(TDShapeType.Text) }, [app]) const selectStickyTool = React.useCallback(() => { app.selectTool(TDShapeType.Sticky) }, [app]) return ( ) })