From ec4e7d01703532b774cd36aa3e7544628abd36e1 Mon Sep 17 00:00:00 2001 From: merto Date: Thu, 14 Sep 2023 00:47:10 +0300 Subject: [PATCH] - prettier & mobile-ux changes --- actions/auth.ts | 12 +- actions/order.ts | 1 - actions/search.ts | 30 ++-- app/about/page.tsx | 30 ++-- app/api/products/getAll/route.ts | 21 ++- app/api/products/getSingle/route.ts | 39 +++-- app/api/products/searchItem/route.ts | 19 ++- app/api/user/basket/route.ts | 135 ++++++++-------- app/article/[id]/page.tsx | 12 +- app/articles/loading.tsx | 15 -- app/articles/page.tsx | 30 ++-- app/auth/callback/route.ts | 42 ++--- app/auth/login/page.tsx | 18 +-- app/auth/signup/page.tsx | 16 +- app/checkout/page.tsx | 20 ++- app/global-error.tsx | 18 ++- app/layout.tsx | 37 +++-- app/not-found.tsx | 26 +++ app/page.tsx | 36 ++--- app/product/[id]/page.tsx | 80 +++++----- app/product/loading.tsx | 43 ++--- app/products/loading.tsx | 46 +++--- app/products/page.tsx | 67 ++++---- app/search/page.tsx | 4 +- app/services/page.tsx | 32 ++-- components/Brand/index.tsx | 22 ++- components/Buttons/FilterButton/index.tsx | 43 +++-- components/Buttons/HamburgerButton/index.tsx | 22 +++ components/Buttons/PageButton/index.tsx | 29 ++-- components/Buttons/PrimaryButton/index.tsx | 42 +++-- components/Cards/ArticleCard/index.tsx | 26 ++- components/Cards/BasketCard/index.tsx | 95 +++++++---- components/Cards/PeopleCard/index.tsx | 41 +++-- components/Cards/ProductCard/index.tsx | 27 +++- components/Cards/ResponsiveCard/index.tsx | 50 +++--- components/Cards/ServiceCard/index.tsx | 107 +++++++------ components/Cards/TestimonialCard/index.tsx | 62 ++++--- components/DropDowns/Filter/index.tsx | 27 ++-- components/DropDowns/Sort/index.tsx | 41 +++-- components/Footer/constants.ts | 151 +++++++++--------- components/Footer/index.tsx | 61 +++---- components/Forms/Inputs/Search/index.tsx | 40 +++-- components/Forms/LoginForm/index.tsx | 63 ++++---- components/Forms/SignupForm/index.tsx | 28 ++-- components/Header/constants.ts | 47 +++--- components/Header/index.tsx | 41 +++-- components/Header/user-actions/index.tsx | 53 +++--- components/Icons/Close.tsx | 9 ++ components/Loaders/Spinner/index.tsx | 20 ++- components/MobileMenu/index.tsx | 82 ++++++++++ components/Navs/HeaderNav/index.tsx | 33 ++-- containers/about-page/cta-section/index.tsx | 30 ++-- .../hero-section/hero-player/index.tsx | 7 +- containers/about-page/hero-section/index.tsx | 32 ++-- .../about-page/mission-section/constants.ts | 44 ++--- .../about-page/mission-section/index.tsx | 64 +++++--- .../about-page/team-section/constants.ts | 76 ++++----- containers/about-page/team-section/index.tsx | 13 +- .../articles-page/cta-section/index.tsx | 30 ++-- .../articles-page/daily-section/constants.ts | 60 +++---- .../articles-page/daily-section/index.tsx | 16 +- .../articles-hero-slide/style.module.scss | 16 +- .../articles-page/hero-section/index.tsx | 2 +- .../trending-section/constants.ts | 91 ++++++----- .../articles-page/trending-section/index.tsx | 68 +++++--- .../login-page/form-section/index.tsx | 62 ++++--- .../signup-page/form-section/index.tsx | 64 +++++--- .../checkout-page/form-section/index.tsx | 25 ++- .../form-section/items/index.tsx | 131 ++++++++------- .../articles-section/articles-slide/index.tsx | 62 ++++--- .../articles-slide/style.module.scss | 15 +- .../home-page/articles-section/constants.ts | 142 ++++++++-------- .../home-page/articles-section/index.tsx | 19 ++- containers/home-page/cta-section/index.tsx | 28 ++-- containers/home-page/hero-section/index.tsx | 26 +-- containers/home-page/info-section/index.tsx | 110 ++++++++----- .../popular-products-section/index.tsx | 6 +- .../popular-products-slide/index.tsx | 20 +-- .../home-page/services-section/constants.ts | 46 +++--- .../home-page/services-section/index.tsx | 56 ++++--- .../home-page/testimonial-section/index.tsx | 47 +++--- .../testimonial-slide/index.tsx | 54 +++---- .../product-page/item-section/constants.ts | 16 +- .../product-page/item-section/index.tsx | 21 ++- .../product-page/related-section/index.tsx | 20 ++- .../products-page/items-section/index.tsx | 64 +++++--- .../products-page/products-hero/index.tsx | 35 ++-- .../products-hero-slide/index.tsx | 54 +++---- .../products-page/search-section/index.tsx | 29 ++-- .../search-page/result-section/index.tsx | 47 +++--- .../search-page/search-section/index.tsx | 42 ++--- .../services-page/cards-section/index.tsx | 36 +++-- .../services-page/cta-section/index.tsx | 29 ++-- .../services-page/hero-section/index.tsx | 45 +++--- .../services-page/portfolio-section/index.tsx | 8 +- db/auth.ts | 18 +-- hooks/useQueryString.tsx | 6 +- libs/endpoints.ts | 23 ++- libs/fonts.ts | 50 +++--- middleware.ts | 21 ++- services/playerTimeFormatter.ts | 16 +- store/useLayoutStore.ts | 11 ++ store/useUserStore.ts | 15 +- types/Article.ts | 18 +-- types/Author.ts | 10 +- types/BasketItem.ts | 30 ++-- types/Filters.ts | 9 +- types/FooterNav.ts | 13 +- types/Services.ts | 13 +- types/TeamMember.ts | 12 +- types/User.ts | 10 +- 111 files changed, 2368 insertions(+), 1906 deletions(-) delete mode 100644 app/articles/loading.tsx create mode 100644 app/not-found.tsx create mode 100644 components/Buttons/HamburgerButton/index.tsx create mode 100644 components/Icons/Close.tsx create mode 100644 components/MobileMenu/index.tsx create mode 100644 store/useLayoutStore.ts diff --git a/actions/auth.ts b/actions/auth.ts index 2f3cd93..d345463 100644 --- a/actions/auth.ts +++ b/actions/auth.ts @@ -9,12 +9,12 @@ const getURL = () => { let url = process?.env?.NEXT_PUBLIC_SITE_URL ?? // Set this to your site URL in production env. process?.env?.NEXT_PUBLIC_VERCEL_URL ?? // Automatically set by Vercel. - 'http://localhost:3000/'; + "http://localhost:3000/"; // Make sure to include https:// when not localhost. - url = url.includes('http') ? url : `https://${url}`; + url = url.includes("http") ? url : `https://${url}`; // Make sure to including trailing /. - url = url.charAt(url.length - 1) === '/' ? url : `${url}/`; + url = url.charAt(url.length - 1) === "/" ? url : `${url}/`; return url; }; @@ -22,7 +22,7 @@ export const loginHandler = async (formData: FormData) => { const email = String(formData.get("email")); const password = String(formData.get("password")); const supabase = createRouteHandlerClient({ cookies }); - let user : TUser = null; + let user: TUser = null; try { const { data, error } = await supabase.auth.signInWithPassword({ email, @@ -68,7 +68,7 @@ export const signupHandler = async (formData: FormData) => { data: { displayName: String(name), email: String(email), - totalPrice:0 + totalPrice: 0, }, }); } @@ -77,7 +77,7 @@ export const signupHandler = async (formData: FormData) => { error: error, }; } catch (err) { - console.log(err, '2313213123') + console.log(err, "2313213123"); } finally { prisma.$disconnect(); } diff --git a/actions/order.ts b/actions/order.ts index 1dbecbe..b8a8c2c 100644 --- a/actions/order.ts +++ b/actions/order.ts @@ -3,7 +3,6 @@ import { prisma } from "@/db/client"; import { TUser } from "@/types/User"; - export const orderHandler = async (user: TUser) => { if (user && user.basket) { try { diff --git a/actions/search.ts b/actions/search.ts index 611e069..2845821 100644 --- a/actions/search.ts +++ b/actions/search.ts @@ -5,19 +5,19 @@ import { redirect } from "next/navigation"; import { NextResponse } from "next/server"; const getURL = () => { - let url = - process?.env?.NEXT_PUBLIC_SITE_URL ?? // Set this to your site URL in production env. - process?.env?.NEXT_PUBLIC_VERCEL_URL ?? // Automatically set by Vercel. - 'http://localhost:3000/'; - - // Make sure to include https:// when not localhost. - url = url.includes('http') ? url : `https://${url}`; - // Make sure to including trailing /. - url = url.charAt(url.length - 1) === '/' ? url : `${url}/`; - return url; - }; + let url = + process?.env?.NEXT_PUBLIC_SITE_URL ?? // Set this to your site URL in production env. + process?.env?.NEXT_PUBLIC_VERCEL_URL ?? // Automatically set by Vercel. + "http://localhost:3000/"; -export const searchHandler = async (formData:FormData) => { - const key = formData.get('searchKey') - return redirect(getURL()+'/search?search='+key) -} + // Make sure to include https:// when not localhost. + url = url.includes("http") ? url : `https://${url}`; + // Make sure to including trailing /. + url = url.charAt(url.length - 1) === "/" ? url : `${url}/`; + return url; +}; + +export const searchHandler = async (formData: FormData) => { + const key = formData.get("searchKey"); + return redirect(getURL() + "/search?search=" + key); +}; diff --git a/app/about/page.tsx b/app/about/page.tsx index 54bd28d..bea026f 100644 --- a/app/about/page.tsx +++ b/app/about/page.tsx @@ -1,22 +1,20 @@ -import AboutCtaSection from '@/containers/about-page/cta-section'; -import AboutHeroSection from '@/containers/about-page/hero-section'; -import AboutMissionSection from '@/containers/about-page/mission-section'; -import AboutTeamSection from '@/containers/about-page/team-section'; -import React, { FC } from 'react' +import AboutCtaSection from "@/containers/about-page/cta-section"; +import AboutHeroSection from "@/containers/about-page/hero-section"; +import AboutMissionSection from "@/containers/about-page/mission-section"; +import AboutTeamSection from "@/containers/about-page/team-section"; +import React, { FC } from "react"; -interface AboutProps { - -} +interface AboutProps {} -const About: FC = ({ }) => { +const About: FC = ({}) => { return (
- - - - + + + +
- ) -} + ); +}; -export default About; \ No newline at end of file +export default About; diff --git a/app/api/products/getAll/route.ts b/app/api/products/getAll/route.ts index 3c7cc31..d635f93 100644 --- a/app/api/products/getAll/route.ts +++ b/app/api/products/getAll/route.ts @@ -17,32 +17,31 @@ export async function GET(request: NextRequest) { } } export async function POST(request: NextRequest) { - const { page, perItems,sort } = await request.json(); + const { page, perItems, sort } = await request.json(); - const slicer = (itemsPerPage:number,products:any[]) => { + const slicer = (itemsPerPage: number, products: any[]) => { const startIndex = (page - 1) * itemsPerPage; const endIndex = startIndex + itemsPerPage; - + if (startIndex >= products.length) { // Return an empty array if the page is out of bounds return []; } - + // Slice the products array to get the products for the current page const pageProducts = products.slice(startIndex, endIndex); - + return pageProducts; - } + }; try { const products = await prisma.product.findMany(); - let sorted = products - if(sort==='pricelow'){ + let sorted = products; + if (sort === "pricelow") { sorted = products.sort((a, b) => a.price - b.price); - }else if(sort==='pricehigh'){ + } else if (sort === "pricehigh") { sorted = products.sort((a, b) => b.price - a.price); - } - const res = slicer(perItems,products) + const res = slicer(perItems, products); return NextResponse.json({ data: res, size: products.length }); } catch (err) { return NextResponse.error(); diff --git a/app/api/products/getSingle/route.ts b/app/api/products/getSingle/route.ts index acc21ed..7550e7f 100644 --- a/app/api/products/getSingle/route.ts +++ b/app/api/products/getSingle/route.ts @@ -1,27 +1,24 @@ -import { prisma } from '@/db/client' -import { NextResponse } from 'next/server' +import { prisma } from "@/db/client"; +import { NextResponse } from "next/server"; -import type { NextRequest } from 'next/server' +import type { NextRequest } from "next/server"; -export const dynamic = 'force-dynamic' +export const dynamic = "force-dynamic"; export async function POST(request: NextRequest) { - const {id} = await request.json() - try{ - - const product = await prisma.product.findUnique({ - where: { - id:Number(id) - } - }) - console.log(product, 'TARGET PRODUCT') - - return NextResponse.json({data:product}) - - }catch(err){ - return NextResponse.error() - }finally{ - prisma.$disconnect() - } + const { id } = await request.json(); + try { + const product = await prisma.product.findUnique({ + where: { + id: Number(id), + }, + }); + console.log(product, "TARGET PRODUCT"); + return NextResponse.json({ data: product }); + } catch (err) { + return NextResponse.error(); + } finally { + prisma.$disconnect(); + } } diff --git a/app/api/products/searchItem/route.ts b/app/api/products/searchItem/route.ts index d446521..32f65a5 100644 --- a/app/api/products/searchItem/route.ts +++ b/app/api/products/searchItem/route.ts @@ -7,18 +7,21 @@ export const dynamic = "force-dynamic"; export async function POST(request: NextRequest) { const { key } = await request.json(); - try { const products = await prisma.product.findMany(); - let result = [] - const searchValue : string = key.toLowerCase() - for(let product of products){ - if(Object.values(product).includes(searchValue.charAt(0).toUpperCase()+searchValue.slice(1))){ - result.push(product) - } + let result = []; + const searchValue: string = key.toLowerCase(); + for (let product of products) { + if ( + Object.values(product).includes( + searchValue.charAt(0).toUpperCase() + searchValue.slice(1) + ) + ) { + result.push(product); + } } - return NextResponse.json({ data: result}); + return NextResponse.json({ data: result }); } catch (err) { return NextResponse.error(); } finally { diff --git a/app/api/user/basket/route.ts b/app/api/user/basket/route.ts index cfa9082..22a8dfa 100644 --- a/app/api/user/basket/route.ts +++ b/app/api/user/basket/route.ts @@ -5,76 +5,75 @@ import type { NextRequest } from "next/server"; export const dynamic = "force-dynamic"; export async function POST(request: NextRequest) { - const { action,payload,user,item } = await request.json(); + const { action, payload, user, item } = await request.json(); - if(action==='add'){ - try{ - if(user){ - - const updatedUser = await prisma.user.update({ - where:{ - email:user.email - }, - data:{ - basket:[...user.basket,payload] - } - }) - - const result = await prisma.user.update({ - where:{ - email:user.email - }, - data:{ - totalPrice:Number(updatedUser.basket.reduce((acc,curr:any) => acc+curr.item.price,0)) - } - }) - return NextResponse.json({data:'added',result:result}) - } - }catch(err){ - console.log(err) - }finally{ - prisma.$disconnect() - } - - }else if(action==='remove'){ - - if(user){ - const newBasket = user.basket.filter((el:any) => el.id !== item.id) - const updatedUser = await prisma.user.update({ - where:{ - email:user.email - }, - data:{ - basket:newBasket - } - }) - const result = await prisma.user.update({ - where:{ - email:user.email - }, - data:{ - totalPrice:(updatedUser.totalPrice)-(item.item.price) - } - }) - return NextResponse.json({data:'added',result:result}) - } - return NextResponse.json({data:'removed'}) - }else if(action==='wipe'){ - - if(user){ + if (action === "add") { + try { + if (user) { + const updatedUser = await prisma.user.update({ + where: { + email: user.email, + }, + data: { + basket: [...user.basket, payload], + }, + }); const result = await prisma.user.update({ - where:{ - email:user.email - }, - data:{ - totalPrice:0, - basket:[] - } - }) - return NextResponse.json({data:'added',result:result}) + where: { + email: user.email, + }, + data: { + totalPrice: Number( + updatedUser.basket.reduce( + (acc, curr: any) => acc + curr.item.price, + 0 + ) + ), + }, + }); + return NextResponse.json({ data: "added", result: result }); + } + } catch (err) { + console.log(err); + } finally { + prisma.$disconnect(); } - return NextResponse.json({data:'removed'}) -} - + } else if (action === "remove") { + if (user) { + const newBasket = user.basket.filter((el: any) => el.id !== item.id); + const updatedUser = await prisma.user.update({ + where: { + email: user.email, + }, + data: { + basket: newBasket, + }, + }); + const result = await prisma.user.update({ + where: { + email: user.email, + }, + data: { + totalPrice: updatedUser.totalPrice - item.item.price, + }, + }); + return NextResponse.json({ data: "added", result: result }); + } + return NextResponse.json({ data: "removed" }); + } else if (action === "wipe") { + if (user) { + const result = await prisma.user.update({ + where: { + email: user.email, + }, + data: { + totalPrice: 0, + basket: [], + }, + }); + return NextResponse.json({ data: "added", result: result }); + } + return NextResponse.json({ data: "removed" }); + } } diff --git a/app/article/[id]/page.tsx b/app/article/[id]/page.tsx index 707c959..8e3b5e9 100644 --- a/app/article/[id]/page.tsx +++ b/app/article/[id]/page.tsx @@ -1,15 +1,15 @@ -import React, { FC } from 'react' +import React, { FC } from "react"; interface ArticlePageProps { - params:{ id: string } + params: { id: string }; } const ArticlePage: FC = ({ params }) => { return (
-

{`Article id:${params.id}`}

+

{`Article id:${params.id}`}

- ) -} + ); +}; -export default ArticlePage; \ No newline at end of file +export default ArticlePage; diff --git a/app/articles/loading.tsx b/app/articles/loading.tsx deleted file mode 100644 index c23acf6..0000000 --- a/app/articles/loading.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import React, { FC } from 'react' - -interface LoadingProps { - -} - -const Loading: FC = ({ }) => { - return ( -
- Loading -
- ) -} - -export default Loading; \ No newline at end of file diff --git a/app/articles/page.tsx b/app/articles/page.tsx index 9b4c206..40fed66 100644 --- a/app/articles/page.tsx +++ b/app/articles/page.tsx @@ -1,22 +1,20 @@ -import ArticlesCtaSection from '@/containers/articles-page/cta-section'; -import ArticlesDailySection from '@/containers/articles-page/daily-section'; -import ArticlesHeroSection from '@/containers/articles-page/hero-section'; -import ArticlesTrendingSection from '@/containers/articles-page/trending-section'; -import React, { FC } from 'react' +import ArticlesCtaSection from "@/containers/articles-page/cta-section"; +import ArticlesDailySection from "@/containers/articles-page/daily-section"; +import ArticlesHeroSection from "@/containers/articles-page/hero-section"; +import ArticlesTrendingSection from "@/containers/articles-page/trending-section"; +import React, { FC } from "react"; -interface ArticleProps { - -} +interface ArticleProps {} -const Article: FC = ({ }) => { +const Article: FC = ({}) => { return (
- - - - + + + +
- ) -} + ); +}; -export default Article; \ No newline at end of file +export default Article; diff --git a/app/auth/callback/route.ts b/app/auth/callback/route.ts index be088a9..a3ff52b 100644 --- a/app/auth/callback/route.ts +++ b/app/auth/callback/route.ts @@ -1,35 +1,35 @@ -import { PrismaClient } from '@prisma/client' -import { createRouteHandlerClient } from '@supabase/auth-helpers-nextjs' -import { cookies } from 'next/headers' -import { NextResponse } from 'next/server' +import { PrismaClient } from "@prisma/client"; +import { createRouteHandlerClient } from "@supabase/auth-helpers-nextjs"; +import { cookies } from "next/headers"; +import { NextResponse } from "next/server"; -import type { NextRequest } from 'next/server' +import type { NextRequest } from "next/server"; -export const dynamic = 'force-dynamic' +export const dynamic = "force-dynamic"; export async function GET(request: NextRequest) { - const requestUrl = new URL(request.url) - const code = requestUrl.searchParams.get('code') - const prisma = new PrismaClient() + const requestUrl = new URL(request.url); + const code = requestUrl.searchParams.get("code"); + const prisma = new PrismaClient(); if (code) { - const supabase = createRouteHandlerClient ({ cookies }) - const {data} = await supabase.auth.exchangeCodeForSession(code) - console.log(data.session?.user, 'USER DATA IS HEREEEEEEE!!!!!!') - try{ + const supabase = createRouteHandlerClient({ cookies }); + const { data } = await supabase.auth.exchangeCodeForSession(code); + console.log(data.session?.user, "USER DATA IS HEREEEEEEE!!!!!!"); + try { await prisma.user.create({ data: { - displayName: data.session?.user.user_metadata.full_name ?? 'Merto', + displayName: data.session?.user.user_metadata.full_name ?? "Merto", email: String(data.session?.user.email), - totalPrice:0 + totalPrice: 0, }, }); - }catch(err){ - console.log(err, "OOOPPPSS BACKEND ERROR HERE !!!") - }finally{ - prisma.$disconnect() + } catch (err) { + console.log(err, "OOOPPPSS BACKEND ERROR HERE !!!"); + } finally { + prisma.$disconnect(); } } // URL to redirect to after sign in process completes - return NextResponse.redirect(requestUrl.origin) -} \ No newline at end of file + return NextResponse.redirect(requestUrl.origin); +} diff --git a/app/auth/login/page.tsx b/app/auth/login/page.tsx index ce24675..87d5711 100644 --- a/app/auth/login/page.tsx +++ b/app/auth/login/page.tsx @@ -1,17 +1,15 @@ -import LoginFormSection from '@/containers/auth-page/login-page/form-section'; -import AuthFormSection from '@/containers/auth-page/login-page/form-section'; -import React, { FC } from 'react' +import LoginFormSection from "@/containers/auth-page/login-page/form-section"; +import AuthFormSection from "@/containers/auth-page/login-page/form-section"; +import React, { FC } from "react"; -interface LoginPageProps { - -} +interface LoginPageProps {} -const LoginPage: FC = ({ }) => { +const LoginPage: FC = ({}) => { return (
- ) -} + ); +}; -export default LoginPage; \ No newline at end of file +export default LoginPage; diff --git a/app/auth/signup/page.tsx b/app/auth/signup/page.tsx index a345d65..69a28d4 100644 --- a/app/auth/signup/page.tsx +++ b/app/auth/signup/page.tsx @@ -1,16 +1,14 @@ -import SignupFormSection from '@/containers/auth-page/signup-page/form-section'; -import React, { FC } from 'react' +import SignupFormSection from "@/containers/auth-page/signup-page/form-section"; +import React, { FC } from "react"; -interface SignupPageProps { - -} +interface SignupPageProps {} -const SignupPage: FC = ({ }) => { +const SignupPage: FC = ({}) => { return (
- ) -} + ); +}; -export default SignupPage; \ No newline at end of file +export default SignupPage; diff --git a/app/checkout/page.tsx b/app/checkout/page.tsx index 0e3ce40..91ea4c5 100644 --- a/app/checkout/page.tsx +++ b/app/checkout/page.tsx @@ -1,16 +1,14 @@ -import CheckoutFormSection from '@/containers/checkout-page/form-section'; -import React, { FC } from 'react' +import CheckoutFormSection from "@/containers/checkout-page/form-section"; +import React, { FC } from "react"; -interface CheckoutProps { - -} +interface CheckoutProps {} -const Checkout: FC = ({ }) => { +const Checkout: FC = ({}) => { return ( -
- +
+
- ) -} + ); +}; -export default Checkout; \ No newline at end of file +export default Checkout; diff --git a/app/global-error.tsx b/app/global-error.tsx index d6bca32..7a099a2 100644 --- a/app/global-error.tsx +++ b/app/global-error.tsx @@ -1,15 +1,14 @@ -'use client' +"use client"; import PrimaryButton from "@/components/Buttons/PrimaryButton"; import { useRouter } from "next/router"; - export default function GlobalError({ error, reset, }: { - error: Error & { digest?: string } - reset: () => void + error: Error & { digest?: string }; + reset: () => void; }) { const router = useRouter(); @@ -17,9 +16,12 @@ export default function GlobalError({

Something went wrong!

- reset()} text="Try Again"/> - router.push('/')} text="Back to Home Page" /> + reset()} text="Try Again" /> + router.push("/")} + text="Back to Home Page" + /> - ) -} \ No newline at end of file + ); +} diff --git a/app/layout.tsx b/app/layout.tsx index 6f00de1..d8230ef 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,36 +1,39 @@ -import { eudox } from '@/libs/fonts' -import '@/styles/global.css' -import type { Metadata } from 'next' -import Header from '@/components/Header' -import Footer from '@/components/Footer' -import { ToastContainer } from 'react-toastify'; -import 'react-toastify/dist/ReactToastify.css'; -import createClient from '@/db/client' +import { eudox } from "@/libs/fonts"; +import "@/styles/global.css"; +import type { Metadata } from "next"; +import Header from "@/components/Header"; +import Footer from "@/components/Footer"; +import { ToastContainer } from "react-toastify"; +import "react-toastify/dist/ReactToastify.css"; +import createClient from "@/db/client"; +import MobileMenu from "@/components/MobileMenu"; export const metadata: Metadata = { - title: 'Lalasia', - description: 'Generated by create next app', -} + title: "Lalasia", + description: "Generated by create next app", +}; export const revalidate = 0; export default async function RootLayout({ children, }: { - children: React.ReactNode + children: React.ReactNode; }) { + const supabase = createClient(); - const supabase = createClient() + const { + data: { user }, + } = await supabase.auth.getUser(); - const {data:{user}} = await supabase.auth.getUser() - return ( -
+
{children}
+ - ) + ); } diff --git a/app/not-found.tsx b/app/not-found.tsx new file mode 100644 index 0000000..09fac57 --- /dev/null +++ b/app/not-found.tsx @@ -0,0 +1,26 @@ +"use client"; +import PrimaryButton from "@/components/Buttons/PrimaryButton"; +import Link from "next/link"; +import { redirect, useRouter } from "next/navigation"; + +export default function NotFound() { + const router = useRouter(); + return ( +
+
+
+

+ Opps.. Looks like you have been lost. +

+

+ 4 0 4 +

+ router.push("/")} + text="Home Page" + > +
+
+
+ ); +} diff --git a/app/page.tsx b/app/page.tsx index 23d8afb..ef2a163 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,21 +1,21 @@ -import ArticlesSection from '@/containers/home-page/articles-section' -import CtaSection from '@/containers/home-page/cta-section' -import HeroSection from '@/containers/home-page/hero-section' -import InfoSection from '@/containers/home-page/info-section' -import PopularProducts from '@/containers/home-page/popular-products-section' -import ServicesSection from '@/containers/home-page/services-section' -import TestimonialSection from '@/containers/home-page/testimonial-section' -import { getAll } from '@/libs/endpoints' -import axios from 'axios' +import ArticlesSection from "@/containers/home-page/articles-section"; +import CtaSection from "@/containers/home-page/cta-section"; +import HeroSection from "@/containers/home-page/hero-section"; +import InfoSection from "@/containers/home-page/info-section"; +import PopularProducts from "@/containers/home-page/popular-products-section"; +import ServicesSection from "@/containers/home-page/services-section"; +import TestimonialSection from "@/containers/home-page/testimonial-section"; +import { getAll } from "@/libs/endpoints"; +import axios from "axios"; -const getItems = async() => { - const data = await axios(getAll) - return data.data -} +const getItems = async () => { + const data = await axios(getAll); + return data.data; +}; export default async function Home() { - const items = await getItems() - + const items = await getItems(); + return (
@@ -24,7 +24,7 @@ export default async function Home() { - -
- ) + +
+ ); } diff --git a/app/product/[id]/page.tsx b/app/product/[id]/page.tsx index 82b771d..f5dd55e 100644 --- a/app/product/[id]/page.tsx +++ b/app/product/[id]/page.tsx @@ -1,53 +1,53 @@ -import React, { FC, Suspense } from 'react' -import type { Metadata } from 'next' -import ItemSection from '@/containers/product-page/item-section' -import RelatedSection from '@/containers/product-page/related-section' -import axios from 'axios' -import { getSingle } from '@/libs/endpoints' -import { notFound } from 'next/navigation' +import React, { FC, Suspense } from "react"; +import type { Metadata } from "next"; +import ItemSection from "@/containers/product-page/item-section"; +import RelatedSection from "@/containers/product-page/related-section"; +import axios from "axios"; +import { getSingle } from "@/libs/endpoints"; +import { notFound } from "next/navigation"; interface ProductProps { - params: { id: string } - searchParams: { [key: string]: string | string[] | undefined } + params: { id: string }; + searchParams: { [key: string]: string | string[] | undefined }; } -export async function generateMetadata( - { params, searchParams }: ProductProps, - ): Promise { - // read route params - const id = params.id - - // fetch data - const product = await axios.post(getSingle,{id:id}) - // optionally access and extend (rather than replace) parent metadata - //const previousImages = (await parent).openGraph?.images || [] - return { - //title: await product, - title:product?.data?.data?.name, - description:product?.data?.data?.title, - openGraph:{ - images:[product?.data?.data?.imgUrl] - } +export async function generateMetadata({ + params, + searchParams, +}: ProductProps): Promise { + // read route params + const id = params.id; - } - } + // fetch data + const product = await axios.post(getSingle, { id: id }); + // optionally access and extend (rather than replace) parent metadata + //const previousImages = (await parent).openGraph?.images || [] + return { + //title: await product, + title: product?.data?.data?.name, + description: product?.data?.data?.title, + openGraph: { + images: [product?.data?.data?.imgUrl], + }, + }; +} - const getSingleProduct = async(id:string) => { - const product = await axios.post(getSingle,{id}) - return product.data - } -const Product: FC = async({ params }) => { - const product = await getSingleProduct(params.id) - if(!product.data){ - notFound() +const getSingleProduct = async (id: string) => { + const product = await axios.post(getSingle, { id }); + return product.data; +}; +const Product: FC = async ({ params }) => { + const product = await getSingleProduct(params.id); + if (!product.data) { + notFound(); } return (
- +
- ) -} + ); +}; -export default Product; \ No newline at end of file +export default Product; diff --git a/app/product/loading.tsx b/app/product/loading.tsx index d2d3426..345fe7c 100644 --- a/app/product/loading.tsx +++ b/app/product/loading.tsx @@ -1,27 +1,30 @@ -import React, { FC } from 'react' +import React, { FC } from "react"; -interface ProductLoadingProps { - -} +interface ProductLoadingProps {} -const ProductLoading: FC = ({ }) => { +const ProductLoading: FC = ({}) => { return (
-
-
-
-
- {Array(4).fill(0).map((el,_i) => ( -
-
-
-
+
+
+
+
+ {Array(4) + .fill(0) + .map((el, _i) => ( +
+
+
+
+
+ ))}
- ))} -
-
- ) -} + + ); +}; -export default ProductLoading; \ No newline at end of file +export default ProductLoading; diff --git a/app/products/loading.tsx b/app/products/loading.tsx index f4ddff7..e1a13c6 100644 --- a/app/products/loading.tsx +++ b/app/products/loading.tsx @@ -1,30 +1,30 @@ +import React, { FC } from "react"; +interface LoadingProps {} - -import React, { FC } from 'react' - -interface LoadingProps { - -} - -const Loading: FC = ({ }) => { +const Loading: FC = ({}) => { return (
-
-
-
-
- {Array(4).fill(0).map((el,_i) => ( -
-
-
-
-
- ))} +
+
+
+
+ {Array(4) + .fill(0) + .map((el, _i) => ( +
+
+
+
+
+ ))}
-
+
- ) -} + ); +}; -export default Loading; \ No newline at end of file +export default Loading; diff --git a/app/products/page.tsx b/app/products/page.tsx index caed2f2..8a45c1d 100644 --- a/app/products/page.tsx +++ b/app/products/page.tsx @@ -1,46 +1,55 @@ -import ProductsHero from '@/containers/products-page/products-hero'; -import ProductsSearch from '@/containers/products-page/search-section'; -import React, { FC } from 'react' -import axios from 'axios'; -import { getAll } from '@/libs/endpoints'; -import ProductsItems from '@/containers/products-page/items-section'; - - +import ProductsHero from "@/containers/products-page/products-hero"; +import ProductsSearch from "@/containers/products-page/search-section"; +import React, { FC } from "react"; +import axios from "axios"; +import { getAll } from "@/libs/endpoints"; +import ProductsItems from "@/containers/products-page/items-section"; interface ProductsProps { - searchParams: { [key: string]: string | string[] | undefined } -} -const getItems = async(page:number,perItem:number,sort:string|boolean) => { - - const { data } = await axios.post(getAll,{page:page,perItems:perItem,sort:sort}) - return data - + searchParams: { [key: string]: string | string[] | undefined }; } +const getItems = async ( + page: number, + perItem: number, + sort: string | boolean +) => { + const { data } = await axios.post(getAll, { + page: page, + perItems: perItem, + sort: sort, + }); + return data; +}; -const loader = async() => { +const loader = async () => { const data = await new Promise((resolve, reject) => { setTimeout(() => { resolve("Promise resolved after 2 seconds"); }, 2000); // 2000 milliseconds = 2 seconds }); - return data -} -const Products: FC = async({ searchParams }) => { - - const page = typeof searchParams.page === 'string' ? Number(searchParams.page) : 1 - const sort = typeof searchParams.sort === 'string' ? searchParams.sort : false + return data; +}; +const Products: FC = async ({ searchParams }) => { + const page = + typeof searchParams.page === "string" ? Number(searchParams.page) : 1; + const sort = + typeof searchParams.sort === "string" ? searchParams.sort : false; const itemPerView = 6; - const items = await getItems(page,itemPerView,sort) + const items = await getItems(page, itemPerView, sort); // Fake Loader // const loading = await loader() return (
- - - + + +
- ) -} + ); +}; -export default Products; \ No newline at end of file +export default Products; diff --git a/app/search/page.tsx b/app/search/page.tsx index 614636a..84b6627 100644 --- a/app/search/page.tsx +++ b/app/search/page.tsx @@ -13,8 +13,8 @@ const getResults = async (searchValue: string | boolean) => { }; const SearchPage: FC = async ({ searchParams }) => { if (searchParams.search) { - console.log(searchParams.search) - const {data} = await getResults(String(searchParams.search)); + console.log(searchParams.search); + const { data } = await getResults(String(searchParams.search)); return (
diff --git a/app/services/page.tsx b/app/services/page.tsx index cab039a..585cc40 100644 --- a/app/services/page.tsx +++ b/app/services/page.tsx @@ -1,22 +1,20 @@ -import ServicesCards from '@/containers/services-page/cards-section'; -import ServicesCta from '@/containers/services-page/cta-section'; -import ServicesHero from '@/containers/services-page/hero-section'; -import ServicesPortfolio from '@/containers/services-page/portfolio-section'; -import React, { FC } from 'react' +import ServicesCards from "@/containers/services-page/cards-section"; +import ServicesCta from "@/containers/services-page/cta-section"; +import ServicesHero from "@/containers/services-page/hero-section"; +import ServicesPortfolio from "@/containers/services-page/portfolio-section"; +import React, { FC } from "react"; -interface ServicesProps { - -} +interface ServicesProps {} -const Services: FC = ({ }) => { +const Services: FC = ({}) => { return (
- - - - -
- ) -} + + + + +
+ ); +}; -export default Services; \ No newline at end of file +export default Services; diff --git a/components/Brand/index.tsx b/components/Brand/index.tsx index 3285e19..1f905ee 100644 --- a/components/Brand/index.tsx +++ b/components/Brand/index.tsx @@ -1,17 +1,15 @@ -import React, { FC } from 'react' -import { Logo } from '../Icons/Logo'; +import React, { FC } from "react"; +import { Logo } from "../Icons/Logo"; -interface BrandProps { - -} +interface BrandProps {} -const Brand: FC = ({ }) => { +const Brand: FC = ({}) => { return ( -
- -

Lalasia

+
+ +

Lalasia

- ) -} + ); +}; -export default Brand; \ No newline at end of file +export default Brand; diff --git a/components/Buttons/FilterButton/index.tsx b/components/Buttons/FilterButton/index.tsx index d2de629..e26a2ef 100644 --- a/components/Buttons/FilterButton/index.tsx +++ b/components/Buttons/FilterButton/index.tsx @@ -1,21 +1,34 @@ -"use client" -import React, { FC } from 'react' +"use client"; +import React, { FC } from "react"; interface FilterButtonProps { - text:string - activeFilter:string - onClick: () => void + text: string; + activeFilter: string; + onClick: () => void; } -const FilterButton: FC = ({ text,activeFilter, onClick }) => { - const isActive = () => { - return activeFilter.toLocaleLowerCase() === text.toLowerCase() - } - - // I can use component for this one. And may create URL with searchParams to initialize filtering fc. +const FilterButton: FC = ({ + text, + activeFilter, + onClick, +}) => { + const isActive = () => { + return activeFilter.toLocaleLowerCase() === text.toLowerCase(); + }; + + // I can use component for this one. And may create URL with searchParams to initialize filtering fc. return ( - - ) -} + + ); +}; -export default FilterButton; \ No newline at end of file +export default FilterButton; diff --git a/components/Buttons/HamburgerButton/index.tsx b/components/Buttons/HamburgerButton/index.tsx new file mode 100644 index 0000000..1eb7d8a --- /dev/null +++ b/components/Buttons/HamburgerButton/index.tsx @@ -0,0 +1,22 @@ +"use client"; + +import { CloseIcon } from "@/components/Icons/Close"; +import { HamburgerIcon } from "@/components/Icons/HamburgerIcon"; +import { useLayoutStore } from "@/store/useLayoutStore"; +import React, { FC } from "react"; + +interface HamburgerButtonProps {} + +const HamburgerButton: FC = ({}) => { + const { mobileOpen, handleMobileOpen } = useLayoutStore(); + return ( +
handleMobileOpen(!mobileOpen)} + > + {mobileOpen ? : } +
+ ); +}; + +export default HamburgerButton; diff --git a/components/Buttons/PageButton/index.tsx b/components/Buttons/PageButton/index.tsx index 0d47384..87337f2 100644 --- a/components/Buttons/PageButton/index.tsx +++ b/components/Buttons/PageButton/index.tsx @@ -1,17 +1,28 @@ -import React, { FC } from 'react' +import React, { FC } from "react"; interface PageButtonProps { - currentPage:number, - value:number, - onClick: () => void + currentPage: number; + value: number; + onClick: () => void; } const PageButton: FC = ({ currentPage, value, onClick }) => { return ( - - ) -} + ); +}; -export default PageButton; \ No newline at end of file +export default PageButton; diff --git a/components/Buttons/PrimaryButton/index.tsx b/components/Buttons/PrimaryButton/index.tsx index a79fe06..b350a2d 100644 --- a/components/Buttons/PrimaryButton/index.tsx +++ b/components/Buttons/PrimaryButton/index.tsx @@ -1,23 +1,31 @@ -"use client" -import Spinner from '@/components/Loaders/Spinner' -import React, { FC } from 'react' -import { experimental_useFormStatus as useFormStatus } from 'react-dom' +"use client"; +import Spinner from "@/components/Loaders/Spinner"; +import React, { FC } from "react"; +import { experimental_useFormStatus as useFormStatus } from "react-dom"; interface PrimaryButtonProps { - text:string - className?:string - type?:'button'|'submit'|'reset' - onClick?:() => void + text: string; + className?: string; + type?: "button" | "submit" | "reset"; + onClick?: () => void; } -const PrimaryButton: FC = ({ text,className, type, onClick }) => { - const { pending } = useFormStatus() +const PrimaryButton: FC = ({ + text, + className, + type, + onClick, +}) => { + const { pending } = useFormStatus(); return ( - - ) - -} + + ); +}; -export default PrimaryButton; \ No newline at end of file +export default PrimaryButton; diff --git a/components/Cards/ArticleCard/index.tsx b/components/Cards/ArticleCard/index.tsx index 0ce567a..ab9b318 100644 --- a/components/Cards/ArticleCard/index.tsx +++ b/components/Cards/ArticleCard/index.tsx @@ -8,13 +8,13 @@ interface ArticleCardProps { responsive?: boolean; secondary?: boolean; - id:number, - category:string, - imgUrl:string - title:string, - content:string, - author:AuthorType - date:Date + id: number; + category: string; + imgUrl: string; + title: string; + content: string; + author: AuthorType; + date: Date; } const ArticleCard: FC = ({ @@ -27,7 +27,7 @@ const ArticleCard: FC = ({ author, date, category, - imgUrl + imgUrl, }) => { if (secondary) { return ( @@ -107,9 +107,7 @@ const ArticleCard: FC = ({
-

- {content} -

+

{content}

@@ -150,13 +148,11 @@ const ArticleCard: FC = ({

{category}

-

- {title} -

+

{title}

- {content} + {content}

diff --git a/components/Cards/BasketCard/index.tsx b/components/Cards/BasketCard/index.tsx index a54b327..fbd0cb9 100644 --- a/components/Cards/BasketCard/index.tsx +++ b/components/Cards/BasketCard/index.tsx @@ -1,47 +1,72 @@ -"use client" -import PrimaryButton from '@/components/Buttons/PrimaryButton'; -import { colors } from '@/containers/product-page/item-section/constants'; -import { postBasket } from '@/libs/endpoints'; -import { useUserStore } from '@/store/useUserStore'; -import { TBasketItem } from '@/types/BasketItem'; -import axios from 'axios'; -import Image from 'next/image'; -import React, { FC } from 'react' +"use client"; +import PrimaryButton from "@/components/Buttons/PrimaryButton"; +import { colors } from "@/containers/product-page/item-section/constants"; +import { postBasket } from "@/libs/endpoints"; +import { useUserStore } from "@/store/useUserStore"; +import { TBasketItem } from "@/types/BasketItem"; +import axios from "axios"; +import Image from "next/image"; +import React, { FC } from "react"; interface BasketCardProps { - item:TBasketItem + item: TBasketItem; } const BasketCard: FC = ({ item }) => { - const {item:itemInfo} = item; - const {user, handleUser} = useUserStore() + const { item: itemInfo } = item; + const { user, handleUser } = useUserStore(); - const removeBasketItem = async(item:any) => { - const {data} = await axios.post(postBasket,{action:'remove',user:user,item:item}) - if(data){ - handleUser(data.result) - } - } + const removeBasketItem = async (item: any) => { + const { data } = await axios.post(postBasket, { + action: "remove", + user: user, + item: item, + }); + if (data) { + handleUser(data.result); + } + }; return ( -
+
+
+ Lalasia basket item +
+
+
+

+ {itemInfo.name} +

+ + {item.color} + +
- Lalasia basket item +

+ {itemInfo.description} +

-
-
-

{itemInfo.name}

- {item.color} -
-
-

{itemInfo.description}

-
-
- ${itemInfo.price} - removeBasketItem(item)} className='!bg-red-400 !h-max !w-max !py-1 !px-2' text='Remove'/> -
+
+ + ${itemInfo.price} + + removeBasketItem(item)} + className="!bg-red-400 !h-max !w-max !py-1 !px-2" + text="Remove" + />
+
- ) -} + ); +}; -export default BasketCard; \ No newline at end of file +export default BasketCard; diff --git a/components/Cards/PeopleCard/index.tsx b/components/Cards/PeopleCard/index.tsx index 6dba522..32f1b8c 100644 --- a/components/Cards/PeopleCard/index.tsx +++ b/components/Cards/PeopleCard/index.tsx @@ -1,25 +1,32 @@ -import Image from 'next/image'; -import React, { FC } from 'react' +import Image from "next/image"; +import React, { FC } from "react"; interface PeopleCardProps { - id:number - imgUrl:string, - name:string, - title:string + id: number; + imgUrl: string; + name: string; + title: string; } const PeopleCard: FC = ({ imgUrl, name, title }) => { return ( -
-
- lalasia member -
-
-

{name}

- {title} -
+
+
+ lalasia member +
+
+

{name}

+ + {title} + +
- ) -} + ); +}; -export default PeopleCard; \ No newline at end of file +export default PeopleCard; diff --git a/components/Cards/ProductCard/index.tsx b/components/Cards/ProductCard/index.tsx index b8604f0..2c873ef 100644 --- a/components/Cards/ProductCard/index.tsx +++ b/components/Cards/ProductCard/index.tsx @@ -4,24 +4,39 @@ import Link from "next/link"; import React, { FC } from "react"; interface ProductCardProps { - item:TProduct + item: TProduct; } -const ProductCard: FC = ({item}) => { +const ProductCard: FC = ({ item }) => { return (
- Product IMG + Product IMG
-

{item.category}

+

+ {item.category} +

- {item.name} + + {item.name} +

{item.title}

- ${item.price} + + ${item.price} +
); diff --git a/components/Cards/ResponsiveCard/index.tsx b/components/Cards/ResponsiveCard/index.tsx index fdd3bb6..071aebe 100644 --- a/components/Cards/ResponsiveCard/index.tsx +++ b/components/Cards/ResponsiveCard/index.tsx @@ -1,26 +1,36 @@ -import Image from 'next/image'; -import React, { FC } from 'react' +import Image from "next/image"; +import React, { FC } from "react"; -interface ResponsiveCardProps { - -} +interface ResponsiveCardProps {} -const ResponsiveCard: FC = ({ }) => { +const ResponsiveCard: FC = ({}) => { return ( -
- Lalasia -
-
-
-
-

Siska Kohl's Bedroom

-

We start renovating her bedroom with minimalist concept and using combination white and wooden material

-
-
-

See Detail

+
+ Lalasia +
+
+
+
+

+ Siska Kohl's Bedroom +

+

+ We start renovating her bedroom with minimalist concept and using + combination white and wooden material +

+
+

+ See Detail +

+
- ) -} + ); +}; -export default ResponsiveCard; \ No newline at end of file +export default ResponsiveCard; diff --git a/components/Cards/ServiceCard/index.tsx b/components/Cards/ServiceCard/index.tsx index c568d49..8f9e05d 100644 --- a/components/Cards/ServiceCard/index.tsx +++ b/components/Cards/ServiceCard/index.tsx @@ -1,59 +1,70 @@ -import React, { FC } from 'react' +import React, { FC } from "react"; interface ServiceCardProps { - id:number, - title:string, - content:string, - icon?:JSX.Element - numeric?:boolean - horizontal?:boolean - + id: number; + title: string; + content: string; + icon?: JSX.Element; + numeric?: boolean; + horizontal?: boolean; } -const ServiceCard: FC = ({ title, content, icon, numeric, id, horizontal }) => { - if(horizontal){ - return( -
-
- {icon? -
- {icon} -
- : - {String(id).padStart(2, '0')} - } +const ServiceCard: FC = ({ + title, + content, + icon, + numeric, + id, + horizontal, +}) => { + if (horizontal) { + return ( +
+
+ {icon ? ( +
+ {icon} +
+ ) : ( + + {String(id).padStart(2, "0")} + + )} +
+
+
+

+ {title} +

+
+
+

{content}

+
+
-
- + ); + } + return ( +
-

{title}

+ {icon ? ( +
+ {icon} +
+ ) : ( + + {String(id).padStart(2, "0")} + + )}
-
-

{content}

+
+

{title}

-
+
+

{content}

- ) - } - return ( -
-
- {icon? -
- {icon} -
- : - {String(id).padStart(2, '0')} - } -
-
-

{title}

-
-
-

{content}

-
- ) -} + ); +}; -export default ServiceCard; \ No newline at end of file +export default ServiceCard; diff --git a/components/Cards/TestimonialCard/index.tsx b/components/Cards/TestimonialCard/index.tsx index d580262..5004195 100644 --- a/components/Cards/TestimonialCard/index.tsx +++ b/components/Cards/TestimonialCard/index.tsx @@ -1,33 +1,43 @@ -import { Quote } from '@/components/Icons/Quote'; -import { RateStar } from '@/components/Icons/RateStar'; -import Image from 'next/image'; -import React, { FC } from 'react' +import { Quote } from "@/components/Icons/Quote"; +import { RateStar } from "@/components/Icons/RateStar"; +import Image from "next/image"; +import React, { FC } from "react"; -interface TestimonialCardProps { - -} +interface TestimonialCardProps {} -const TestimonialCard: FC = ({ }) => { +const TestimonialCard: FC = ({}) => { return ( -
-
- +
+
+ +
+
+

+ Pellentesque etiam blandit in tincidunt at donec. Eget ipsum dignissim + placerat nisi, adipiscing mauris non. +

+
+
+
+ Author +

+ Janne Cooper +

-
-

Pellentesque etiam blandit in tincidunt at donec. Eget ipsum dignissim placerat nisi, adipiscing mauris non.

-
-
-
- Author -

Janne Cooper

-
-
- - 4.3 -
+
+ + 4.3
+
- ) -} + ); +}; -export default TestimonialCard; \ No newline at end of file +export default TestimonialCard; diff --git a/components/DropDowns/Filter/index.tsx b/components/DropDowns/Filter/index.tsx index 79d3ef3..3e703f8 100644 --- a/components/DropDowns/Filter/index.tsx +++ b/components/DropDowns/Filter/index.tsx @@ -1,22 +1,17 @@ +import { Filter } from "@/components/Icons/Filter"; +import React, { FC } from "react"; +interface FilterDropdownProps {} - -import { Filter } from '@/components/Icons/Filter'; -import React, { FC } from 'react' - -interface FilterDropdownProps { - -} - -const FilterDropdown: FC = ({ }) => { +const FilterDropdown: FC = ({}) => { return ( -
-
+
+
- Filter -
+ Filter +
- ) -} + ); +}; -export default FilterDropdown; \ No newline at end of file +export default FilterDropdown; diff --git a/components/DropDowns/Sort/index.tsx b/components/DropDowns/Sort/index.tsx index bb09a84..01358d6 100644 --- a/components/DropDowns/Sort/index.tsx +++ b/components/DropDowns/Sort/index.tsx @@ -1,4 +1,4 @@ -"use client" +"use client"; import { Sort } from "@/components/Icons/Sort"; import useCreateQueryString from "@/hooks/useQueryString"; import { usePathname, useRouter, useSearchParams } from "next/navigation"; @@ -7,36 +7,43 @@ import React, { FC, useCallback, useState } from "react"; interface SortDropDownProps {} const SortDropDown: FC = ({}) => { - const router = useRouter() - const pathname = usePathname() + const router = useRouter(); + const pathname = usePathname(); const createQueryString = useCreateQueryString(); - const [isOpen, setIsOpen] = useState(false) - + const [isOpen, setIsOpen] = useState(false); + return (
-
setIsOpen(prev => !prev)}> +
setIsOpen((prev) => !prev)} + > Sort By
-
+

{ - setIsOpen(false) - router.push(pathname + "?" + createQueryString('sort','pricelow')) - } - } + onClick={() => { + setIsOpen(false); + router.push(pathname + "?" + createQueryString("sort", "pricelow")); + }} > Price Low to High

{ - setIsOpen(false) - router.push(pathname + "?" + createQueryString('sort','pricehigh')) - } - } + onClick={() => { + setIsOpen(false); + router.push( + pathname + "?" + createQueryString("sort", "pricehigh") + ); + }} > Price High to Low

