2023-12-13 11:46:36 -06:00
|
|
|
import { ContextMenu, DropdownMenu, Flex } from '@radix-ui/themes';
|
|
|
|
|
import { createColors } from 'bepaint';
|
|
|
|
|
import { useState } from 'react';
|
2023-12-03 10:43:42 -06:00
|
|
|
import {
|
|
|
|
|
ACCENT_COLORS,
|
|
|
|
|
AccentColor,
|
|
|
|
|
GRAY_COLORS,
|
|
|
|
|
GrayColor,
|
2023-12-13 11:46:36 -06:00
|
|
|
PALETTES,
|
2023-12-03 10:43:42 -06:00
|
|
|
} from '../../../../constants/radixColors';
|
2023-10-08 17:34:02 -05:00
|
|
|
import { useSession } from '../../../../stores/session';
|
|
|
|
|
import { CustomColumn } from './CustomColumn';
|
|
|
|
|
|
|
|
|
|
interface ContextMenuProps {
|
|
|
|
|
Builder: typeof DropdownMenu | typeof ContextMenu;
|
2023-10-14 12:04:11 -05:00
|
|
|
reset: () => void;
|
2023-10-08 17:34:02 -05:00
|
|
|
}
|
|
|
|
|
|
2023-10-14 12:04:11 -05:00
|
|
|
export function Menu({ Builder, reset }: ContextMenuProps) {
|
2023-10-08 17:34:02 -05:00
|
|
|
const session = useSession();
|
2023-12-13 11:46:36 -06:00
|
|
|
const [showTitleEditor, setShowTitleEditor] = useState(false);
|
2023-10-08 17:34:02 -05:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Builder.Content>
|
2023-12-03 10:43:42 -06:00
|
|
|
<Builder.Sub>
|
|
|
|
|
<Builder.SubTrigger>Accent color</Builder.SubTrigger>
|
|
|
|
|
|
|
|
|
|
<Builder.SubContent>
|
|
|
|
|
<Builder.RadioGroup
|
|
|
|
|
value={session.color}
|
|
|
|
|
onValueChange={(value) =>
|
|
|
|
|
useSession.setState({ color: value as AccentColor | GrayColor })
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
{[...ACCENT_COLORS, ...GRAY_COLORS].map((color) => (
|
2023-12-13 11:46:36 -06:00
|
|
|
<Builder.RadioItem value={color} key={color}>
|
|
|
|
|
<Flex gap="2" align="center">
|
|
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
backgroundColor: createColors(PALETTES[color])
|
|
|
|
|
.solidBackground,
|
|
|
|
|
width: 16,
|
|
|
|
|
height: 16,
|
|
|
|
|
borderRadius: '100%',
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
{`${color.charAt(0).toUpperCase()}${color.slice(1)}`}
|
|
|
|
|
</Flex>
|
|
|
|
|
</Builder.RadioItem>
|
2023-12-03 10:43:42 -06:00
|
|
|
))}
|
|
|
|
|
</Builder.RadioGroup>
|
|
|
|
|
</Builder.SubContent>
|
|
|
|
|
</Builder.Sub>
|
|
|
|
|
|
|
|
|
|
<Builder.Separator />
|
|
|
|
|
|
2023-10-08 17:34:02 -05:00
|
|
|
<CustomColumn Builder={Builder} column={0} />
|
|
|
|
|
<CustomColumn Builder={Builder} column={1} />
|
|
|
|
|
<CustomColumn Builder={Builder} column={2} />
|
|
|
|
|
<CustomColumn Builder={Builder} column={3} />
|
|
|
|
|
|
|
|
|
|
<Builder.Separator />
|
|
|
|
|
|
|
|
|
|
<Builder.CheckboxItem
|
|
|
|
|
checked={session.showTotal}
|
|
|
|
|
onCheckedChange={(checked) =>
|
|
|
|
|
useSession.setState({ showTotal: checked })
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
Show total
|
|
|
|
|
</Builder.CheckboxItem>
|
|
|
|
|
<Builder.CheckboxItem
|
|
|
|
|
checked={session.showCareer}
|
|
|
|
|
onCheckedChange={(checked) =>
|
|
|
|
|
useSession.setState({ showCareer: checked })
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
Show career
|
|
|
|
|
</Builder.CheckboxItem>
|
2023-10-14 12:04:11 -05:00
|
|
|
|
|
|
|
|
<Builder.Separator />
|
|
|
|
|
|
|
|
|
|
<Builder.Item color="red" onClick={reset}>
|
|
|
|
|
Reset
|
|
|
|
|
</Builder.Item>
|
2023-10-08 17:34:02 -05:00
|
|
|
</Builder.Content>
|
|
|
|
|
);
|
|
|
|
|
}
|