Add Prayer Times, Dhikr counter, Quran tracker with mobile UI overhaul
- Prayer times page: arc progress ring, next-prayer countdown, clean prayer list - Dhikr counter: SVG ring with glow, 3-phase sequence (SubhanAllah/Alhamdulillah/AllahuAkbar), streak tracking - Daily Quran reading tracker API routes (GET/POST) - Bottom nav updated: Prayer + Dhikr tabs, Repeat2 icon for dhikr, Moon for prayer - Home page redirects to /prayer as primary entry point - Dockerfile: openssl added to builder stage, explicit prisma schema path fixes build - Schema: dhikrStreak, quranStreak on User; DhikrSession and QuranReading models - Stub wallet top-up checkout to fix TypeScript build error Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
|
||||
// Proxies aladhan.com — free, no API key required
|
||||
export async function GET(req: NextRequest) {
|
||||
const { searchParams } = new URL(req.url)
|
||||
const lat = searchParams.get('lat')
|
||||
const lng = searchParams.get('lng')
|
||||
const method = searchParams.get('method') || '3' // MWL
|
||||
|
||||
if (!lat || !lng) return NextResponse.json({ error: 'lat and lng required' }, { status: 400 })
|
||||
|
||||
try {
|
||||
const res = await fetch(
|
||||
`https://api.aladhan.com/v1/timings?latitude=${lat}&longitude=${lng}&method=${method}`,
|
||||
{ signal: AbortSignal.timeout(8000) }
|
||||
)
|
||||
if (!res.ok) return NextResponse.json({ error: 'Prayer times unavailable' }, { status: 502 })
|
||||
const data = await res.json()
|
||||
const timings = data.data?.timings
|
||||
const date = data.data?.date
|
||||
|
||||
return NextResponse.json({
|
||||
timings: {
|
||||
Fajr: timings?.Fajr,
|
||||
Sunrise: timings?.Sunrise,
|
||||
Dhuhr: timings?.Dhuhr,
|
||||
Asr: timings?.Asr,
|
||||
Maghrib: timings?.Maghrib,
|
||||
Isha: timings?.Isha,
|
||||
},
|
||||
hijri: date?.hijri,
|
||||
gregorian: date?.gregorian,
|
||||
})
|
||||
} catch {
|
||||
return NextResponse.json({ error: 'Prayer times unavailable' }, { status: 502 })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user