diff --git a/next.config.ts b/next.config.ts index 9d0da29..392e6cb 100644 --- a/next.config.ts +++ b/next.config.ts @@ -4,6 +4,9 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { reactStrictMode: true, + images: { + domains: ["habibapp.com"], // Add the domain for image hosting + }, // Add other Next.js config options here as needed }; diff --git a/public/assets/images/Ellipse 441.svg b/public/assets/images/Ellipse 441.svg new file mode 100644 index 0000000..75056b7 --- /dev/null +++ b/public/assets/images/Ellipse 441.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/assets/images/GraySetting.svg b/public/assets/images/GraySetting.svg new file mode 100644 index 0000000..501aef4 --- /dev/null +++ b/public/assets/images/GraySetting.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/components/context/audio-conext.tsx b/src/components/context/audio-conext.tsx new file mode 100644 index 0000000..bc3aff6 --- /dev/null +++ b/src/components/context/audio-conext.tsx @@ -0,0 +1,139 @@ +import http from "@/api/http"; +import React, { + createContext, + useContext, + useState, + ReactNode, + useRef, + useEffect, +} from "react"; + +interface Dua { + id: number; + text: string; + description: string; + local_alpha: string; + translation: string; +} + +interface AudioSyncData { + id: number; + duration: [number, number][]; +} + +interface Audio { + audio: string; + audio_sync_data: AudioSyncData[]; + reciter?: { + id: string; + name: string; + }; +} + +interface AudiosResponse { + results: Audio[]; +} + +interface AudioContextType { + audioRef: React.RefObject; + audio: Audio | null; // Store a single audio object + getAudio: (id: number) => Promise; + selectedReciter?: string; + setSelectedReciter: React.Dispatch>; +} + +const AudioContext = createContext(undefined); + +export const AudioProvider: React.FC<{ children: ReactNode }> = ({ + children, +}) => { + const audioRef = useRef(null); + const partRefs = useRef<(HTMLDivElement | null)[]>([]); + + const [audios, setAudios] = useState