From 8ecf081a438dd4c8a26f9a23f9dbd3d83fc5d950 Mon Sep 17 00:00:00 2001 From: unimu-cic <125171539+unimu-cic@users.noreply.github.com> Date: Sun, 4 Feb 2024 18:33:13 +0800 Subject: [PATCH] chore: code formatting --- src/app/auth/callback/route.ts | 20 +-- src/app/dashboard/page.tsx | 41 +++-- src/app/layout.tsx | 20 +-- src/app/middleware.ts | 16 +- src/app/page.tsx | 14 +- src/app/sign-in/[[...sign-in]]/AuthUI.tsx | 32 ++-- src/app/sign-in/[[...sign-in]]/page.tsx | 8 +- src/app/supabase-provider.tsx | 24 +-- src/components/Create.tsx | 87 ++++++---- src/components/SignOutBtn.tsx | 23 +-- src/components/Stat.tsx | 26 ++- src/components/ToDoItem.tsx | 194 +++++++++++++--------- src/components/ToDoList.tsx | 118 +++++++------ src/store/index.ts | 122 +++++++------- src/utils/helpers.ts | 7 +- tailwind.config.ts | 18 +- types_db.ts | 28 ++-- 17 files changed, 443 insertions(+), 355 deletions(-) diff --git a/src/app/auth/callback/route.ts b/src/app/auth/callback/route.ts index 86becfe..513faed 100644 --- a/src/app/auth/callback/route.ts +++ b/src/app/auth/callback/route.ts @@ -1,18 +1,18 @@ -import {createRouteHandlerClient} from '@supabase/auth-helpers-nextjs' -import {cookies} from 'next/headers' -import {NextResponse} from 'next/server' +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 {Database} from '../../../../types_db' +import type { NextRequest } from "next/server"; +import type { Database } from "../../../../types_db"; export async function GET(request: NextRequest) { - const requestUrl = new URL(request.url) - const code = requestUrl.searchParams.get('code') + const requestUrl = new URL(request.url); + const code = requestUrl.searchParams.get("code"); if (code) { - const supabase = createRouteHandlerClient({cookies}) - await supabase.auth.exchangeCodeForSession(code) + const supabase = createRouteHandlerClient({ cookies }); + await supabase.auth.exchangeCodeForSession(code); } - return NextResponse.redirect(`${requestUrl.origin}/dashboard`) + return NextResponse.redirect(`${requestUrl.origin}/dashboard`); } diff --git a/src/app/dashboard/page.tsx b/src/app/dashboard/page.tsx index df0be12..45aa758 100644 --- a/src/app/dashboard/page.tsx +++ b/src/app/dashboard/page.tsx @@ -1,33 +1,40 @@ import Stat from "@/components/Stat"; import Create from "@/components/Create"; -import {cookies} from "next/headers"; -import {createServerComponentClient, Session} from '@supabase/auth-helpers-nextjs' -import {redirect} from "next/navigation"; +import { cookies } from "next/headers"; +import { + createServerComponentClient, + Session, +} from "@supabase/auth-helpers-nextjs"; +import { redirect } from "next/navigation"; import ToDoList from "@/components/ToDoList"; -import {Database} from "../../../types_db"; +import { Database } from "../../../types_db"; import SignOutBtn from "@/components/SignOutBtn"; const Dashboard = async () => { - const supabase = createServerComponentClient({cookies}) - const {data: {session}} = await supabase.auth.getSession() + const supabase = createServerComponentClient({ cookies }); + const { + data: { session }, + } = await supabase.auth.getSession(); if (!session) { - redirect('/sign-in') + redirect("/sign-in"); } return ( -
-
-

XERO TODO

+
+
+

+ XERO TODO +

-
- - - +
+ + +
- ) -} + ); +}; -export default Dashboard +export default Dashboard; diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 359d572..ea7ca8f 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,10 +1,10 @@ -import type {Metadata} from "next"; -import {Inter} from "next/font/google"; +import type { Metadata } from "next"; +import { Inter } from "next/font/google"; import "./globals.css"; -import SupabaseProvider from './supabase-provider'; +import SupabaseProvider from "./supabase-provider"; import classNames from "classnames"; -const inter = Inter({subsets: ["latin"]}); +const inter = Inter({ subsets: ["latin"] }); export const metadata: Metadata = { title: "Create Next App", @@ -12,17 +12,15 @@ export const metadata: Metadata = { }; export default function RootLayout({ - children, - }: Readonly<{ + children, +}: Readonly<{ children: React.ReactNode; }>) { return ( - - - {children} - - + + {children} + ); } diff --git a/src/app/middleware.ts b/src/app/middleware.ts index 3a7a40e..278238e 100644 --- a/src/app/middleware.ts +++ b/src/app/middleware.ts @@ -1,16 +1,16 @@ -import {createMiddlewareClient} from '@supabase/auth-helpers-nextjs' -import {NextRequest, NextResponse} from 'next/server' +import { createMiddlewareClient } from "@supabase/auth-helpers-nextjs"; +import { NextRequest, NextResponse } from "next/server"; export async function middleware(req: NextRequest) { - const res = NextResponse.next() + const res = NextResponse.next(); // Create a Supabase client configured to use cookies - const supabase = createMiddlewareClient({req, res}) + const supabase = createMiddlewareClient({ req, res }); // Refresh session if expired - required for Server Components - await supabase.auth.getSession() + await supabase.auth.getSession(); - return res + return res; } // Ensure the middleware is only called for relevant paths. @@ -23,6 +23,6 @@ export const config = { * - favicon.ico (favicon file) * Feel free to modify this pattern to include more paths. */ - '/((?!_next/static|_next/image|favicon.ico).*)', + "/((?!_next/static|_next/image|favicon.ico).*)", ], -} +}; diff --git a/src/app/page.tsx b/src/app/page.tsx index ee6485f..7840a07 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -3,11 +3,17 @@ import Link from "next/link"; export default function Home() { return (
-

XERO  TODO

-

Get your things done more simply.

+

+ XERO  TODO +

+

Get your things done more simply.

- Start to - GTD -> + + Start to GTD -> +
); } diff --git a/src/app/sign-in/[[...sign-in]]/AuthUI.tsx b/src/app/sign-in/[[...sign-in]]/AuthUI.tsx index 094d0eb..6791c68 100644 --- a/src/app/sign-in/[[...sign-in]]/AuthUI.tsx +++ b/src/app/sign-in/[[...sign-in]]/AuthUI.tsx @@ -1,30 +1,30 @@ -'use client'; -import {Auth} from '@supabase/auth-ui-react'; -import {getURL} from '@/utils/helpers'; -import {useSupabase} from '@/app/supabase-provider'; +"use client"; +import { Auth } from "@supabase/auth-ui-react"; +import { getURL } from "@/utils/helpers"; +import { useSupabase } from "@/app/supabase-provider"; const AuthUI = () => { - const {supabase} = useSupabase(); + const { supabase } = useSupabase(); return ( -
-
-

Sign in

-

to continue to XERO TODO

+
+
+

Sign in

+

to continue to XERO TODO

svg]:h-6 [&>svg]:w-6", container: "w-[20rem] flex flex-col gap-4 mb-4 last:mb-0", - divider: "bg-secondary-300 h-[1px] my-10 relative before:bg-secondary-500 before:content-['or'] before:absolute before:px-2 before:text-black-300 before:top-1/2 before:left-1/2 before:-translate-y-1/2 before:-translate-x-1/2", + divider: + "bg-secondary-300 h-[1px] my-10 relative before:bg-secondary-500 before:content-['or'] before:absolute before:px-2 before:text-black-300 before:top-1/2 before:left-1/2 before:-translate-y-1/2 before:-translate-x-1/2", input: "text-black flex h-9 w-full rounded-md border border-black transition-all bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-black/70 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", label: "mb-1 flex flex-col text-sm text-black", @@ -34,7 +34,7 @@ const AuthUI = () => { magicLink={true} />
- ) -} + ); +}; -export default AuthUI +export default AuthUI; diff --git a/src/app/sign-in/[[...sign-in]]/page.tsx b/src/app/sign-in/[[...sign-in]]/page.tsx index fd6cfbf..c6fdd34 100644 --- a/src/app/sign-in/[[...sign-in]]/page.tsx +++ b/src/app/sign-in/[[...sign-in]]/page.tsx @@ -2,10 +2,10 @@ import AuthUI from "./AuthUI"; const SignInPage = () => { return ( -
+
- ) -} + ); +}; -export default SignInPage +export default SignInPage; diff --git a/src/app/supabase-provider.tsx b/src/app/supabase-provider.tsx index 0f644cd..eee96db 100644 --- a/src/app/supabase-provider.tsx +++ b/src/app/supabase-provider.tsx @@ -1,10 +1,10 @@ -'use client'; +"use client"; -import type {Database} from '../../types_db'; -import {createPagesBrowserClient} from '@supabase/auth-helpers-nextjs'; -import type {SupabaseClient} from '@supabase/auth-helpers-nextjs'; -import {useRouter} from 'next/navigation'; -import {createContext, useContext, useEffect, useState} from 'react'; +import type { Database } from "../../types_db"; +import { createPagesBrowserClient } from "@supabase/auth-helpers-nextjs"; +import type { SupabaseClient } from "@supabase/auth-helpers-nextjs"; +import { useRouter } from "next/navigation"; +import { createContext, useContext, useEffect, useState } from "react"; type SupabaseContext = { supabase: SupabaseClient; @@ -13,8 +13,8 @@ type SupabaseContext = { const Context = createContext(undefined); export default function SupabaseProvider({ - children - }: { + children, +}: { children: React.ReactNode; }) { const [supabase] = useState(() => createPagesBrowserClient()); @@ -22,9 +22,9 @@ export default function SupabaseProvider({ useEffect(() => { const { - data: {subscription} + data: { subscription }, } = supabase.auth.onAuthStateChange((event) => { - if (event === 'SIGNED_IN') router.refresh(); + if (event === "SIGNED_IN") router.refresh(); }); return () => { @@ -33,7 +33,7 @@ export default function SupabaseProvider({ }, [router, supabase]); return ( - + <>{children} ); @@ -43,7 +43,7 @@ export const useSupabase = () => { const context = useContext(Context); if (context === undefined) { - throw new Error('useSupabase must be used inside SupabaseProvider'); + throw new Error("useSupabase must be used inside SupabaseProvider"); } return context; diff --git a/src/components/Create.tsx b/src/components/Create.tsx index 6c9f0ea..abc7d81 100644 --- a/src/components/Create.tsx +++ b/src/components/Create.tsx @@ -1,75 +1,90 @@ -'use client' -import {useForm, SubmitHandler} from 'react-hook-form' -import {Item, useToDoState} from "@/store"; -import {createClientComponentClient, Session} from "@supabase/auth-helpers-nextjs"; -import {FC} from "react"; +"use client"; +import { useForm, SubmitHandler } from "react-hook-form"; +import { Item, useToDoState } from "@/store"; +import { + createClientComponentClient, + Session, +} from "@supabase/auth-helpers-nextjs"; +import { FC } from "react"; type Inputs = { - title: string -} + title: string; +}; type Props = { - session: Session -} + session: Session; +}; -const Create: FC = ({session}) => { +const Create: FC = ({ session }) => { const { register, handleSubmit, - formState: {errors}, - reset - } = useForm() + formState: { errors }, + reset, + } = useForm(); const addToDo = useToDoState((state) => state.addItem); - const onSubmit: SubmitHandler = async ({title}) => { + const onSubmit: SubmitHandler = async ({ title }) => { const supabase = createClientComponentClient(); const item = { user_id: session.user.id, title, - description: '', + description: "", enddate: null, startdate: new Date(), priority: null, - status: false - } as Item + status: false, + } as Item; - const {error, data} = await supabase + const { error, data } = await supabase .from("todos") .insert(item) .select() .single(); if (!error) { - addToDo(data) - reset() + addToDo(data); + reset(); } - } + }; return ( -
-
-
- +
+ +
+
- { - errors.title && -

{errors.title.message}

- } + {errors.title && ( +

+ {errors.title.message} +

+ )}
- ) -} + ); +}; -export default Create +export default Create; diff --git a/src/components/SignOutBtn.tsx b/src/components/SignOutBtn.tsx index db95052..78c7800 100644 --- a/src/components/SignOutBtn.tsx +++ b/src/components/SignOutBtn.tsx @@ -1,25 +1,26 @@ -'use client' -import {useRouter} from 'next/navigation'; -import {createClientComponentClient} from "@supabase/auth-helpers-nextjs"; +"use client"; +import { useRouter } from "next/navigation"; +import { createClientComponentClient } from "@supabase/auth-helpers-nextjs"; const SignOutBtn = () => { - const supabase = createClientComponentClient() + const supabase = createClientComponentClient(); const router = useRouter(); const handleSignOut = async () => { - await supabase.auth.signOut() - router.refresh() - } + await supabase.auth.signOut(); + router.refresh(); + }; return ( - ) -} + ); +}; -export default SignOutBtn +export default SignOutBtn; diff --git a/src/components/Stat.tsx b/src/components/Stat.tsx index df7095d..d3b33df 100644 --- a/src/components/Stat.tsx +++ b/src/components/Stat.tsx @@ -1,23 +1,21 @@ -'use client' -import { useToDoState} from "@/store"; +"use client"; +import { useToDoState } from "@/store"; const Stat = () => { - const list = useToDoState(state => state.list) - const doneCount = list.filter(item => item.status).length + const list = useToDoState((state) => state.list); + const doneCount = list.filter((item) => item.status).length; return ( -
-
-

Todo Done

-

Keep it up

+
+
+

Todo Done

+

Keep it up

-
+
{doneCount}/{list.length}
- ) -} + ); +}; -export default Stat +export default Stat; diff --git a/src/components/ToDoItem.tsx b/src/components/ToDoItem.tsx index 87ecf87..d49363e 100644 --- a/src/components/ToDoItem.tsx +++ b/src/components/ToDoItem.tsx @@ -1,133 +1,177 @@ -'use client' -import {Item} from "@/store"; +"use client"; +import { Item } from "@/store"; import classNames from "classnames"; -import {useState, MouseEvent} from "react"; -import * as Dialog from '@radix-ui/react-dialog'; -import {SubmitHandler, useForm} from "react-hook-form"; +import { useState, MouseEvent } from "react"; +import * as Dialog from "@radix-ui/react-dialog"; +import { SubmitHandler, useForm } from "react-hook-form"; import dayjs from "dayjs"; export type Inputs = { - title: string - enddate: string - description: string -} + title: string; + enddate: string; + description: string; +}; type Props = { - todo: Item - onToggle: () => void - onUpdate: (id: string, date: Inputs) => void - onDelete: (id: string) => void -} -const ToDoItem = ({todo, onToggle, onUpdate, onDelete}: Props) => { - const [isOpen, setIsOpen] = useState(false) + todo: Item; + onToggle: () => void; + onUpdate: (id: string, date: Inputs) => void; + onDelete: (id: string) => void; +}; +const ToDoItem = ({ todo, onToggle, onUpdate, onDelete }: Props) => { + const [isOpen, setIsOpen] = useState(false); const { register, handleSubmit, - formState: {errors}, - } = useForm() + formState: { errors }, + } = useForm(); const onSubmit: SubmitHandler = (formData) => { - onUpdate(todo.id, formData) - setIsOpen(false) - } + onUpdate(todo.id, formData); + setIsOpen(false); + }; const handleEdit = (e: MouseEvent) => { - e.preventDefault() - e.stopPropagation() + e.preventDefault(); + e.stopPropagation(); if (todo.status) { - return + return; } - setIsOpen(true) - } + setIsOpen(true); + }; return ( -
-
-
- { - e.preventDefault() - e.stopPropagation() - onToggle() - }} - > -