diff --git a/components/Footer/constants.ts b/components/Footer/constants.ts index 18ed863..af432dd 100644 --- a/components/Footer/constants.ts +++ b/components/Footer/constants.ts @@ -1,78 +1,77 @@ import { FooterNav } from "@/types/FooterNav"; - -export const FooterNavs : FooterNav[] = [ - { - id:1, - category:'Product', - navs:[ - { - id:1, - value:'New Arrivals', - href:'/' - }, - { - id:2, - value:'Best Selling', - href:'/' - }, - { - id:3, - value:'Home Decor', - href:'/' - }, - { - id:4, - value:'Kitchen Set', - href:'/' - }, - ] - }, - { - id:2, - category:'Services', - navs:[ - { - id:1, - value:'Catalog', - href:'/' - }, - { - id:2, - value:'Blog', - href:'/' - }, - { - id:3, - value:'FaQ', - href:'/' - }, - { - id:4, - value:'Pricing', - href:'/' - }, - ] - }, - { - id:3, - category:'Follow Us', - navs:[ - { - id:1, - value:'Facebook', - href:'/' - }, - { - id:2, - value:'Instagram', - href:'/' - }, - { - id:3, - value:'Twitter', - href:'/' - }, - ] - }, -] \ No newline at end of file +export const FooterNavs: FooterNav[] = [ + { + id: 1, + category: "Product", + navs: [ + { + id: 1, + value: "New Arrivals", + href: "/", + }, + { + id: 2, + value: "Best Selling", + href: "/", + }, + { + id: 3, + value: "Home Decor", + href: "/", + }, + { + id: 4, + value: "Kitchen Set", + href: "/", + }, + ], + }, + { + id: 2, + category: "Services", + navs: [ + { + id: 1, + value: "Catalog", + href: "/", + }, + { + id: 2, + value: "Blog", + href: "/", + }, + { + id: 3, + value: "FaQ", + href: "/", + }, + { + id: 4, + value: "Pricing", + href: "/", + }, + ], + }, + { + id: 3, + category: "Follow Us", + navs: [ + { + id: 1, + value: "Facebook", + href: "/", + }, + { + id: 2, + value: "Instagram", + href: "/", + }, + { + id: 3, + value: "Twitter", + href: "/", + }, + ], + }, +]; diff --git a/components/Footer/index.tsx b/components/Footer/index.tsx index 7759b31..f1a944e 100644 --- a/components/Footer/index.tsx +++ b/components/Footer/index.tsx @@ -1,35 +1,42 @@ -import React, { FC } from 'react' -import Brand from '../Brand'; -import { FooterNavs } from './constants'; -import Link from 'next/link'; +import React, { FC } from "react"; +import Brand from "../Brand"; +import { FooterNavs } from "./constants"; +import Link from "next/link"; -interface FooterProps { - -} +interface FooterProps {} -const Footer: FC = ({ }) => { +const Footer: FC = ({}) => { return ( -
-
-
-
+
+
+
+
-
-
-

Lalasia is digital agency that help you make better experience iaculis cras in.

-
+
+
+

+ Lalasia is digital agency that help you make better experience + iaculis cras in. +

+
-
- {FooterNavs.map((el, _i) => (
-

{el.category}

-
    - {el.navs.map((nav, _i) =>
  • {nav.value}
  • )} -
-
))} +
+ {FooterNavs.map((el, _i) => ( +
+

{el.category}

+
    + {el.navs.map((nav, _i) => ( +
  • + {nav.value} +
  • + ))} +
+
+ ))}
-
+
- ) -} + ); +}; -export default Footer; \ No newline at end of file +export default Footer; diff --git a/components/Forms/Inputs/Search/index.tsx b/components/Forms/Inputs/Search/index.tsx index 0e6b831..1e49471 100644 --- a/components/Forms/Inputs/Search/index.tsx +++ b/components/Forms/Inputs/Search/index.tsx @@ -1,22 +1,28 @@ -import { searchHandler } from '@/actions/search'; -import PrimaryButton from '@/components/Buttons/PrimaryButton'; -import { Search } from '@/components/Icons/Search'; -import React, { FC } from 'react' +import { searchHandler } from "@/actions/search"; +import PrimaryButton from "@/components/Buttons/PrimaryButton"; +import { Search } from "@/components/Icons/Search"; +import React, { FC } from "react"; -interface SearchInputProps { - -} +interface SearchInputProps {} -const SearchInput: FC = ({ }) => { +const SearchInput: FC = ({}) => { return (
-
- - - -
-
- ) -} +
+ + + +
+ + ); +}; -export default SearchInput; \ No newline at end of file +export default SearchInput; diff --git a/components/Forms/LoginForm/index.tsx b/components/Forms/LoginForm/index.tsx index 7b1eb8f..2c58491 100644 --- a/components/Forms/LoginForm/index.tsx +++ b/components/Forms/LoginForm/index.tsx @@ -13,12 +13,12 @@ const getURL = () => { let url = process.env.NEXT_PUBLIC_SITE_URL ?? // Set this to your site URL in production env. process?.env?.NEXT_PUBLIC_VERCEL_URL ?? // Automatically set by Vercel. - 'http://localhost:3000/'; + "http://localhost:3000/"; // Make sure to include https:// when not localhost. - url = url.includes('http') ? url : `https://${url}`; + url = url.includes("http") ? url : `https://${url}`; // Make sure to including trailing /. - url = url.charAt(url.length - 1) === '/' ? url : `${url}/`; + url = url.charAt(url.length - 1) === "/" ? url : `${url}/`; return url; }; const LoginForm: FC = ({}) => { @@ -27,45 +27,52 @@ const LoginForm: FC = ({}) => { const clientAction = async (formData: FormData) => { const data = await loginHandler(formData); //BURAYA BAKCAM ?? - if(data){ - console.log(data) + if (data) { + console.log(data); if (data.error) { - return toast.error(data.error) + return toast.error(data.error); } handleUser(data.user); router.push("/"); - toast.success(`Successfully signed in, welcome ${data.user?.displayName}`); + toast.success( + `Successfully signed in, welcome ${data.user?.displayName}` + ); } }; - const signInGoogle = async() => { - const supabase = createClientComponentClient() + const signInGoogle = async () => { + const supabase = createClientComponentClient(); const { data, error } = await supabase.auth.signInWithOAuth({ - provider: 'google', - options: { - redirectTo: `${getURL()}auth/callback`, - queryParams: { - access_type: 'offline', - prompt: 'consent', - }, + provider: "google", + options: { + redirectTo: `${getURL()}auth/callback`, + queryParams: { + access_type: "offline", + prompt: "consent", }, - }) - - return { - data:data, - error:error - } -} + }, + }); + + return { + data: data, + error: error, + }; + }; return (
- -

{ - let data= signInGoogle() - console.log(data) - }} className="text-lg text-black cursor-pointer">Sign in with Google

