added adding and editing of availabilities
This commit is contained in:
@@ -5,34 +5,49 @@ import {
|
||||
VisuallyHidden,
|
||||
} from "@heroui/react";
|
||||
|
||||
export default function ColorSelector() {
|
||||
const colors = [
|
||||
{ value: "Red", tailwind: "red-600" },
|
||||
{ value: "Orange", tailwind: "orange-600" },
|
||||
{ value: "Amber", tailwind: "amber-600" },
|
||||
{ value: "Yellow", tailwind: "yellow-600" },
|
||||
{ value: "Lime", tailwind: "lime-600" },
|
||||
{ value: "Green", tailwind: "green-600" },
|
||||
{ value: "Emerald", tailwind: "emerald-600" },
|
||||
{ value: "Teal", tailwind: "teal-600" },
|
||||
{ value: "Cyan", tailwind: "cyan-600" },
|
||||
{ value: "Sky", tailwind: "sky-600" },
|
||||
{ value: "Blue", tailwind: "blue-600" },
|
||||
{ value: "Indigo", tailwind: "indigo-600" },
|
||||
{ value: "Violet", tailwind: "violet-600" },
|
||||
{ value: "Purple", tailwind: "purple-600" },
|
||||
{ value: "Fuchsia", tailwind: "fuchsia-600" },
|
||||
{ value: "Pink", tailwind: "pink-600" },
|
||||
];
|
||||
export const colors = [
|
||||
{ value: "Red", tailwind: "red-600" },
|
||||
{ value: "Orange", tailwind: "orange-600" },
|
||||
{ value: "Amber", tailwind: "amber-600" },
|
||||
{ value: "Yellow", tailwind: "yellow-600" },
|
||||
{ value: "Lime", tailwind: "lime-600" },
|
||||
{ value: "Green", tailwind: "green-600" },
|
||||
{ value: "Emerald", tailwind: "emerald-600" },
|
||||
{ value: "Teal", tailwind: "teal-600" },
|
||||
{ value: "Cyan", tailwind: "cyan-600" },
|
||||
{ value: "Sky", tailwind: "sky-600" },
|
||||
{ value: "Blue", tailwind: "blue-600" },
|
||||
{ value: "Indigo", tailwind: "indigo-600" },
|
||||
{ value: "Violet", tailwind: "violet-600" },
|
||||
{ value: "Purple", tailwind: "purple-600" },
|
||||
{ value: "Fuchsia", tailwind: "fuchsia-600" },
|
||||
{ value: "Pink", tailwind: "pink-600" },
|
||||
];
|
||||
|
||||
export function color2Tailwind(v: string): string | undefined {
|
||||
const find = colors.find((c) => c.value === v)?.tailwind;
|
||||
|
||||
return find;
|
||||
}
|
||||
|
||||
export default function ColorSelector(props: {
|
||||
name?: string;
|
||||
value?: string;
|
||||
onValueChange?: (value: string) => void;
|
||||
}) {
|
||||
return (
|
||||
<RadioGroup classNames={{ wrapper: "grid grid-cols-4" }}>
|
||||
<RadioGroup
|
||||
value={props.value}
|
||||
onValueChange={props.onValueChange}
|
||||
classNames={{ wrapper: "grid grid-cols-4" }}
|
||||
name={props.name}
|
||||
>
|
||||
{colors.map((color) => (
|
||||
<ColorRadio
|
||||
description={color.value}
|
||||
value={color.value}
|
||||
key={color.value}
|
||||
radioColor={`bg-${color.tailwind}`}
|
||||
radiocolor={`bg-${color.tailwind}`}
|
||||
>
|
||||
<div>{color.value}</div>
|
||||
</ColorRadio>
|
||||
@@ -41,13 +56,13 @@ export default function ColorSelector() {
|
||||
);
|
||||
}
|
||||
|
||||
function ColorRadio(props: { radioColor: string } & RadioProps) {
|
||||
function ColorRadio(props: { radiocolor: string } & RadioProps) {
|
||||
const { Component, children, getBaseProps, getInputProps } = useRadio(props);
|
||||
|
||||
return (
|
||||
<Component
|
||||
{...getBaseProps()}
|
||||
className={`aspect-square cursor-pointer rounded-lg border-2 border-default tap-highlight-transparent hover:opacity-70 active:opacity-50 data-[selected=true]:border-primary ${props.radioColor} flex items-center justify-center p-1`}
|
||||
className={`aspect-square cursor-pointer rounded-lg border-2 border-default text-foreground transition tap-highlight-transparent hover:opacity-70 active:opacity-50 data-[selected=true]:border-2 data-[selected=true]:border-stone-300 ${props.radiocolor} flex select-none items-center justify-center p-1 text-sm`}
|
||||
>
|
||||
<VisuallyHidden>
|
||||
<input {...getInputProps()} />
|
||||
|
||||
@@ -183,7 +183,7 @@ export default function EditEvent(props: {
|
||||
>
|
||||
{tasksMap !== undefined ? (
|
||||
Object.entries(tasksMap)
|
||||
.filter(([, task]) => !task.disabled)
|
||||
.filter(([, task]) => task.enabled)
|
||||
.map(([id, task]) => (
|
||||
<div key={id}>
|
||||
<Checkbox value={id}>{task.text}</Checkbox>
|
||||
|
||||
Reference in New Issue
Block a user