74ff10bfd5
- Changes the brush color in dark mode - Fixes the paste button - Fixes a bug with pasting on mobile - Adds a Sign Out button to the menu - Hides the status bar in production - Adds debug mode to preferences - Refactors style panel - Hides keyboard shortcuts when not on mobile
57 lines
1.2 KiB
TypeScript
57 lines
1.2 KiB
TypeScript
import { useSelector } from 'state'
|
|
import { ShapeTreeNode } from 'types'
|
|
import ShapeComponent from './shape'
|
|
|
|
export default function Page(): JSX.Element {
|
|
const shapesToRender = useSelector((s) => s.values.shapesToRender)
|
|
|
|
const allowHovers = useSelector((s) =>
|
|
s.isInAny('selecting', 'text', 'editingShape')
|
|
)
|
|
|
|
return (
|
|
<>
|
|
{shapesToRender.map((node) => (
|
|
<ShapeNode key={node.shape.id} node={node} allowHovers={allowHovers} />
|
|
))}
|
|
</>
|
|
)
|
|
}
|
|
|
|
interface ShapeNodeProps {
|
|
node: ShapeTreeNode
|
|
allowHovers: boolean
|
|
}
|
|
|
|
const ShapeNode = ({
|
|
node: {
|
|
shape,
|
|
children,
|
|
isEditing,
|
|
isHovered,
|
|
isDarkMode,
|
|
isSelected,
|
|
isCurrentParent,
|
|
},
|
|
allowHovers,
|
|
}: ShapeNodeProps) => {
|
|
return (
|
|
<>
|
|
<ShapeComponent
|
|
shape={shape}
|
|
isEditing={isEditing}
|
|
isHovered={allowHovers && isHovered}
|
|
isSelected={isSelected}
|
|
isDarkMode={isDarkMode}
|
|
isCurrentParent={isCurrentParent}
|
|
/>
|
|
{children.map((childNode) => (
|
|
<ShapeNode
|
|
key={childNode.shape.id}
|
|
node={childNode}
|
|
allowHovers={allowHovers}
|
|
/>
|
|
))}
|
|
</>
|
|
)
|
|
}
|