diff --git a/.github/workflows/deploy-website.yml b/.github/workflows/deploy-website.yml index f891d23..899909b 100644 --- a/.github/workflows/deploy-website.yml +++ b/.github/workflows/deploy-website.yml @@ -31,6 +31,8 @@ jobs: - name: Build run: | cd website + sed -i "s|SUPABASE_URL|${{ secrets.SUPABASE_URL }}|g" config.js + sed -i "s|SUPABASE_ANON_KEY|${{ secrets.SUPABASE_ANON_KEY }}|g" config.js npm run build - name: Configure AWS Credentials @@ -43,4 +45,4 @@ jobs: - name: Deploy to S3 run: | cd website - aws s3 sync ./out s3://${{ secrets.WEBSITE_BUCKET_NAME }} \ No newline at end of file + aws s3 sync ./out s3://${{ secrets.WEBSITE_BUCKET_NAME }} diff --git a/website/app/restaurants/[restaurant]/page.tsx b/website/app/restaurants/[restaurant]/page.tsx deleted file mode 100644 index 172f842..0000000 --- a/website/app/restaurants/[restaurant]/page.tsx +++ /dev/null @@ -1,255 +0,0 @@ -"use client"; - -import SectionTitle from "@/components/Common/SectionTitle"; -import React, { useRef, useState } from "react"; -import Image from "next/image"; -import restaurantDetailsData from "./restaurantDetailsData"; - -import { Swiper, SwiperSlide } from "swiper/react"; -import { FreeMode, Navigation, Thumbs, Autoplay } from "swiper/modules"; - -import "swiper/css"; -import "swiper/css/free-mode"; -import "swiper/css/navigation"; -import "swiper/css/thumbs"; -import "styles/swiper.css"; -import Link from "next/link"; - -const FoodCategoryRestaurantDetails = ({ - params, -}: { - params: { restaurant: string }; -}) => { - const [thumbsSwiper, setThumbsSwiper] = useState(null); - - return ( -
-
- -
-
- - - -

{restaurantDetailsData.address}

-
-
- - - -

+91 1236547890

-
-
- - - -

Website

-
- - - - - - -

Menu

- -
- - {restaurantDetailsData.images.map((item) => ( -
- - restaurants-image - -
- ))} -
- - {restaurantDetailsData.images.map((item) => ( -
- - restaurants-image - -
- ))} -
- -
-

- Menu -

-
- {restaurantDetailsData.menus.map((item) => ( - -
-

- - - {item.name} - - -

-

- {item.description} -

-

-
- - ))} -
-
-
-

- Cuisines -

-
- {restaurantDetailsData.cuisines.map((item) => ( - -

- {item.name} -

- - ))} -
-
-
-

- Rating and Reviews -

-
-
-
-
- ); -}; - -export default FoodCategoryRestaurantDetails; diff --git a/website/config.js b/website/config.js new file mode 100644 index 0000000..b5e76f3 --- /dev/null +++ b/website/config.js @@ -0,0 +1,4 @@ +export default Object.freeze({ + SUPABASE_URL: SUPABASE_URL, + SUPABASE_ANON_KEY: SUPABASE_ANON_KEY, +}); diff --git a/website/utils/supabase.ts b/website/utils/supabase.ts index 555d38b..dcae1b6 100644 --- a/website/utils/supabase.ts +++ b/website/utils/supabase.ts @@ -1,6 +1,4 @@ import { createClient } from "@supabase/supabase-js"; +import config from "@/config"; -export default createClient( - process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY! -); +export default createClient(config.SUPABASE_URL, config.SUPABASE_ANON_KEY); diff --git a/website/utils/supabase/client.ts b/website/utils/supabase/client.ts index e2660d0..f0822ac 100644 --- a/website/utils/supabase/client.ts +++ b/website/utils/supabase/client.ts @@ -1,7 +1,5 @@ import { createBrowserClient } from "@supabase/ssr"; +import config from "@/config"; export const createClient = () => - createBrowserClient( - process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, - ); + createBrowserClient(config.SUPABASE_URL, config.SUPABASE_ANON_KEY); diff --git a/website/utils/supabase/middleware.ts b/website/utils/supabase/middleware.ts index 24e61c5..e83046c 100644 --- a/website/utils/supabase/middleware.ts +++ b/website/utils/supabase/middleware.ts @@ -1,5 +1,6 @@ import { createServerClient, type CookieOptions } from "@supabase/ssr"; import { type NextRequest, NextResponse } from "next/server"; +import config from "@/config"; export const createClient = (request: NextRequest) => { // Create an unmodified response @@ -10,8 +11,8 @@ export const createClient = (request: NextRequest) => { }); const supabase = createServerClient( - process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, + config.SUPABASE_URL, + config.SUPABASE_ANON_KEY, { cookies: { get(name: string) { @@ -54,7 +55,7 @@ export const createClient = (request: NextRequest) => { }); }, }, - }, + } ); return { supabase, response }; diff --git a/website/utils/supabase/server.ts b/website/utils/supabase/server.ts index eb27a37..741e4aa 100644 --- a/website/utils/supabase/server.ts +++ b/website/utils/supabase/server.ts @@ -1,34 +1,31 @@ import { createServerClient, type CookieOptions } from "@supabase/ssr"; import { cookies } from "next/headers"; +import config from "@/config"; export const createClient = (cookieStore: ReturnType) => { - return createServerClient( - process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, - { - cookies: { - get(name: string) { - return cookieStore.get(name)?.value; - }, - set(name: string, value: string, options: CookieOptions) { - try { - cookieStore.set({ name, value, ...options }); - } catch (error) { - // The `set` method was called from a Server Component. - // This can be ignored if you have middleware refreshing - // user sessions. - } - }, - remove(name: string, options: CookieOptions) { - try { - cookieStore.set({ name, value: "", ...options }); - } catch (error) { - // The `delete` method was called from a Server Component. - // This can be ignored if you have middleware refreshing - // user sessions. - } - }, + return createServerClient(config.SUPABASE_URL, config.SUPABASE_ANON_KEY, { + cookies: { + get(name: string) { + return cookieStore.get(name)?.value; + }, + set(name: string, value: string, options: CookieOptions) { + try { + cookieStore.set({ name, value, ...options }); + } catch (error) { + // The `set` method was called from a Server Component. + // This can be ignored if you have middleware refreshing + // user sessions. + } + }, + remove(name: string, options: CookieOptions) { + try { + cookieStore.set({ name, value: "", ...options }); + } catch (error) { + // The `delete` method was called from a Server Component. + // This can be ignored if you have middleware refreshing + // user sessions. + } }, }, - ); + }); };