Skip to content

Commit

Permalink
fix watchlist button
Browse files Browse the repository at this point in the history
  • Loading branch information
olexh committed Mar 7, 2024
1 parent 4883139 commit 4c831e9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
7 changes: 6 additions & 1 deletion components/modals/watch-edit-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ const Component = ({ slug }: Props) => {
closeModal();
};

const onDeleteSubmit = async () => {
deleteFromList();
closeModal();
};

useEffect(() => {
if (watch?.status) {
setSelectedStatus(watch.status);
Expand Down Expand Up @@ -159,7 +164,7 @@ const Component = ({ slug }: Props) => {
<div className="grid w-full grid-cols-2 gap-8">
<Button
variant="destructive"
onClick={handleSubmit(() => deleteFromList())}
onClick={handleSubmit(onDeleteSubmit)}
disabled={
isSubmitting ||
addToListLoading ||
Expand Down
2 changes: 1 addition & 1 deletion components/ui/combobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export const Combobox = forwardRef(
<CommandGroup>
<ScrollArea>
<ScrollBar orientation="vertical" />
<div className="max-h-60">
<div className="max-h-72">
{props.options.map((option) => (
<Fragment key={option.value}>
{option.separator && (
Expand Down
6 changes: 4 additions & 2 deletions components/watchlist-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ const OPTIONS = [
</div>
),
})),
SETTINGS_BUTTON,
];

const Component = ({ slug, additional, disabled }: Props) => {
Expand Down Expand Up @@ -114,7 +113,10 @@ const Component = ({ slug, additional, disabled }: Props) => {

return (
<Combobox
options={OPTIONS}
options={[
...OPTIONS,
...(watch && !watchError ? [SETTINGS_BUTTON] : []),
]}
onChange={handleChangeStatus}
value={watch && !watchError ? watch.status : undefined}
renderToggle={(open, setOpen, value) => {
Expand Down

0 comments on commit 4c831e9

Please sign in to comment.