Skip to content

Commit

Permalink
Fix event creation
Browse files Browse the repository at this point in the history
  • Loading branch information
omfj committed Feb 21, 2025
1 parent 5d4d995 commit dab1748
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions apps/www/src/lib/components/ui/Combobox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
let filteredOptions = $derived(
options.filter((option) => {
if (!value) return true;
return option.value.toLowerCase().includes(value.toLowerCase());
return option.label?.toLowerCase().includes(value.toLowerCase());
})
);
Expand All @@ -40,19 +40,19 @@
<Combobox.Root items={filteredOptions} bind:inputValue={value} onSelectedChange={handleChange}>
<div class={cn('relative', className)}>
<Combobox.Input
class="placeholder:text-foreground-alt/50 inline-flex h-10 w-full truncate rounded-[9px] border border-border bg-white px-4 transition-colors focus:outline-none focus:ring-2 focus:ring-foreground focus:ring-offset-2 focus:ring-offset-background"
class="placeholder:text-foreground-alt/50 border-border focus:ring-foreground focus:ring-offset-background inline-flex h-10 w-full truncate rounded-[9px] border bg-white px-4 transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2"
{placeholder}
/>
<ChevronUp class="absolute end-3 top-1/2 size-4 -translate-y-1/2 text-gray-600" />
</div>

<Combobox.Content
class="max-h-52 w-full overflow-y-auto rounded-xl border border-border bg-white px-1 py-3 shadow outline-none"
class="border-border max-h-52 w-full overflow-y-auto rounded-xl border bg-white px-1 py-3 shadow outline-none"
sideOffset={8}
>
{#each filteredOptions as option (option.value)}
<Combobox.Item
class="flex h-10 w-full select-none items-center rounded-lg py-3 pl-5 pr-1.5 text-sm capitalize outline-none transition-all duration-75 data-[disabled]:cursor-not-allowed data-[highlighted]:bg-muted data-[disabled]:opacity-50"
class="data-[highlighted]:bg-muted flex h-10 w-full select-none items-center rounded-lg py-3 pl-5 pr-1.5 text-sm capitalize outline-none transition-all duration-75 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50"
value={option.value}
label={option.label}
disabled={disabledOptions?.includes(option.value)}
Expand Down
6 changes: 3 additions & 3 deletions apps/www/src/lib/states/create-event-state.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ export class CreateEventState {
date: this.date,
shifts: this.shifts.map((shift) => {
return {
start: shift.startAt,
end: shift.endAt,
startAt: shift.startAt,
endAt: shift.endAt,
users: shift.users.map((user) => user.id).filter(Boolean)
};
})
};
}

isValid() {
const { success } = CreateEventSchema.safeParse(this.json);
const { success } = CreateEventSchema.safeParse(this.json());
return success;
}

Expand Down

0 comments on commit dab1748

Please sign in to comment.