From aaa1c6f78cb7103588ba093e50cd3df3277fb9d9 Mon Sep 17 00:00:00 2001 From: Linzo99 Date: Sat, 9 Mar 2024 21:36:08 +0000 Subject: [PATCH] add contribution button --- = | 264 -- Dockerfile | 2 +- app/layout.tsx | 4 + .../components/Verses/VerseAndTranslation.tsx | 12 +- .../Navbar/NavigationDrawer/DonationCard.tsx | 16 +- components/Navbar/RamadanButton.tsx | 21 + components/Navbar/index.tsx | 4 + public/sw.js | 94 +- public/sw.js.map | 1 + public/workbox-1b1de004.js | 2456 +++++++++++++++++ public/workbox-1b1de004.js.map | 1 + public/workbox-b0a6e652.js | 1 - 12 files changed, 2598 insertions(+), 278 deletions(-) delete mode 100644 = create mode 100644 components/Navbar/RamadanButton.tsx create mode 100644 public/sw.js.map create mode 100644 public/workbox-1b1de004.js create mode 100644 public/workbox-1b1de004.js.map delete mode 100644 public/workbox-b0a6e652.js diff --git a/= b/= deleted file mode 100644 index 573f9bc..0000000 --- a/= +++ /dev/null @@ -1,264 +0,0 @@ -"use server" - -import { cookies } from "next/headers" -import { createServerActionClient } from "@supabase/auth-helpers-nextjs" - -import { - Audio, - Author, - Database, - Reciter, - TablesInsert, - TablesUpdate, - Verse, - Xassida, -} from "@/types/supabase" - -//const supabase = createClientComponentClient({}) -// -const cookieStore = cookies() -const supabase = createServerActionClient({ - cookies: () => cookieStore, -}) - -const signInWithEmail = async (values: { email: string; password: string }) => { - const { error } = await supabase.auth.signInWithPassword(values) - if (error) throw Error - - return true -} - -const signOut = async () => await supabase.auth.signOut() - -const searchXassida = async (search: string): Promise => { - const { data, error } = await supabase - .from("xassida") - .select("*, author(name, tariha)") - .like("name", `%${search}%`) - .limit(10) - if (error) throw error - - return data as any -} - -const searchReciter = async (search: string): Promise => { - const { data, error } = await supabase - .from("reciter") - .select("*") - .like("name", `%${search}%`) - .limit(10) - if (error) throw error - - return data as any -} - -const getXassidas = async ( - filters = {}, - offset = 0, - page_size = 15 -): Promise => { - const from = offset * page_size - const to = from + page_size - 1 - let query = supabase - .from("xassida") - .select("*, author!inner(*)") - .order("name") - // apply filters - Object.entries(filters).forEach(([k, v]) => { - if (v) query = query.filter(k, "eq", v) - }) - const { data, error } = await query.range(from, to) - if (error) throw error - - return data as any -} - -const getXassidaById = async (id: number): Promise => { - const { data, error } = await supabase - .from("xassida") - .select("*, chapter(id, number), author(*), reciter(id, name)") - .eq("id", id) - .single() - if (error) throw error - - return data as any -} - -const getVersesByChapterId = async ( - id: number, - offset = 1, - page_size = 20 -): Promise => { - const from = offset * page_size - const to = from + page_size - 1 - const { data, error } = await supabase - .from("verse") - .select("*, translations:verse_translation(*)") - .eq("chapter_id", id) - .order("number") - .range(from, to) - if (error) throw error - - return data as any -} - -const getAuthors = async ( - filters = {}, - offset = 0, - page_size = 15 -): Promise => { - const from = offset * page_size - const to = from + page_size - 1 - let query = supabase.from("author").select().order("name") - // apply filters - Object.entries(filters).forEach(([k, v]) => { - if (v) query = query.filter(k, "eq", v) - }) - const { data, error } = await query.range(from, to) - if (error) throw error - - return data -} - -const getAuthorById = async (id: number): Promise => { - const { data, error } = await supabase - .from("author") - .select() - .eq("id", id) - .single() - if (error) throw error - - return data -} - -const getReciters = async ( - filters = {}, - offset = 0, - page_size = 15 -): Promise => { - const from = offset * page_size - const to = from + page_size - 1 - let query = supabase.from("reciter").select().order("name") - // apply filters - Object.entries(filters).forEach(([k, v]) => { - if (v) query = query.filter(k, "eq", v) - }) - const { data, error } = await query.range(from, to) - if (error) throw error - - return data -} - -const getReciterById = async (id: number): Promise => { - const { data, error } = await supabase - .from("author") - .select() - .eq("id", id) - .single() - if (error) throw error - - return data -} - -const createReciter = async ( - values: TablesInsert<"reciter"> -): Promise => { - const { data, error } = await supabase.from("reciter").insert(values).select() - - if (error) throw error - - return data as any -} - -const updateReciter = async (id: number, values: TablesUpdate<"reciter">) => { - const { data, error } = await supabase - .from("reciter") - .update(values) - .eq("id", id) - .select() - - if (error) throw error - - return data as any -} - -const getAudios = async ( - filters = {}, - offset = 0, - page_size = 15 -): Promise => { - const from = offset * page_size - const to = from + page_size - 1 - let query = supabase - .from("audio") - .select("*, reciter(*), xassida(id, name, reciter(id, name))") - .order("id") - // apply filters - Object.entries(filters).forEach(([k, v]) => { - if (v) query = query.filter(k, "eq", v) - }) - const { data, error } = await query.range(from, to) - if (error) throw error - - return data as any -} - -const getAudioById = async (id: number): Promise