+ +

{ + let data = signInGoogle(); + console.log(data); + }} + className="text-lg text-black cursor-pointer" + > + Sign in with Google +

= ({}) => { - const router = useRouter() - const clientAction = async(formData:FormData) => { - const data = await signupHandler(formData) - - if(data?.error){ - toast.error(data.error.message) + const router = useRouter(); + const clientAction = async (formData: FormData) => { + const data = await signupHandler(formData); + + if (data?.error) { + toast.error(data.error.message); } - data?.data.user&&router.push('/auth/login') -} + data?.data.user && router.push("/auth/login"); + }; return ( + type="text" + name="name" + placeholder="name" + className="placeholder:font-medium bg-transparent w-full border text-black py-1 px-2 focus:outline-primaryColor/80 rounded-sm" + > = async ({ user }) => { - -const checkUser = async () => { - let targetUser = null; + const checkUser = async () => { + let targetUser = null; - if (user) { - try { - targetUser = await prisma.user.findUnique({ - where: { - email: String(user.email), - }, - }); - return targetUser; - } catch (err) { - console.log(err, " user error"); - } finally { - prisma.$disconnect(); + if (user) { + try { + targetUser = await prisma.user.findUnique({ + where: { + email: String(user.email), + }, + }); + return targetUser; + } catch (err) { + console.log(err, " user error"); + } finally { + prisma.$disconnect(); + } } - } -}; + }; const targetUser = await checkUser(); return (
@@ -45,11 +43,10 @@ const checkUser = async () => { {HeaderNavs.map((el, _i) => ( ))} - {!targetUser&&} {targetUser && }
- +
diff --git a/components/Header/user-actions/index.tsx b/components/Header/user-actions/index.tsx index a3d3617..2340dcf 100644 --- a/components/Header/user-actions/index.tsx +++ b/components/Header/user-actions/index.tsx @@ -19,26 +19,25 @@ interface HeaderUserActionsProps { const HeaderUserActions: FC = ({ targetUser }) => { const [isProfileOpen, setIsProfileOpen] = useState(false); - const router = useRouter() - const supabase = createClientComponentClient() + const router = useRouter(); + const supabase = createClientComponentClient(); const { user, handleUser } = useUserStore(); const signOut = async () => { - let res = await handleSignOut() - if(res){ - handleUser(null) - toast.success('Successfully signed out!') - router.push('/') + let res = await handleSignOut(); + if (res) { + handleUser(null); + toast.success("Successfully signed out!"); + router.push("/"); } - } - - const getUser = async() => { + }; - if (!user) { - handleUser(targetUser); - } - }; - useEffect(() => { - console.log(targetUser) + const getUser = async () => { + if (!user) { + handleUser(targetUser); + } + }; + useEffect(() => { + console.log(targetUser); getUser(); }, [targetUser]); @@ -54,14 +53,16 @@ const HeaderUserActions: FC = ({ targetUser }) => { return () => document.removeEventListener("click", handleClick); }, []); return ( -
+
- +
diff --git a/containers/articles-page/trending-section/constants.ts b/containers/articles-page/trending-section/constants.ts index c88686d..27722bf 100644 --- a/containers/articles-page/trending-section/constants.ts +++ b/containers/articles-page/trending-section/constants.ts @@ -1,49 +1,56 @@ import { Article } from "@/types/Article"; import { ArticleFilter } from "@/types/Filters"; -export const articleFilters : ArticleFilter[] = ['All', 'Color Guide', 'Design Inspiration', 'Interior Design', 'Tips and Trick'] - -export const trendingArticles : Article[] = [ - { - id:8, - title:'Beautiful and Functional Home Terrace Decoration', - content:"Home terrace decorations are part of every decoration or overall home design. Interiordesign.id – If by chance your house has enough space or space.", - date:new Date(), - imgUrl:'/article8.png', - author:{ - id:2, - name:'Michaela Augus', - imgUrl:'/author2.png' - }, - category:'Tips and Trick' +export const articleFilters: ArticleFilter[] = [ + "All", + "Color Guide", + "Design Inspiration", + "Interior Design", + "Tips and Trick", +]; +export const trendingArticles: Article[] = [ + { + id: 8, + title: "Beautiful and Functional Home Terrace Decoration", + content: + "Home terrace decorations are part of every decoration or overall home design. Interiordesign.id – If by chance your house has enough space or space.", + date: new Date(), + imgUrl: "/article8.png", + author: { + id: 2, + name: "Michaela Augus", + imgUrl: "/author2.png", }, - { - id:9, - title:'Modern Minimalist Home Design: Aesthetics of Modern Home Interiors', - content:"Home terrace decorations are part of every decoration or overall home design. Interiordesign.id – If by chance your house has enough space or space.", - date:new Date(), - imgUrl:'/article9.png', - author:{ - id:2, - name:'Michaela Augus', - imgUrl:'/author2.png' - }, - category:'Design Inspiration' - + category: "Tips and Trick", + }, + { + id: 9, + title: "Modern Minimalist Home Design: Aesthetics of Modern Home Interiors", + content: + "Home terrace decorations are part of every decoration or overall home design. Interiordesign.id – If by chance your house has enough space or space.", + date: new Date(), + imgUrl: "/article9.png", + author: { + id: 2, + name: "Michaela Augus", + imgUrl: "/author2.png", }, - { - id:10, - title:'20+ Best Kitchen Paint Colors That Make Kitchen Spaces Look More Fun', - content:"Is it true that the bedroom design is the most personal reflection of the owner? Many people believe that to be able to judge a person's personality, it is enough to", - date:new Date(), - imgUrl:'/article10.png', - author:{ - id:2, - name:'Michaela Augus', - imgUrl:'/author2.png' - }, - category:'Color Guide' - + category: "Design Inspiration", + }, + { + id: 10, + title: + "20+ Best Kitchen Paint Colors That Make Kitchen Spaces Look More Fun", + content: + "Is it true that the bedroom design is the most personal reflection of the owner? Many people believe that to be able to judge a person's personality, it is enough to", + date: new Date(), + imgUrl: "/article10.png", + author: { + id: 2, + name: "Michaela Augus", + imgUrl: "/author2.png", }, -] \ No newline at end of file + category: "Color Guide", + }, +]; diff --git a/containers/articles-page/trending-section/index.tsx b/containers/articles-page/trending-section/index.tsx index 809a41b..b0340b5 100644 --- a/containers/articles-page/trending-section/index.tsx +++ b/containers/articles-page/trending-section/index.tsx @@ -1,42 +1,62 @@ -"use client" -import PrimaryButton from '@/components/Buttons/PrimaryButton'; -import ArticleCard from '@/components/Cards/ArticleCard'; -import React, { FC, useState } from 'react' -import { articleFilters, trendingArticles } from './constants'; -import FilterButton from '@/components/Buttons/FilterButton'; -import { ArticleFilter } from '@/types/Filters'; +"use client"; +import PrimaryButton from "@/components/Buttons/PrimaryButton"; +import ArticleCard from "@/components/Cards/ArticleCard"; +import React, { FC, useState } from "react"; +import { articleFilters, trendingArticles } from "./constants"; +import FilterButton from "@/components/Buttons/FilterButton"; +import { ArticleFilter } from "@/types/Filters"; -interface ArticlesTrendingSectionProps { - -} +interface ArticlesTrendingSectionProps {} -const ArticlesTrendingSection: FC = ({ }) => { - - const [activeFilter, setActiveFilter] = useState('All') +const ArticlesTrendingSection: FC = ({}) => { + const [activeFilter, setActiveFilter] = useState("All"); return ( -
+

- Trending Topics + Trending Topics

- Popular last week + Popular last week

-
- {articleFilters.map((el, _i) => setActiveFilter(el)} key={_i} activeFilter={activeFilter} text={el}/>)} +
+ {articleFilters.map((el, _i) => ( + setActiveFilter(el)} + key={_i} + activeFilter={activeFilter} + text={el} + /> + ))}
-
- {trendingArticles.map((el, _i) => )} +
+ {trendingArticles.map((el, _i) => ( + + ))}
- +
- ) -} + ); +}; -export default ArticlesTrendingSection; \ No newline at end of file +export default ArticlesTrendingSection; diff --git a/containers/auth-page/login-page/form-section/index.tsx b/containers/auth-page/login-page/form-section/index.tsx index 1c25fb6..79d30d2 100644 --- a/containers/auth-page/login-page/form-section/index.tsx +++ b/containers/auth-page/login-page/form-section/index.tsx @@ -1,32 +1,44 @@ -import Brand from '@/components/Brand'; -import LoginForm from '@/components/Forms/LoginForm'; -import Image from 'next/image'; -import Link from 'next/link'; -import React, { FC } from 'react' +import Brand from "@/components/Brand"; +import LoginForm from "@/components/Forms/LoginForm"; +import Image from "next/image"; +import Link from "next/link"; +import React, { FC } from "react"; -interface LoginFormSectionProps { - -} +interface LoginFormSectionProps {} -const LoginFormSection: FC = ({ }) => { +const LoginFormSection: FC = ({}) => { return ( -
-
-
-
- lalasia login -
-
- - -
-

Dont have an account? Sign up now!

-
-
+
+
+
+
+ lalasia login +
+
+ + +
+

+ Dont have an account?{" "} + + Sign up + {" "} + now! +

+
+
- ) -} + ); +}; -export default LoginFormSection; \ No newline at end of file +export default LoginFormSection; diff --git a/containers/auth-page/signup-page/form-section/index.tsx b/containers/auth-page/signup-page/form-section/index.tsx index cdfdf4d..5af8a31 100644 --- a/containers/auth-page/signup-page/form-section/index.tsx +++ b/containers/auth-page/signup-page/form-section/index.tsx @@ -1,33 +1,45 @@ -import Brand from '@/components/Brand'; -import LoginForm from '@/components/Forms/LoginForm'; -import SignupForm from '@/components/Forms/SignupForm'; -import Image from 'next/image'; -import Link from 'next/link'; -import React, { FC } from 'react' +import Brand from "@/components/Brand"; +import LoginForm from "@/components/Forms/LoginForm"; +import SignupForm from "@/components/Forms/SignupForm"; +import Image from "next/image"; +import Link from "next/link"; +import React, { FC } from "react"; -interface SignupFormSectionProps { - -} +interface SignupFormSectionProps {} -const SignupFormSection: FC = ({ }) => { +const SignupFormSection: FC = ({}) => { return ( -
-
-
-
- lalasia login -
-
- - -
-

Already have an account? Login now!

-
-
+
+
+
+
+ lalasia login +
+
+ + +
+

+ Already have an account?{" "} + + Login + {" "} + now! +

+
+
- ) -} + ); +}; -export default SignupFormSection; \ No newline at end of file +export default SignupFormSection; diff --git a/containers/checkout-page/form-section/index.tsx b/containers/checkout-page/form-section/index.tsx index 9146194..7f49ab6 100644 --- a/containers/checkout-page/form-section/index.tsx +++ b/containers/checkout-page/form-section/index.tsx @@ -1,19 +1,16 @@ -import React, { FC } from 'react' -import BasketItems from './items'; +import React, { FC } from "react"; +import BasketItems from "./items"; -interface CheckoutFormSectionProps { - -} +interface CheckoutFormSectionProps {} -const CheckoutFormSection: FC = ({ }) => { +const CheckoutFormSection: FC = ({}) => { return ( -
-
- - -
+
+
+ +
- ) -} + ); +}; -export default CheckoutFormSection; \ No newline at end of file +export default CheckoutFormSection; diff --git a/containers/checkout-page/form-section/items/index.tsx b/containers/checkout-page/form-section/items/index.tsx index 14bcd15..4bbadd5 100644 --- a/containers/checkout-page/form-section/items/index.tsx +++ b/containers/checkout-page/form-section/items/index.tsx @@ -1,64 +1,79 @@ -"use client" -import { orderHandler } from '@/actions/order'; -import PrimaryButton from '@/components/Buttons/PrimaryButton'; -import BasketCard from '@/components/Cards/BasketCard'; -import { postBasket } from '@/libs/endpoints'; -import { useUserStore } from '@/store/useUserStore'; -import axios from 'axios'; -import { useRouter } from 'next/navigation'; -import React, { FC } from 'react' +"use client"; +import { orderHandler } from "@/actions/order"; +import PrimaryButton from "@/components/Buttons/PrimaryButton"; +import BasketCard from "@/components/Cards/BasketCard"; +import { postBasket } from "@/libs/endpoints"; +import { useUserStore } from "@/store/useUserStore"; +import axios from "axios"; +import { useRouter } from "next/navigation"; +import React, { FC } from "react"; -interface BasketItemsProps { +interface BasketItemsProps {} -} - -const BasketItems: FC = ({ }) => { - const { user,handleUser } = useUserStore() - const router = useRouter() - const removeBasketItems = async() => { - const {data} = await axios.post(postBasket,{action:'wipe',user:user}) - if(data){ - handleUser(data.result) - } - } - if(user?.basket.length===0){ - return( -
-

You Have Not Selected Any Products Yet!

- router.push('/products')}/> - -
- ) - } - const order = async() => { - const updatedUser = await orderHandler(user) - if(updatedUser){ - handleUser(updatedUser) - } +const BasketItems: FC = ({}) => { + const { user, handleUser } = useUserStore(); + const router = useRouter(); + const removeBasketItems = async () => { + const { data } = await axios.post(postBasket, { + action: "wipe", + user: user, + }); + if (data) { + handleUser(data.result); } + }; + if (user?.basket.length === 0) { return ( -
-
-

Your Basket

-
-
- {user?.basket.map((el,_i) => ( - - ))} -
-
-

Total

- ${user?.totalPrice} -
-
- - - - removeBasketItems()} text='Remove All Products' className='font-semibold !bg-secondaryColor !w-max'/> -
- +
+

+ You Have Not Selected Any Products Yet! +

+ router.push("/products")} + /> +
+ ); + } + const order = async () => { + const updatedUser = await orderHandler(user); + if (updatedUser) { + handleUser(updatedUser); + } + }; + return ( +
+
+

Your Basket

+
+
+ {user?.basket.map((el, _i) => ( + + ))} +
+
+

Total

+ + ${user?.totalPrice} + +
+
+
+ + + removeBasketItems()} + text="Remove All Products" + className="font-semibold !bg-secondaryColor !w-max" + /> +
- ) -} + ); +}; -export default BasketItems; \ No newline at end of file +export default BasketItems; diff --git a/containers/home-page/articles-section/articles-slide/index.tsx b/containers/home-page/articles-section/articles-slide/index.tsx index 8496e49..67af170 100644 --- a/containers/home-page/articles-section/articles-slide/index.tsx +++ b/containers/home-page/articles-section/articles-slide/index.tsx @@ -1,30 +1,52 @@ -"use client" -import styles from './style.module.scss' -import React, { FC, useRef } from 'react' +"use client"; +import styles from "./style.module.scss"; +import React, { FC, useRef } from "react"; import { Swiper, SwiperSlide } from "swiper/react"; import "swiper/css"; import "swiper/css/scrollbar"; -import ArticleCard from '@/components/Cards/ArticleCard'; -import { SlideArrowSecondary } from '@/components/Icons/SlideArrow'; -import { highlightedArticles } from '../constants'; -interface ArticlesSlideProps { - -} +import ArticleCard from "@/components/Cards/ArticleCard"; +import { SlideArrowSecondary } from "@/components/Icons/SlideArrow"; +import { highlightedArticles } from "../constants"; +interface ArticlesSlideProps {} -const ArticlesSlide: FC = ({ }) => { +const ArticlesSlide: FC = ({}) => { const swiperRef = useRef(null); return ( + (swiperRef.current = swiper)} + > + {highlightedArticles.map((el, _i) => ( + + + + ))} - swiperRef.current = swiper}> - {highlightedArticles.map((el, _i) => )} - -
- - -
+
+ + +
- ) -} + ); +}; -export default ArticlesSlide; \ No newline at end of file +export default ArticlesSlide; diff --git a/containers/home-page/articles-section/articles-slide/style.module.scss b/containers/home-page/articles-section/articles-slide/style.module.scss index 4b75123..1c5af8e 100644 --- a/containers/home-page/articles-section/articles-slide/style.module.scss +++ b/containers/home-page/articles-section/articles-slide/style.module.scss @@ -1,12 +1,13 @@ -.articleSlide{ +.articleSlide { - width: 100%!important; - max-width: 100%!important; - height: 100%!important; - position: relative!important; + width: 100% !important; + max-width: 100% !important; + height: 100% !important; + position: relative !important; padding: 2.5rem 0; - &__slide{ - width: 100%!important; + &__slide { + + width: 100% !important; } } \ No newline at end of file diff --git a/containers/home-page/articles-section/constants.ts b/containers/home-page/articles-section/constants.ts index b921e94..e402f4f 100644 --- a/containers/home-page/articles-section/constants.ts +++ b/containers/home-page/articles-section/constants.ts @@ -1,77 +1,73 @@ import { Article } from "@/types/Article"; -export const mockArticles : Article[] = [ - { - id:1, - title:'6 ways to give your home minimalistic vibes', - content:"Pellentesque etiam blandit in tincidunt at donec. Eget ipsum .", - date:new Date(), - imgUrl:'/article.png', - author:{ - id:1, - name:'Jerremy Jean', - imgUrl:'/author.png' - }, - category:'Tips and Trick' - +export const mockArticles: Article[] = [ + { + id: 1, + title: "6 ways to give your home minimalistic vibes", + content: "Pellentesque etiam blandit in tincidunt at donec. Eget ipsum .", + date: new Date(), + imgUrl: "/article.png", + author: { + id: 1, + name: "Jerremy Jean", + imgUrl: "/author.png", }, - { - id:2, - title:'How to make your interiors cooler and more stylish', - content:"Pellentesque etiam blandit in tincidunt at donec. Eget ipsum .", - date:new Date(), - imgUrl:'/article2.png', - author:{ - id:2, - name:'Michaela Augus', - imgUrl:'/author2.png' - }, - category:'Design Inspiration' - - }, - { - id:3, - title:'Elements to add character to your space', - content:"Pellentesque etiam blandit in tincidunt at donec. Eget ipsum .", - date:new Date(), - imgUrl:'/article3.png', - author:{ - id:3, - name:'Amon Gus', - imgUrl:'/author3.png' - }, - category:'Tips and Trick' - - }, - -] -export const highlightedArticles : Article[] = [ - { - id:1, - title:'Create Cozy Dinning Room Vibes', - content:'Decorating with neutrals brings balance to the dining room. With eclectic decoration on the sides, Caruso Dining Table and Cyrillo Dining Chairs elevate the tonal base of the room. The modern furniture set gives personality to any space in all types of architecture. The wide volume enables everyone to sit back and relax, be it in the dining room, conference, or office.', - date:new Date(), - imgUrl:'/article.png', - author:{ - id:1, - name:'Jerremy Jean', - imgUrl:'/author.png' - }, - category:'Tips and Trick' - + category: "Tips and Trick", + }, + { + id: 2, + title: "How to make your interiors cooler and more stylish", + content: "Pellentesque etiam blandit in tincidunt at donec. Eget ipsum .", + date: new Date(), + imgUrl: "/article2.png", + author: { + id: 2, + name: "Michaela Augus", + imgUrl: "/author2.png", }, - { - id:2, - title:'Create Cozy Dinning Room Vibes', - content:'Decorating with neutrals brings balance to the dining room. With eclectic decoration on the sides, Caruso Dining Table and Cyrillo Dining Chairs elevate the tonal base of the room. The modern furniture set gives personality to any space in all types of architecture. The wide volume enables everyone to sit back and relax, be it in the dining room, conference, or office.', - date:new Date(), - imgUrl:'/article.png', - author:{ - id:1, - name:'Jerremy Jean', - imgUrl:'/author.png' - }, - category:'Tips and Trick' - - } -] \ No newline at end of file + category: "Design Inspiration", + }, + { + id: 3, + title: "Elements to add character to your space", + content: "Pellentesque etiam blandit in tincidunt at donec. Eget ipsum .", + date: new Date(), + imgUrl: "/article3.png", + author: { + id: 3, + name: "Amon Gus", + imgUrl: "/author3.png", + }, + category: "Tips and Trick", + }, +]; +export const highlightedArticles: Article[] = [ + { + id: 1, + title: "Create Cozy Dinning Room Vibes", + content: + "Decorating with neutrals brings balance to the dining room. With eclectic decoration on the sides, Caruso Dining Table and Cyrillo Dining Chairs elevate the tonal base of the room. The modern furniture set gives personality to any space in all types of architecture. The wide volume enables everyone to sit back and relax, be it in the dining room, conference, or office.", + date: new Date(), + imgUrl: "/article.png", + author: { + id: 1, + name: "Jerremy Jean", + imgUrl: "/author.png", + }, + category: "Tips and Trick", + }, + { + id: 2, + title: "Create Cozy Dinning Room Vibes", + content: + "Decorating with neutrals brings balance to the dining room. With eclectic decoration on the sides, Caruso Dining Table and Cyrillo Dining Chairs elevate the tonal base of the room. The modern furniture set gives personality to any space in all types of architecture. The wide volume enables everyone to sit back and relax, be it in the dining room, conference, or office.", + date: new Date(), + imgUrl: "/article.png", + author: { + id: 1, + name: "Jerremy Jean", + imgUrl: "/author.png", + }, + category: "Tips and Trick", + }, +]; diff --git a/containers/home-page/articles-section/index.tsx b/containers/home-page/articles-section/index.tsx index 3fbf1c6..335f28a 100644 --- a/containers/home-page/articles-section/index.tsx +++ b/containers/home-page/articles-section/index.tsx @@ -21,17 +21,28 @@ const ArticlesSection: FC = ({}) => {

- Pellentesque etiam blandit in tincidunt at donec. + Pellentesque etiam blandit in tincidunt at donec.

- +
- {mockArticles.map((el, _i) => )} - + {mockArticles.map((el, _i) => ( + + ))}
diff --git a/containers/home-page/cta-section/index.tsx b/containers/home-page/cta-section/index.tsx index 49f9d42..1b06522 100644 --- a/containers/home-page/cta-section/index.tsx +++ b/containers/home-page/cta-section/index.tsx @@ -1,19 +1,19 @@ -import PrimaryButton from '@/components/Buttons/PrimaryButton'; -import React, { FC } from 'react' +import PrimaryButton from "@/components/Buttons/PrimaryButton"; +import React, { FC } from "react"; -interface CtaSectionProps { - -} +interface CtaSectionProps {} -const CtaSection: FC = ({ }) => { +const CtaSection: FC = ({}) => { return ( -
-
-

Join with me to get special discount

- -
+
+
+

+ Join with me to get special discount +

+ +
- ) -} + ); +}; -export default CtaSection; \ No newline at end of file +export default CtaSection; diff --git a/containers/home-page/hero-section/index.tsx b/containers/home-page/hero-section/index.tsx index 2d8c92d..848afb5 100644 --- a/containers/home-page/hero-section/index.tsx +++ b/containers/home-page/hero-section/index.tsx @@ -14,22 +14,30 @@ const HeroSection: FC = ({}) => {

Discover Furniture With High Quality Wood

- - + +

- Pellentesque etiam blandit in tincidunt at donec. Eget ipsum dignissim placerat nisi, adipiscing mauris non. Purus parturient viverra nunc, tortor sit laoreet. Quam tincidunt aliquam adipiscing tempor. + Pellentesque etiam blandit in tincidunt at donec. Eget ipsum + dignissim placerat nisi, adipiscing mauris non. Purus parturient + viverra nunc, tortor sit laoreet. Quam tincidunt aliquam + adipiscing tempor.

-
- -
-
- Hero IMG -
+
+ +
+
+ Hero IMG +
diff --git a/containers/home-page/info-section/index.tsx b/containers/home-page/info-section/index.tsx index 2b22a5d..8884f21 100644 --- a/containers/home-page/info-section/index.tsx +++ b/containers/home-page/info-section/index.tsx @@ -1,47 +1,75 @@ -import PrimaryButton from '@/components/Buttons/PrimaryButton'; -import Image from 'next/image'; -import React, { FC } from 'react' +import PrimaryButton from "@/components/Buttons/PrimaryButton"; +import Image from "next/image"; +import React, { FC } from "react"; -interface InfoSectionProps { - -} +interface InfoSectionProps {} -const InfoSection: FC = ({ }) => { +const InfoSection: FC = ({}) => { return ( -
-
-
-
-

Our Product

-

Crafted by talented and
- high quality material

-
-

Pellentesque etiam blandit in tincidunt at donec. Eget ipsum dignissim placerat nisi, adipiscing mauris non purus parturient. morbi fermentum, vivamus et accumsan dui tincidunt pulvinar

- -
-
-
-

20+

-

Years Experience

-
-
-

483

-

Happy Client

-
-
-

150+

-

Project Finished

-
-
-
- Seciton IMG -
-
- Seciton IMG -
+
+
+
+
+

+ Our Product +

+

+ Crafted by talented and +
+ high quality material +

+
+

+ {" "} + Pellentesque etiam blandit in tincidunt at donec. Eget ipsum + dignissim placerat nisi, adipiscing mauris non purus parturient. + morbi fermentum, vivamus et accumsan dui tincidunt pulvinar +

+
+
+
+

+ 20+ +

+

+ Years Experience +

+
+
+

+ 483 +

+

Happy Client

+
+
+

+ 150+ +

+

+ Project Finished +

+
+
+
+ Seciton IMG +
+
+ Seciton IMG +
+
- ) -} + ); +}; -export default InfoSection; \ No newline at end of file +export default InfoSection; diff --git a/containers/home-page/popular-products-section/index.tsx b/containers/home-page/popular-products-section/index.tsx index 676abef..6f18988 100644 --- a/containers/home-page/popular-products-section/index.tsx +++ b/containers/home-page/popular-products-section/index.tsx @@ -4,10 +4,10 @@ import PopularProductsSlide from "./popular-products-slide"; import { TProduct } from "@/types/Product"; interface PopularProductsProps { - products: TProduct[] + products: TProduct[]; } -const PopularProducts: FC = ({products}) => { +const PopularProducts: FC = ({ products }) => { return (
@@ -25,7 +25,7 @@ const PopularProducts: FC = ({products}) => {

- +
); diff --git a/containers/home-page/popular-products-section/popular-products-slide/index.tsx b/containers/home-page/popular-products-section/popular-products-slide/index.tsx index 6e8502f..456ad99 100644 --- a/containers/home-page/popular-products-section/popular-products-slide/index.tsx +++ b/containers/home-page/popular-products-section/popular-products-slide/index.tsx @@ -11,10 +11,10 @@ import { SlideArrow } from "@/components/Icons/SlideArrow"; import { TProduct } from "@/types/Product"; interface PopularProductsSlideProps { - items:TProduct[] + items: TProduct[]; } -const PopularProductsSlide: FC = ({items}) => { +const PopularProductsSlide: FC = ({ items }) => { const swiperRef = useRef(null); return ( = ({items}) => { centeredSlides onSwiper={(swiper) => (swiperRef.current = swiper)} > - {items?.map((el,_i) => ( - - - + {items?.map((el, _i) => ( + + + ))} - {items?.map((el,_i) => ( - - - + {items?.map((el, _i) => ( + + + ))}
diff --git a/containers/product-page/related-section/index.tsx b/containers/product-page/related-section/index.tsx index 208258a..4698046 100644 --- a/containers/product-page/related-section/index.tsx +++ b/containers/product-page/related-section/index.tsx @@ -1,21 +1,19 @@ -import ProductCard from '@/components/Cards/ProductCard'; -import React, { FC } from 'react' +import ProductCard from "@/components/Cards/ProductCard"; +import React, { FC } from "react"; -interface RelatedSectionProps { - -} +interface RelatedSectionProps {} -const RelatedSection: FC = ({ }) => { +const RelatedSection: FC = ({}) => { return ( -
- {/*
+
+ {/*

Related Items

{Array(3).fill(0).map((el, _i) => )}
*/}
- ) -} + ); +}; -export default RelatedSection; \ No newline at end of file +export default RelatedSection; diff --git a/containers/products-page/items-section/index.tsx b/containers/products-page/items-section/index.tsx index b261b6a..295b328 100644 --- a/containers/products-page/items-section/index.tsx +++ b/containers/products-page/items-section/index.tsx @@ -1,41 +1,53 @@ -import ProductCard from '@/components/Cards/ProductCard'; -import SortDropDown from '@/components/DropDowns/Sort'; -import Pagination from '@/components/Pagination'; -import { TProduct } from '@/types/Product'; -import React, { FC } from 'react' +import ProductCard from "@/components/Cards/ProductCard"; +import SortDropDown from "@/components/DropDowns/Sort"; +import Pagination from "@/components/Pagination"; +import { TProduct } from "@/types/Product"; +import React, { FC } from "react"; interface ProductsItemsProps { - products:TProduct[] - size:number, - itemsPerView:number + products: TProduct[]; + size: number; + itemsPerView: number; } - -const ProductsItems: FC = ({ products,size,itemsPerView }) => { +const ProductsItems: FC = ({ + products, + size, + itemsPerView, +}) => { // This one provides fake loader // const data = await loader() return ( -
-
-
-
-

Total Product

- {size} -
-
- +
+
+
+
+

+ Total Product +

+ + {size} + +
+
+
-
- {products.map((el,_i) => )} +
+ {products.map((el, _i) => ( + + ))}
-
- +
+
- ) -} + ); +}; -export default ProductsItems; \ No newline at end of file +export default ProductsItems; diff --git a/containers/products-page/products-hero/index.tsx b/containers/products-page/products-hero/index.tsx index 62b9465..fc2b516 100644 --- a/containers/products-page/products-hero/index.tsx +++ b/containers/products-page/products-hero/index.tsx @@ -1,22 +1,23 @@ -import React, { FC } from 'react' -import ProductsHeroSlide from './products-hero-slide'; +import React, { FC } from "react"; +import ProductsHeroSlide from "./products-hero-slide"; -interface ProductsHeroProps { - -} +interface ProductsHeroProps {} -const ProductsHero: FC = ({ }) => { +const ProductsHero: FC = ({}) => { return ( -
-
-

Products

-

We display products based on the latest products we have, if you want to see our old products please enter the name of the item

-
-
- -
+
+
+

Products

+

+ We display products based on the latest products we have, if you want + to see our old products please enter the name of the item +

+
+
+ +
- ) -} + ); +}; -export default ProductsHero; \ No newline at end of file +export default ProductsHero; diff --git a/containers/products-page/products-hero/products-hero-slide/index.tsx b/containers/products-page/products-hero/products-hero-slide/index.tsx index f164b21..c69aea7 100644 --- a/containers/products-page/products-hero/products-hero-slide/index.tsx +++ b/containers/products-page/products-hero/products-hero-slide/index.tsx @@ -1,39 +1,37 @@ -"use client" -import React, { FC, useRef } from 'react' +"use client"; +import React, { FC, useRef } from "react"; import { Swiper, SwiperSlide } from "swiper/react"; import { Navigation, Pagination, EffectCoverflow } from "swiper/modules"; -import "./style.scss" +import "./style.scss"; import "swiper/css"; import "swiper/css/scrollbar"; import "swiper/css/navigation"; import "swiper/css/pagination"; -import { SlideArrow } from '@/components/Icons/SlideArrow'; -import ProductsBanner from '@/components/Banners/ProductsBanner'; +import { SlideArrow } from "@/components/Icons/SlideArrow"; +import ProductsBanner from "@/components/Banners/ProductsBanner"; -interface ProductsHeroSlideProps { - -} +interface ProductsHeroSlideProps {} -const ProductsHeroSlide: FC = ({ }) => { - const swiperRef = useRef(null) +const ProductsHeroSlide: FC = ({}) => { + const swiperRef = useRef(null); return ( - swiperRef.current=swiper} + (swiperRef.current = swiper)} > - + + + + + + + + + - - - - - - - - - - - - - ) -} + ); +}; -export default ProductsHeroSlide; \ No newline at end of file +export default ProductsHeroSlide; diff --git a/containers/products-page/search-section/index.tsx b/containers/products-page/search-section/index.tsx index 7eebdee..5816be9 100644 --- a/containers/products-page/search-section/index.tsx +++ b/containers/products-page/search-section/index.tsx @@ -1,22 +1,19 @@ -import FilterDropdown from '@/components/DropDowns/Filter'; -import SearchInput from '@/components/Forms/Inputs/Search'; -import React, { FC } from 'react' +import FilterDropdown from "@/components/DropDowns/Filter"; +import SearchInput from "@/components/Forms/Inputs/Search"; +import React, { FC } from "react"; -interface ProductsSearchProps { - -} +interface ProductsSearchProps {} -const ProductsSearch: FC = ({ }) => { +const ProductsSearch: FC = ({}) => { return ( -
-
-
- +
+
+
+
- -
+
- ) -} + ); +}; -export default ProductsSearch; \ No newline at end of file +export default ProductsSearch; diff --git a/containers/search-page/result-section/index.tsx b/containers/search-page/result-section/index.tsx index 4d774b2..91f606b 100644 --- a/containers/search-page/result-section/index.tsx +++ b/containers/search-page/result-section/index.tsx @@ -1,28 +1,31 @@ -import ProductCard from '@/components/Cards/ProductCard'; -import { TProduct } from '@/types/Product'; -import React, { FC } from 'react' +import ProductCard from "@/components/Cards/ProductCard"; +import { TProduct } from "@/types/Product"; +import React, { FC } from "react"; interface SearchResultSectionProps { - results:TProduct[] - searchKey:string | string[] + results: TProduct[]; + searchKey: string | string[]; } -const SearchResultSection: FC = ({ results, searchKey }) => { - console.log(results, results) +const SearchResultSection: FC = ({ + results, + searchKey, +}) => { + console.log(results, results); return ( -
-
-
-

{`Results for "${searchKey}"`}

-
-
- {results.map((el,_i) => )} +
+
+
+

{`Results for "${searchKey}"`}

+
+
+ {results.map((el, _i) => ( + + ))} +
+
+
+ ); +}; -
- -
-
- ) -} - -export default SearchResultSection; \ No newline at end of file +export default SearchResultSection; diff --git a/containers/search-page/search-section/index.tsx b/containers/search-page/search-section/index.tsx index 9184b60..1d66ed2 100644 --- a/containers/search-page/search-section/index.tsx +++ b/containers/search-page/search-section/index.tsx @@ -1,25 +1,25 @@ -import SearchInput from '@/components/Forms/Inputs/Search'; -import React, { FC } from 'react' +import SearchInput from "@/components/Forms/Inputs/Search"; +import React, { FC } from "react"; -interface SearchSectionProps { - -} +interface SearchSectionProps {} -const SearchSection: FC = ({ }) => { +const SearchSection: FC = ({}) => { return ( -
-
-
-

Search

-

The product crafted by talented crafter and using high quality material with love inside

-
-
- -
+
+
+
+

Search

+

+ The product crafted by talented crafter and using high quality + material with love inside +

+
+
+ +
+
+
+ ); +}; -
-
- ) -} - -export default SearchSection; \ No newline at end of file +export default SearchSection; diff --git a/containers/services-page/cards-section/index.tsx b/containers/services-page/cards-section/index.tsx index e22f7ad..bd84593 100644 --- a/containers/services-page/cards-section/index.tsx +++ b/containers/services-page/cards-section/index.tsx @@ -1,21 +1,27 @@ -import ServiceCard from '@/components/Cards/ServiceCard'; -import React, { FC } from 'react' -import { ServiceCards } from './constants'; +import ServiceCard from "@/components/Cards/ServiceCard"; +import React, { FC } from "react"; +import { ServiceCards } from "./constants"; -interface ServicesCardsProps { - -} +interface ServicesCardsProps {} -const ServicesCards: FC = ({ }) => { +const ServicesCards: FC = ({}) => { return ( -
-
-
- {ServiceCards.map((el, _i) => )} -
+
+
+
+ {ServiceCards.map((el, _i) => ( + + ))}
+
- ) -} + ); +}; -export default ServicesCards; \ No newline at end of file +export default ServicesCards; diff --git a/containers/services-page/cta-section/index.tsx b/containers/services-page/cta-section/index.tsx index 2a5ace0..8be1f80 100644 --- a/containers/services-page/cta-section/index.tsx +++ b/containers/services-page/cta-section/index.tsx @@ -1,20 +1,19 @@ -import PrimaryButton from '@/components/Buttons/PrimaryButton'; -import React, { FC } from 'react' +import PrimaryButton from "@/components/Buttons/PrimaryButton"; +import React, { FC } from "react"; -interface ServicesCtaProps { - -} +interface ServicesCtaProps {} -const ServicesCta: FC = ({ }) => { +const ServicesCta: FC = ({}) => { return ( -
-
-

Are you interested -work with us?

- -
+
+
+

+ Are you interested work with us? +

+ +
- ) -} + ); +}; -export default ServicesCta; \ No newline at end of file +export default ServicesCta; diff --git a/containers/services-page/hero-section/index.tsx b/containers/services-page/hero-section/index.tsx index 3ed2861..eeb6822 100644 --- a/containers/services-page/hero-section/index.tsx +++ b/containers/services-page/hero-section/index.tsx @@ -1,25 +1,32 @@ -import Image from 'next/image'; -import React, { FC } from 'react' +import Image from "next/image"; +import React, { FC } from "react"; -interface ServicesHeroProps { - -} +interface ServicesHeroProps {} -const ServicesHero: FC = ({ }) => { +const ServicesHero: FC = ({}) => { return ( -
-
-
-

Services

-

The product crafted by talented crafter and using high quality material with love inside

+
+
+
+

+ Services +

+

+ The product crafted by talented crafter and using high quality + material with love inside +

+
+
+ Lalasia Banner +
-
- Lalasia Banner -
- -
- ) -} + ); +}; -export default ServicesHero; \ No newline at end of file +export default ServicesHero; diff --git a/containers/services-page/portfolio-section/index.tsx b/containers/services-page/portfolio-section/index.tsx index aab780a..7fb64f2 100644 --- a/containers/services-page/portfolio-section/index.tsx +++ b/containers/services-page/portfolio-section/index.tsx @@ -27,17 +27,15 @@ const ServicesPortfolio: FC = ({}) => {
- +
- - +
- +
-
diff --git a/db/auth.ts b/db/auth.ts index 6c83629..6b71d63 100644 --- a/db/auth.ts +++ b/db/auth.ts @@ -1,12 +1,12 @@ -import { createClientComponentClient } from "@supabase/auth-helpers-nextjs" +import { createClientComponentClient } from "@supabase/auth-helpers-nextjs"; export const handleSignOut = async () => { - const supabase = createClientComponentClient() + const supabase = createClientComponentClient(); - try{ - await supabase.auth.signOut() - return true - }catch(err){ - console.log(err) - } - } \ No newline at end of file + try { + await supabase.auth.signOut(); + return true; + } catch (err) { + console.log(err); + } +}; diff --git a/hooks/useQueryString.tsx b/hooks/useQueryString.tsx index 11860a5..7b11546 100644 --- a/hooks/useQueryString.tsx +++ b/hooks/useQueryString.tsx @@ -1,8 +1,8 @@ -import { useSearchParams } from 'next/navigation'; -import { useCallback } from 'react'; +import { useSearchParams } from "next/navigation"; +import { useCallback } from "react"; // Define the type for the hook function -type CreateQueryStringFn = (name: string, value: string|number) => string; +type CreateQueryStringFn = (name: string, value: string | number) => string; const useCreateQueryString: () => CreateQueryStringFn = () => { // Wrap your existing createQueryString function in useCallback diff --git a/libs/endpoints.ts b/libs/endpoints.ts index 223b027..398c77e 100644 --- a/libs/endpoints.ts +++ b/libs/endpoints.ts @@ -1,9 +1,18 @@ +export const getAll = + (process.env.NEXT_PUBLIC_SITE_URL ?? + process?.env?.NEXT_PUBLIC_VERCEL_URL ?? + "http://localhost:3000") + "/api/products/getAll"; +export const getSingle = + (process.env.NEXT_PUBLIC_SITE_URL ?? + process?.env?.NEXT_PUBLIC_VERCEL_URL ?? + "http://localhost:3000") + "/api/products/getSingle"; +export const searchItem = + (process.env.NEXT_PUBLIC_SITE_URL ?? + process?.env?.NEXT_PUBLIC_VERCEL_URL ?? + "http://localhost:3000") + "/api/products/searchItem"; - -export const getAll = (process.env.NEXT_PUBLIC_SITE_URL ?? process?.env?.NEXT_PUBLIC_VERCEL_URL ?? 'http://localhost:3000')+'/api/products/getAll' -export const getSingle = (process.env.NEXT_PUBLIC_SITE_URL ?? process?.env?.NEXT_PUBLIC_VERCEL_URL ?? 'http://localhost:3000')+'/api/products/getSingle' - -export const searchItem = (process.env.NEXT_PUBLIC_SITE_URL ?? process?.env?.NEXT_PUBLIC_VERCEL_URL ?? 'http://localhost:3000')+'/api/products/searchItem' - -export const postBasket = (process.env.NEXT_PUBLIC_SITE_URL ?? process?.env?.NEXT_PUBLIC_VERCEL_URL ?? 'http://localhost:3000')+'/api/user/basket' \ No newline at end of file +export const postBasket = + (process.env.NEXT_PUBLIC_SITE_URL ?? + process?.env?.NEXT_PUBLIC_VERCEL_URL ?? + "http://localhost:3000") + "/api/user/basket"; diff --git a/libs/fonts.ts b/libs/fonts.ts index 5cecbb8..96a7e9b 100644 --- a/libs/fonts.ts +++ b/libs/fonts.ts @@ -1,27 +1,27 @@ -import localFont from '@next/font/local' +import localFont from "@next/font/local"; export const eudox = localFont({ - src: [ - { - path: '../public/fonts/Eudoxus/EudoxusSans-Light.ttf', - weight: '300' - }, - { - path: '../public/fonts/Eudoxus/EudoxusSans-Regular.ttf', - weight: '400' - }, - { - path: '../public/fonts/Eudoxus/EudoxusSans-Medium.ttf', - weight: '500' - }, - { - path: '../public/fonts/Eudoxus/EudoxusSans-ExtraLight.ttf', - weight: '200' - }, - { - path: '../public/fonts/Eudoxus/EudoxusSans-Bold.ttf', - weight: '600' - }, - ], - variable: '--eudox' -}) \ No newline at end of file + src: [ + { + path: "../public/fonts/Eudoxus/EudoxusSans-Light.ttf", + weight: "300", + }, + { + path: "../public/fonts/Eudoxus/EudoxusSans-Regular.ttf", + weight: "400", + }, + { + path: "../public/fonts/Eudoxus/EudoxusSans-Medium.ttf", + weight: "500", + }, + { + path: "../public/fonts/Eudoxus/EudoxusSans-ExtraLight.ttf", + weight: "200", + }, + { + path: "../public/fonts/Eudoxus/EudoxusSans-Bold.ttf", + weight: "600", + }, + ], + variable: "--eudox", +}); diff --git a/middleware.ts b/middleware.ts index c5655a9..17e47bc 100644 --- a/middleware.ts +++ b/middleware.ts @@ -7,13 +7,24 @@ export async function middleware(req: NextRequest) { const res = NextResponse.next() const supabase = createMiddlewareClient({ req, res }) let session = await supabase.auth.getSession() - if(session.data.session?.user){ - - return NextResponse.redirect(new URL('/', req.url)) + if (req.nextUrl.pathname.startsWith('/auth')) { + // This logic is only applied to /about + if(session.data.session?.user){ + + return NextResponse.redirect(new URL('/', req.url)) + } + } + if (req.nextUrl.pathname.startsWith('/checkout')) { + // This logic is only applied to /about + if(!session.data.session?.user){ + + return NextResponse.redirect(new URL('/', req.url)) + } } + return res } -export const config = { +/*export const config = { matcher:['/auth/login','/auth/signup'], -} \ No newline at end of file +}*/ \ No newline at end of file diff --git a/services/playerTimeFormatter.ts b/services/playerTimeFormatter.ts index e9bd018..6401a4d 100644 --- a/services/playerTimeFormatter.ts +++ b/services/playerTimeFormatter.ts @@ -1,11 +1,7 @@ +export const playerTimeFormatter = (seconds: number) => { + let result: string; + let minute = Math.floor(seconds / 60); + let second = Math.floor(seconds % 60); - - -export const playerTimeFormatter = (seconds:number) => { - - let result : string; - let minute = Math.floor(seconds / 60); - let second = Math.floor(seconds % 60); - - return `${minute}:${second}` -} \ No newline at end of file + return `${minute}:${second}`; +}; diff --git a/store/useLayoutStore.ts b/store/useLayoutStore.ts new file mode 100644 index 0000000..95ab560 --- /dev/null +++ b/store/useLayoutStore.ts @@ -0,0 +1,11 @@ +import { create } from "zustand"; + +type LayoutStore = { + mobileOpen: boolean; + handleMobileOpen: (val: boolean) => void; +}; + +export const useLayoutStore = create()((set) => ({ + mobileOpen: false, + handleMobileOpen: (val) => set((state) => ({ mobileOpen: val })), +})); diff --git a/store/useUserStore.ts b/store/useUserStore.ts index 952376e..e703a13 100644 --- a/store/useUserStore.ts +++ b/store/useUserStore.ts @@ -1,14 +1,13 @@ -import { TUser } from '@/types/User' -import { JsonValue } from '@prisma/client/runtime/library' -import { create } from 'zustand' +import { TUser } from "@/types/User"; +import { JsonValue } from "@prisma/client/runtime/library"; +import { create } from "zustand"; type UserStore = { - user:TUser - handleUser: (user:TUser) => void -} + user: TUser; + handleUser: (user: TUser) => void; +}; export const useUserStore = create()((set) => ({ user: null, handleUser: (newUser) => set((state) => ({ user: newUser })), -})) - +})); diff --git a/types/Article.ts b/types/Article.ts index ba9dce3..f8c1ea7 100644 --- a/types/Article.ts +++ b/types/Article.ts @@ -1,11 +1,11 @@ -import { AuthorType } from "./Author" +import { AuthorType } from "./Author"; export type Article = { - id:number, - title:string, - category:string, - imgUrl:string, - author:AuthorType, - content:string, - date:Date -} \ No newline at end of file + id: number; + title: string; + category: string; + imgUrl: string; + author: AuthorType; + content: string; + date: Date; +}; diff --git a/types/Author.ts b/types/Author.ts index 35db262..7e8a75a 100644 --- a/types/Author.ts +++ b/types/Author.ts @@ -1,7 +1,5 @@ - - export type AuthorType = { - id:number, - name:string, - imgUrl:string -} \ No newline at end of file + id: number; + name: string; + imgUrl: string; +}; diff --git a/types/BasketItem.ts b/types/BasketItem.ts index bcee036..611069c 100644 --- a/types/BasketItem.ts +++ b/types/BasketItem.ts @@ -1,17 +1,15 @@ export type TBasketItem = { - item:{ - - imgUrl:string - name:string - title:string - category:string - description:string - price:number - color:string - colors: string[] - userId:number - }, - id:string, - color:string - -} \ No newline at end of file + item: { + imgUrl: string; + name: string; + title: string; + category: string; + description: string; + price: number; + color: string; + colors: string[]; + userId: number; + }; + id: string; + color: string; +}; diff --git a/types/Filters.ts b/types/Filters.ts index 8255a03..3322f40 100644 --- a/types/Filters.ts +++ b/types/Filters.ts @@ -1,3 +1,6 @@ - - -export type ArticleFilter = 'All' | 'Tips and Trick' | 'Interior Design' | 'Design Inspiration' | 'Color Guide' \ No newline at end of file +export type ArticleFilter = + | "All" + | "Tips and Trick" + | "Interior Design" + | "Design Inspiration" + | "Color Guide"; diff --git a/types/FooterNav.ts b/types/FooterNav.ts index cd81636..1315700 100644 --- a/types/FooterNav.ts +++ b/types/FooterNav.ts @@ -1,10 +1,7 @@ -import { HeaderNav } from "./HeaderNav" - +import { HeaderNav } from "./HeaderNav"; export type FooterNav = { - id:number, - category:string, - navs: HeaderNav[], - - -} \ No newline at end of file + id: number; + category: string; + navs: HeaderNav[]; +}; diff --git a/types/Services.ts b/types/Services.ts index ef8e001..3442d9e 100644 --- a/types/Services.ts +++ b/types/Services.ts @@ -1,9 +1,6 @@ - - - export type ServicesType = { - id:number, - title:string, - icon?:JSX.Element, - content:string -} \ No newline at end of file + id: number; + title: string; + icon?: JSX.Element; + content: string; +}; diff --git a/types/TeamMember.ts b/types/TeamMember.ts index e8b39b4..b0d1ad8 100644 --- a/types/TeamMember.ts +++ b/types/TeamMember.ts @@ -1,8 +1,6 @@ - - export type TeamMemberType = { - id:number, - name:string, - imgUrl:string, - title:string -} \ No newline at end of file + id: number; + name: string; + imgUrl: string; + title: string; +}; diff --git a/types/User.ts b/types/User.ts index 6e571d3..7796014 100644 --- a/types/User.ts +++ b/types/User.ts @@ -3,12 +3,12 @@ import { JsonValue } from "@prisma/client/runtime/library"; import { TProduct } from "./Product"; -export type TUser = TPureUser | null +export type TUser = TPureUser | null; export type TPureUser = { id: number; displayName: string; - email:string; - basket:any[] - totalPrice:number -} \ No newline at end of file + email: string; + basket: any[]; + totalPrice: number; +};