{todo.title}

+
+
+
+ { + e.preventDefault(); + e.stopPropagation(); + onToggle(); + }} + > +

+ {todo.title} +

-
+
-
- { - todo.description &&
{todo.description}
- } - { - todo.enddate &&
{dayjs(todo.enddate).format('YYYY-MM-DD')}
- } + {todo.description && ( +
{todo.description}
+ )} + {todo.enddate && ( +
+ {dayjs(todo.enddate).format("YYYY-MM-DD")} +
+ )}
- + setIsOpen(false)} - className="fixed top-[50%] left-[50%] max-h-[85vh] text-black w-[90vw] max-w-[450px] translate-x-[-50%] translate-y-[-50%] rounded-[6px] bg-secondary-500 p-[25px] shadow-[hsl(206_22%_7%_/_35%)_0px_10px_38px_-10px,_hsl(206_22%_7%_/_20%)_0px_10px_20px_-15px] focus:outline-none"> + className="fixed top-[50%] left-[50%] max-h-[85vh] text-black w-[90vw] max-w-[450px] translate-x-[-50%] translate-y-[-50%] rounded-[6px] bg-secondary-500 p-[25px] shadow-[hsl(206_22%_7%_/_35%)_0px_10px_38px_-10px,_hsl(206_22%_7%_/_20%)_0px_10px_20px_-15px] focus:outline-none" + > Edit task -
-
- + +
+
-
- +
+
-
- +
+
- + - ) -} + ); +}; -export default ToDoItem +export default ToDoItem; diff --git a/src/components/ToDoList.tsx b/src/components/ToDoList.tsx index 8f8ddb6..74756f4 100644 --- a/src/components/ToDoList.tsx +++ b/src/components/ToDoList.tsx @@ -1,65 +1,68 @@ -'use client' +"use client"; import ToDoItem from "@/components/ToDoItem"; -import {Item, useToDoState} from "@/store"; -import {useCallback, useEffect } from "react"; -import {createClientComponentClient} from "@supabase/auth-helpers-nextjs"; -import { Inputs as EditInputs } from './ToDoItem' +import { Item, useToDoState } from "@/store"; +import { useCallback, useEffect } from "react"; +import { createClientComponentClient } from "@supabase/auth-helpers-nextjs"; +import { Inputs as EditInputs } from "./ToDoItem"; const ToDoList = () => { - const supabase = createClientComponentClient() - const todos = useToDoState(state => state.list) - const empty = useToDoState(state => state.empty) - const setTodos = useToDoState(state => state.setList) - const toggleItem = useToDoState(state => state.toggleItem) - const updateItem = useToDoState(state => state.updateItem) - const loading = useToDoState(state => state.loading) - const setLoading = useToDoState(state => state.setLoading) + const supabase = createClientComponentClient(); + const todos = useToDoState((state) => state.list); + const empty = useToDoState((state) => state.empty); + const setTodos = useToDoState((state) => state.setList); + const toggleItem = useToDoState((state) => state.toggleItem); + const updateItem = useToDoState((state) => state.updateItem); + const loading = useToDoState((state) => state.loading); + const setLoading = useToDoState((state) => state.setLoading); useEffect(() => { - setLoading(true) + setLoading(true); const fetchTodos = async () => { - const {data, error} = await supabase - .from('todos') - .select('*') - .order('id', {ascending: true}) - const todos = data || [] - if (error) console.log('error', error) - else setTodos(todos) + const { data, error } = await supabase + .from("todos") + .select("*") + .order("id", { ascending: true }); + const todos = data || []; + if (error) console.log("error", error); + else setTodos(todos); - setLoading(false) - } + setLoading(false); + }; - fetchTodos() - }, [supabase]) + fetchTodos(); + }, [supabase]); - const handleDelete = useCallback(async (id: string) => { - try { - await supabase.from('todos').delete().eq('id', id).throwOnError() - const latestTodos = todos.filter((item) => item.id != id) - setTodos(latestTodos) - } catch (error) { - console.log('error', error) - } - }, [todos]) + const handleDelete = useCallback( + async (id: string) => { + try { + await supabase.from("todos").delete().eq("id", id).throwOnError(); + const latestTodos = todos.filter((item) => item.id != id); + setTodos(latestTodos); + } catch (error) { + console.log("error", error); + } + }, + [todos], + ); const handleToggle = async (todo: Item) => { try { - const {data} = await supabase - .from('todos') - .update({status: !todo.status}) - .eq('id', todo.id) + const { data } = await supabase + .from("todos") + .update({ status: !todo.status }) + .eq("id", todo.id) .throwOnError() .select() - .single() + .single(); if (data) { - toggleItem(todo) + toggleItem(todo); } } catch (error) { - console.log('error', error) + console.log("error", error); } - } + }; const handleUpdate = async (id: string, formData: EditInputs) => { const result = Object.entries(formData).reduce((prev, [key, value]) => { @@ -70,28 +73,39 @@ const ToDoList = () => { return prev; }, {}); - const {error, data} = await supabase + const { error, data } = await supabase .from("todos") .update(result) - .eq('id', id) + .eq("id", id) .select() .single(); if (!error) { - updateItem(id, data) + updateItem(id, data); } - } + }; if (loading) { - return
Loading...
+ return
Loading...
; } if (empty) { - return
All tasks completed
+ return ( +
+ All tasks completed +
+ ); } - return todos?.map(item => handleToggle(item)} - onDelete={handleDelete} todo={item}/>) -} + return todos?.map((item) => ( + handleToggle(item)} + onDelete={handleDelete} + todo={item} + /> + )); +}; -export default ToDoList +export default ToDoList; diff --git a/src/store/index.ts b/src/store/index.ts index 6638670..a2bcc92 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -1,66 +1,72 @@ -import {create} from 'zustand' -import {devtools} from 'zustand/middleware' +import { create } from "zustand"; +import { devtools } from "zustand/middleware"; -type Priority = 'High' | 'Medium' | 'Low' +type Priority = "High" | "Medium" | "Low"; export type Item = { - id: string, - user_id: string - title: string - description: string - startdate: Date - enddate: Date | null - priority: Priority | null - status: boolean -} + id: string; + user_id: string; + title: string; + description: string; + startdate: Date; + enddate: Date | null; + priority: Priority | null; + status: boolean; +}; interface State { - list: Item[] - loading: boolean - empty: boolean - setLoading: (state: boolean) => void - addItem: (item: Item) => void - setList: (list: Item[] | null) => void - toggleItem: (item: Item) => void - updateItem: (id: string, item: Item) => void + list: Item[]; + loading: boolean; + empty: boolean; + setLoading: (state: boolean) => void; + addItem: (item: Item) => void; + setList: (list: Item[] | null) => void; + toggleItem: (item: Item) => void; + updateItem: (id: string, item: Item) => void; } -export const useToDoState = create()(devtools((set) => ({ - list: [], - loading: false, - empty: false, - updateItem: (id: String, updates: Item) => set((state) => { - for (let i = 0; i < state.list.length; i++) { - if (state.list[i].id === id) { - state.list[i] = updates - break; - } - } - return { - list: [...state.list] - } - }), - addItem: (item: Item) => set((state) => ({ - list: [...state.list, item], - empty: false - })), - toggleItem: (item: Item) => set((state) => { - for (let i = 0; i < state.list.length; i++) { - if (state.list[i].id === item.id) { - state.list[i].status = !item.status; - break; - } - } - return { - list: [...state.list] - } - }), - setList: (list: Item[] | null) => set(() => ({ - list: list || [], - empty: list?.length === 0 +export const useToDoState = create()( + devtools((set) => ({ + list: [], + loading: false, + empty: false, + updateItem: (id: String, updates: Item) => + set((state) => { + for (let i = 0; i < state.list.length; i++) { + if (state.list[i].id === id) { + state.list[i] = updates; + break; + } + } + return { + list: [...state.list], + }; + }), + addItem: (item: Item) => + set((state) => ({ + list: [...state.list, item], + empty: false, + })), + toggleItem: (item: Item) => + set((state) => { + for (let i = 0; i < state.list.length; i++) { + if (state.list[i].id === item.id) { + state.list[i].status = !item.status; + break; + } + } + return { + list: [...state.list], + }; + }), + setList: (list: Item[] | null) => + set(() => ({ + list: list || [], + empty: list?.length === 0, + })), + setLoading: (state) => + set(() => ({ + loading: state, + })), })), - setLoading: (state) => set(() => ({ - loading: state - })), -}))) - +); diff --git a/src/utils/helpers.ts b/src/utils/helpers.ts index 18c565e..278bcc8 100644 --- a/src/utils/helpers.ts +++ b/src/utils/helpers.ts @@ -1,12 +1,11 @@ - export 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; }; diff --git a/tailwind.config.ts b/tailwind.config.ts index 8fd4169..b52c054 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -10,19 +10,19 @@ const config: Config = { extend: { colors: { black: { - DEFAULT: '#0d0d0d', - 300: '#47423a', - 500: '#1e1e1e' + DEFAULT: "#0d0d0d", + 300: "#47423a", + 500: "#1e1e1e", }, primary: { - DEFAULT: '#ff5631' + DEFAULT: "#ff5631", }, secondary: { - DEFAULT: '#d3c3a9', - 300: '#bbaa8d', - 500: '#cebea4' - } - } + DEFAULT: "#d3c3a9", + 300: "#bbaa8d", + 500: "#cebea4", + }, + }, }, }, plugins: [], diff --git a/types_db.ts b/types_db.ts index ab40156..839d2f7 100644 --- a/types_db.ts +++ b/types_db.ts @@ -1,23 +1,23 @@ -import {Item} from "@/store"; +import { Item } from "@/store"; export interface Database { public: { Tables: { todos: { - Row: Item - Insert: Item - Update: Item - Relationships: [] - } - } + Row: Item; + Insert: Item; + Update: Item; + Relationships: []; + }; + }; Views: { - [_ in never]: never - } + [_ in never]: never; + }; Functions: { - [_ in never]: never - } + [_ in never]: never; + }; CompositeTypes: { - [_ in never]: never - } - } + [_ in never]: never; + }; + }; }