diff --git a/astro.config.mjs b/astro.config.mjs index 0855bc7..9b19f02 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -22,8 +22,18 @@ export default defineConfig({ pathname: "/**", port: "", }, + { + protocol: "https", + hostname: "qvsxkboawsixkeqgaeja.supabase.co", + pathname: "/**", + port: "", + }, + ], + domains: [ + "image.tmdb.org", + "lh3.googleusercontent.com", + "qvsxkboawsixkeqgaeja.supabase.co", ], - domains: ["image.tmdb.org", "lh3.googleusercontent.com"], service: passthroughImageService(), }, experimental: { diff --git a/package.json b/package.json index 1d85ba3..27656ba 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,6 @@ "@astrojs/tailwind": "^5.1.0", "@astrojs/vercel": "^7.7.2", "@auth/core": "^0.32.0", - "@nanostores/react": "^0.7.2", "@supabase/supabase-js": "^2.44.3", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", @@ -24,11 +23,11 @@ "auth-astro": "^4.1.2", "date-fns": "^3.6.0", "framer-motion": "^11.2.14", - "nanostores": "^0.10.3", "react": "^18.3.1", "react-dom": "^18.3.1", "react-hot-toast": "^2.4.1", "react-icons": "^5.2.1", + "react-responsive-carousel": "^3.2.23", "sharp": "^0.33.4", "tailwindcss": "^3.4.4", "typescript": "^5.5.3" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ebd7d77..c0edb62 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,9 +23,6 @@ dependencies: '@auth/core': specifier: ^0.32.0 version: 0.32.0 - '@nanostores/react': - specifier: ^0.7.2 - version: 0.7.2(nanostores@0.10.3)(react@18.3.1) '@supabase/supabase-js': specifier: ^2.44.3 version: 2.44.3 @@ -47,9 +44,6 @@ dependencies: framer-motion: specifier: ^11.2.14 version: 11.2.14(react-dom@18.3.1)(react@18.3.1) - nanostores: - specifier: ^0.10.3 - version: 0.10.3 react: specifier: ^18.3.1 version: 18.3.1 @@ -62,6 +56,9 @@ dependencies: react-icons: specifier: ^5.2.1 version: 5.2.1(react@18.3.1) + react-responsive-carousel: + specifier: ^3.2.23 + version: 3.2.23 sharp: specifier: ^0.33.4 version: 0.33.4 @@ -1052,17 +1049,6 @@ packages: - supports-color dev: false - /@nanostores/react@0.7.2(nanostores@0.10.3)(react@18.3.1): - resolution: {integrity: sha512-e3OhHJFv3NMSFYDgREdlAQqkyBTHJM91s31kOZ4OvZwJKdFk5BLk0MLbh51EOGUz9QGX2aCHfy1RvweSi7fgwA==} - engines: {node: ^18.0.0 || >=20.0.0} - peerDependencies: - nanostores: ^0.9.0 || ^0.10.0 - react: '>=18.0.0' - dependencies: - nanostores: 0.10.3 - react: 18.3.1 - dev: false - /@next/env@14.2.4: resolution: {integrity: sha512-3EtkY5VDkuV2+lNmKlbkibIJxcO4oIHEhBWne6PaAp+76J9KoSsGvNikp6ivzAT8dhhBMYrm6op2pS1ApG0Hzg==} dev: false @@ -2014,6 +2000,10 @@ packages: engines: {node: '>=8'} dev: false + /classnames@2.5.1: + resolution: {integrity: sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==} + dev: false + /cli-boxes@3.0.0: resolution: {integrity: sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g==} engines: {node: '>=10'} @@ -3484,11 +3474,6 @@ packages: hasBin: true dev: false - /nanostores@0.10.3: - resolution: {integrity: sha512-Nii8O1XqmawqSCf9o2aWqVxhKRN01+iue9/VEd1TiJCr9VT5XxgPFbF1Edl1XN6pwJcZRsl8Ki+z01yb/T/C2g==} - engines: {node: ^18.0.0 || >=20.0.0} - dev: false - /next-auth@4.24.7(next@14.2.4)(react-dom@18.3.1)(react@18.3.1): resolution: {integrity: sha512-iChjE8ov/1K/z98gdKbn2Jw+2vLgJtVV39X+rCP5SGnVQuco7QOr19FRNGMIrD8d3LYhHWV9j9sKLzq1aDWWQQ==} peerDependencies: @@ -3967,6 +3952,14 @@ packages: sisteransi: 1.0.5 dev: false + /prop-types@15.8.1: + resolution: {integrity: sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==} + dependencies: + loose-envify: 1.4.0 + object-assign: 4.1.1 + react-is: 16.13.1 + dev: false + /property-information@6.5.0: resolution: {integrity: sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig==} dev: false @@ -3985,6 +3978,13 @@ packages: scheduler: 0.23.2 dev: false + /react-easy-swipe@0.0.21: + resolution: {integrity: sha512-OeR2jAxdoqUMHIn/nS9fgreI5hSpgGoL5ezdal4+oO7YSSgJR8ga+PkYGJrSrJ9MKlPcQjMQXnketrD7WNmNsg==} + engines: {node: '>= 6'} + dependencies: + prop-types: 15.8.1 + dev: false + /react-hot-toast@2.4.1(csstype@3.1.3)(react-dom@18.3.1)(react@18.3.1): resolution: {integrity: sha512-j8z+cQbWIM5LY37pR6uZR6D4LfseplqnuAO4co4u8917hBUvXlEqyP1ZzqVLcqoyUesZZv/ImreoCeHVDpE5pQ==} engines: {node: '>=10'} @@ -4007,11 +4007,23 @@ packages: react: 18.3.1 dev: false + /react-is@16.13.1: + resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==} + dev: false + /react-refresh@0.14.2: resolution: {integrity: sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA==} engines: {node: '>=0.10.0'} dev: false + /react-responsive-carousel@3.2.23: + resolution: {integrity: sha512-pqJLsBaKHWJhw/ItODgbVoziR2z4lpcJg+YwmRlSk4rKH32VE633mAtZZ9kDXjy4wFO+pgUZmDKPsPe1fPmHCg==} + dependencies: + classnames: 2.5.1 + prop-types: 15.8.1 + react-easy-swipe: 0.0.21 + dev: false + /react@18.3.1: resolution: {integrity: sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==} engines: {node: '>=0.10.0'} diff --git a/src/actions/index.ts b/src/actions/index.ts index 4a200b6..be4eeb0 100644 --- a/src/actions/index.ts +++ b/src/actions/index.ts @@ -2,8 +2,6 @@ import { supabase } from "@/lib/supabase/supabase"; import { defineAction, z } from "astro:actions"; import { getSession } from "auth-astro/server"; -// email, country, - export const server = { updateUser: defineAction({ accept: "form", @@ -69,11 +67,26 @@ export const server = { input: z.object({ id: z.string(), }), - async handler({ id }, context) { + async handler({ id }) { const { error } = await supabase.from("saved_list").delete().eq("id", id); if (error) return { success: false }; return { success: true }; }, }), + addComment: defineAction({ + accept: "json", + input: z.object({ + comment: z.string().min(10, { + message: "Comment must be at least 10 characters long", + }), + image: z.object({ + url: z.string().url(), + path: z.string(), + }), + }), + async handler(input, context) { + return { success: true }; + }, + }), }; diff --git a/src/components/AllTrending/Card.astro b/src/components/AllTrending/Card.astro new file mode 100644 index 0000000..84384e9 --- /dev/null +++ b/src/components/AllTrending/Card.astro @@ -0,0 +1,61 @@ +--- +import { Image } from "astro:assets"; +import { format } from "date-fns"; +import Link from "../ui/Link.astro"; + +type Props = AllTrending; + +const { + media_type, + id, + first_air_date, + original_name, + original_title, + release_date, + poster_path, +} = Astro.props; +--- + +
+ + { + poster_path === undefined || poster_path === null ? ( +
+ ) : ( + Poster + ) + } + +
+

+ {original_title || original_name} +

+

+ { + release_date + ? format( + release_date ? new Date(release_date) : new Date(), + "MMMM dd, yyyy" + ) + : format( + first_air_date ? new Date(first_air_date) : new Date(), + "MMMM dd, yyyy" + ) + } +

+
+ +
diff --git a/src/components/AllTrending/Homepage.astro b/src/components/AllTrending/Homepage.astro new file mode 100644 index 0000000..6c7fca4 --- /dev/null +++ b/src/components/AllTrending/Homepage.astro @@ -0,0 +1,25 @@ +--- +import Link from "../ui/Link.astro"; +import { getTrendingDatas } from "@/utils/data"; +import Card from "@/components/AllTrending/Card.astro"; +const type = "all"; +const time = "day"; + +const datas = await getTrendingDatas(type, time, 1); +--- + +
+
+
+

Trending All

+ See more +
+
+ {datas.results.map((data: AllTrending) => )} +
+
+
diff --git a/src/components/Movie/Card.astro b/src/components/Movie/Card.astro index 95058c9..36f047c 100644 --- a/src/components/Movie/Card.astro +++ b/src/components/Movie/Card.astro @@ -2,6 +2,7 @@ import type { Movie } from "@/types/movie"; import { Image } from "astro:assets"; import { format } from "date-fns"; +import Link from "@/components/ui/Link.astro"; type Props = Movie; const { original_title, id, poster_path, release_date } = Astro.props; @@ -11,7 +12,7 @@ const { original_title, id, poster_path, release_date } = Astro.props; class="w-full card flex flex-col h-full rounded-md" transition:name={`movie ${id} card`} > - + { poster_path === undefined || poster_path === null ? (
-
+