diff --git a/src/components/menu-solve-options/menu-solve-options.tsx b/src/components/menu-solve-options/menu-solve-options.tsx new file mode 100644 index 00000000..e61486a8 --- /dev/null +++ b/src/components/menu-solve-options/menu-solve-options.tsx @@ -0,0 +1,105 @@ +import { Button } from "@/components/ui/button"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip"; +import { Solve } from "@/interfaces/Solve"; +import updateSolve from "@/lib/updateSolve"; +import { useTimerStore } from "@/store/timerStore"; +import { BookmarkIcon, CopyIcon, Cross1Icon } from "@radix-ui/react-icons"; + +export default function MenuSolveOptions({ solve }: { solve: Solve | null }) { + const { selectedCube, cubes, mergeUpdateSelectedCube } = useTimerStore(); + if (!solve && !selectedCube) return null; + + const handleDeleteSolve = async () => { + if (solve && selectedCube) { + const updatedCube = await updateSolve({ + solveId: solve.id, + selectedCube: selectedCube, + type: "DELETE", + }); + mergeUpdateSelectedCube(updatedCube, cubes); + } + }; + + const handlePenaltyPlus2 = async () => { + if (solve && selectedCube) { + const updatedCube = await updateSolve({ + solveId: solve.id, + selectedCube: selectedCube, + type: "+2", + }); + mergeUpdateSelectedCube(updatedCube, cubes); + } + }; + + const handleBookmarkSolve = async () => { + if (solve && selectedCube) { + const updatedCube = await updateSolve({ + solveId: solve.id, + selectedCube: selectedCube, + type: "BOOKMARK", + }); + mergeUpdateSelectedCube(updatedCube, cubes); + } + }; + + const handleClipboardSolve = () => {}; + + return ( + <> + {/* options */} +
Delete
++2 Penalty
+Bookmark
+Copy
+- {formatTime(solve?.time || 0)} -
+@@ -76,56 +70,12 @@ export default function SheetSolveDetails() {
Delete
-+2 Penalty
-Bookmark
-Copy
-