feat: integrate database operations for movie management in global store and UI components; enhance MovieCast with dynamic cast display and button for full cast visibility
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
"use client";
|
||||
import { FC } from "react";
|
||||
import { addMovie, deleteMovie, updateMovie } from "@/lib/db";
|
||||
import { useGlobalStore } from "@/app/store/globalStore";
|
||||
import { Movie } from "@/types/global";
|
||||
import {
|
||||
@@ -37,23 +36,19 @@ export const MovieCard: FC<Props> = ({
|
||||
const buttonClass =
|
||||
"p-4 text-sm transition-colors cursor-pointer text-center group/toggle";
|
||||
|
||||
const handleAdd = async () => {
|
||||
await addMovie(movie);
|
||||
const handleAdd = () => {
|
||||
addMovieToStore(movie);
|
||||
};
|
||||
|
||||
const handleRemove = async () => {
|
||||
await deleteMovie(id);
|
||||
const handleRemove = () => {
|
||||
deleteMovieFromStore(id);
|
||||
};
|
||||
|
||||
const handleSeen = async () => {
|
||||
await updateMovie(id, { seen: !movie.seen });
|
||||
const handleSeen = () => {
|
||||
updateMovieInStore(id, { seen: !movie.seen });
|
||||
};
|
||||
|
||||
const handleFavorite = async () => {
|
||||
await updateMovie(id, { favorite: !movie.favorite });
|
||||
const handleFavorite = () => {
|
||||
updateMovieInStore(id, { favorite: !movie.favorite });
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user