Skip to content

Commit 7f54d26

Browse files
committed
Feature - Major update # 5
1 parent f1baf0f commit 7f54d26

36 files changed

+1276
-572
lines changed

client/.eslintrc.json

+22-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,28 @@
1717
"ecmaVersion": "latest",
1818
"sourceType": "module"
1919
},
20-
"plugins": ["@typescript-eslint", "react"],
20+
"overrides": [
21+
{
22+
"files": ["**/*.js", "**/*.ts", "**/*.tsx"],
23+
"rules": {
24+
"simple-import-sort/imports": [
25+
"error",
26+
{
27+
"groups": [
28+
["^react$", "^next", "^[a-z]"],
29+
["^@"],
30+
["^~"],
31+
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
32+
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
33+
["^.+\\.s?css$"],
34+
["^\\u0000"]
35+
]
36+
}
37+
]
38+
}
39+
}
40+
],
41+
"plugins": ["@typescript-eslint", "react", "simple-import-sort"],
2142
"rules": {
2243
"react-refresh/only-export-components": "warn",
2344
"react-hooks/rules-of-hooks": "error",

client/package-lock.json

+66-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@
1111
"preview": "vite preview"
1212
},
1313
"dependencies": {
14+
"@hookform/resolvers": "^3.3.4",
1415
"@tanstack/react-query": "^5.18.0",
16+
"@tanstack/react-query-devtools": "^5.18.1",
1517
"axios": "^1.6.7",
1618
"flowbite-react": "^0.7.2",
1719
"react": "^18.2.0",
1820
"react-dom": "^18.2.0",
19-
"react-hook-form": "^7.49.3",
21+
"react-hook-form": "^7.50.0",
2022
"react-icons": "^5.0.1",
23+
"react-multi-carousel": "^2.8.4",
2124
"react-router-dom": "^6.21.3",
2225
"vite-plugin-compression2": "^0.12.0",
2326
"vite-plugin-image-optimizer": "^1.1.7",
@@ -37,6 +40,7 @@
3740
"eslint-plugin-react": "^7.33.2",
3841
"eslint-plugin-react-hooks": "^4.6.0",
3942
"eslint-plugin-react-refresh": "^0.4.5",
43+
"eslint-plugin-simple-import-sort": "^10.0.0",
4044
"postcss": "^8.4.33",
4145
"prettier": "^3.2.4",
4246
"prettier-plugin-tailwindcss": "^0.5.11",

client/src/App.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import "./App.css";
22
import { Flowbite } from "flowbite-react";
33
import { Routes, Route } from "react-router-dom";
44
import { lazy, Suspense } from "react";
5+
import { Spinner } from "./components";
56

67
const Error = lazy(() =>
78
import("./pages/Error").then(({ Error }) => ({ default: Error })),
89
);
9-
1010
const Movies = lazy(() =>
1111
import("./pages/Movies").then(({ Movies }) => ({ default: Movies })),
1212
);
@@ -27,7 +27,7 @@ const Footer = lazy(() =>
2727
const Navbar = lazy(() =>
2828
import("./components").then(({ Navbar }) => ({ default: Navbar })),
2929
);
30-
import { Spinner } from "./components";
30+
3131
function App() {
3232
return (
3333
<>
@@ -38,7 +38,7 @@ function App() {
3838
<Route path="/" element={<Movies />} />
3939
<Route path="/login" element={<Login />} />
4040
<Route path="/sign-up" element={<Signup />} />
41-
<Route path="/movie/:movieTitle" element={<MovieDetails />} />
41+
<Route path="/movie/:title" element={<MovieDetails />} />
4242
<Route path="*" element={<Error />} />
4343
</Routes>
4444
<div className="bg-gray-50 pt-5 dark:bg-gray-900 lg:pt-10">

client/src/components/carousel/Carousel.tsx

-30
This file was deleted.

client/src/components/index.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export { Navbar } from "./navbar/Navbar";
22
export { Footer } from "./footer/Footer";
3-
export { Carousel } from "./carousel/Carousel";
43
export { Search } from "./movie-search/Search";
54
export { Star } from "./dummy-stars/Star";
65
export { Spinner } from "./spinner/Spinner";
@@ -11,5 +10,7 @@ export { Rating } from "./rating/Rating";
1110
export { Button } from "./button/Button";
1211
export { TrailerEmbed } from "./trailer-embed/TrailerEmbed";
1312
export { Modal as ErrorModal } from "./modal/Modal";
14-
export { DeleteConfirmationModal } from "./movie-reviews/DeleteConfirmationModal";
13+
export { DeleteConfirmationModal } from "./modal/DeleteConfirmationModal";
1514
export { AddUpdateReviewModal } from "./movie-reviews/AddUpdateReviewModal";
15+
export { AddUpdateMovieModal } from "./movie-details/AddUpdateMovieModal";
16+
export { NotAuthenticatedModal } from "./modal/NotAuthenticatedModal";

client/src/components/movie-reviews/DeleteConfirmationModal.tsx client/src/components/modal/DeleteConfirmationModal.tsx

+24-10
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,55 @@ import { Modal } from "flowbite-react";
22
import { Button } from "..";
33
import { useState } from "react";
44
import { HiOutlineExclamationCircle } from "react-icons/hi";
5-
import { useDeleteReview } from "../../hooks/useReview";
65

76
type DeleteConfirmationProps = {
7+
type: "review" | "movie";
88
show: boolean;
9-
reviewId: string;
9+
reviewId?: string;
10+
movieId?: string;
1011
handleShowDeleteModal: () => void;
12+
handleDeletion: (id: string) => void;
13+
message: string;
1114
};
1215

1316
export const DeleteConfirmationModal = ({
17+
type,
1418
show,
1519
handleShowDeleteModal,
1620
reviewId,
21+
movieId,
22+
message,
23+
handleDeletion,
1724
}: DeleteConfirmationProps) => {
18-
const [openModal, setOpenModal] = useState(show);
25+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
26+
const [openModal] = useState(show);
1927

20-
const deleteMutation = useDeleteReview();
21-
const handleDeleteReview = (id: string) => {
22-
deleteMutation.mutate(id);
23-
};
2428
return (
2529
<>
26-
<Modal show={openModal} size="md" onClose={handleShowDeleteModal} popup>
30+
<Modal
31+
className="backdrop-blur-sm"
32+
show={openModal}
33+
size="md"
34+
onClose={handleShowDeleteModal}
35+
popup
36+
>
2737
<Modal.Header />
2838
<Modal.Body>
2939
<div className="text-center">
3040
<HiOutlineExclamationCircle className="mx-auto mb-4 h-14 w-14 text-gray-400 dark:text-gray-200" />
3141
<h3 className="mb-5 text-lg font-normal text-gray-500 dark:text-gray-400">
32-
Are you sure you want to delete this Review?
42+
{message}
3343
</h3>
3444
<div className="flex justify-center gap-4">
3545
<Button
3646
title={"Yes, I'm sure"}
3747
color="failure"
3848
onClick={() => {
39-
handleDeleteReview(reviewId);
49+
handleDeletion(
50+
type === "review"
51+
? (reviewId as string)
52+
: (movieId as string),
53+
);
4054
handleShowDeleteModal();
4155
}}
4256
></Button>

client/src/components/modal/Modal.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Modal as Component } from "flowbite-react";
22
import { useState, useEffect } from "react";
33
import { HiOutlineExclamationCircle } from "react-icons/hi";
4-
import { useNavigate } from "react-router-dom";
4+
// import { useNavigate } from "react-router-dom";
55

66
type ModalProps = {
77
show: boolean;
@@ -10,7 +10,7 @@ type ModalProps = {
1010

1111
export const Modal = ({ show, message }: ModalProps) => {
1212
const [openModal, setOpenModal] = useState(show);
13-
const navigate = useNavigate();
13+
//const navigate = useNavigate();
1414
useEffect(() => {
1515
if (openModal) {
1616
const timer = setTimeout(() => {

0 commit comments

Comments
 (0)