Skip to content

Commit 9009566

Browse files
committed
chore: release v1.0.5 - Admin UI refinements and Spiritual Inquiry rebranding
1 parent 876faa7 commit 9009566

40 files changed

Lines changed: 1686 additions & 85 deletions

web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "web",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"private": true,
55
"scripts": {
66
"dev": "next dev",

web/prisma.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ export default defineConfig({
88
path: "prisma/migrations",
99
},
1010
datasource: {
11-
url: process.env["POSTGRES_PRISMA_URL"] || process.env["DATABASE_URL"] || process.env["DATABASE_URL_UNPOOLED"],
11+
url: (() => {
12+
const url = process.env["POSTGRES_PRISMA_URL"] || process.env["DATABASE_URL"] || process.env["DATABASE_URL_UNPOOLED"];
13+
console.log('Prisma Config URL:', url ? url.substring(0, 30) + '...' : 'NONE');
14+
return url;
15+
})(),
1216
},
1317
});

web/prisma/schema.prisma

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
// This is your Prisma schema file,
2-
// learn more about it in the docs: https://pris.ly/d/prisma-schema
3-
4-
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
5-
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
6-
71
generator client {
82
provider = "prisma-client-js"
93
}
@@ -17,35 +11,74 @@ model User {
1711
email String @unique
1812
name String?
1913
image String?
20-
tickets Ticket[]
2114
createdAt DateTime @default(now())
2215
updatedAt DateTime @updatedAt
16+
tickets Ticket[]
2317
}
2418

2519
model Ticket {
2620
id String @id @default(cuid())
2721
subject String
2822
status Status @default(OPEN)
2923
userId String
30-
user User @relation(fields: [userId], references: [id])
31-
messages Message[]
3224
createdAt DateTime @default(now())
3325
updatedAt DateTime @updatedAt
26+
messages Message[]
27+
user User @relation(fields: [userId], references: [id])
3428
3529
@@index([userId])
3630
}
3731

3832
model Message {
3933
id String @id @default(cuid())
40-
text String @db.Text
34+
text String
4135
sender Sender
4236
ticketId String
43-
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
4437
createdAt DateTime @default(now())
38+
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
4539
4640
@@index([ticketId])
4741
}
4842

43+
model Leela {
44+
id String @id @default(cuid())
45+
orderId Int @default(0)
46+
title_english String
47+
title_hindi String
48+
chapter String?
49+
youtube_id String?
50+
description String
51+
keywords String[]
52+
social_tags String[]
53+
createdAt DateTime @default(now())
54+
updatedAt DateTime @updatedAt
55+
}
56+
57+
model Bodhakatha {
58+
id String @id @default(cuid())
59+
orderId Int @default(0)
60+
theme String
61+
title_english String
62+
title_hindi String
63+
description String
64+
youtube_id String?
65+
keywords String[]
66+
social_tags String[]
67+
createdAt DateTime @default(now())
68+
updatedAt DateTime @updatedAt
69+
}
70+
71+
model Glossary {
72+
id String @id @default(cuid())
73+
term String
74+
chapter String?
75+
definition_en String
76+
definition_es String?
77+
definition_hi String?
78+
createdAt DateTime @default(now())
79+
updatedAt DateTime @updatedAt
80+
}
81+
4982
enum Status {
5083
OPEN
5184
ANSWERED

web/public/version.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"version": "1.0.4",
3-
"buildTime": "2025-12-18T17:08:01.534Z"
2+
"version": "1.0.5",
3+
"buildTime": "2025-12-18T15:10:00.000Z"
44
}

web/src/actions/content.ts

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
2+
'use server';
3+
4+
import prisma from '@/lib/db';
5+
import { revalidatePath } from 'next/cache';
6+
import { isAdmin } from '@/lib/auth';
7+
8+
// Leela Actions
9+
export async function saveLeela(data: any) {
10+
if (!await isAdmin()) throw new Error('Unauthorized');
11+
const { id, ...rest } = data;
12+
if (id && id !== 'new') {
13+
await prisma.leela.update({
14+
where: { id },
15+
data: rest
16+
});
17+
} else {
18+
await prisma.leela.create({
19+
data: rest
20+
});
21+
}
22+
revalidatePath('/leela');
23+
revalidatePath('/admin/leela');
24+
}
25+
26+
export async function deleteLeela(id: string) {
27+
if (!await isAdmin()) throw new Error('Unauthorized');
28+
await prisma.leela.delete({ where: { id } });
29+
revalidatePath('/leela');
30+
revalidatePath('/admin/leela');
31+
}
32+
33+
// Bodhakatha Actions
34+
export async function saveBodhakatha(data: any) {
35+
if (!await isAdmin()) throw new Error('Unauthorized');
36+
const { id, ...rest } = data;
37+
if (id && id !== 'new') {
38+
await prisma.bodhakatha.update({
39+
where: { id },
40+
data: rest
41+
});
42+
} else {
43+
await prisma.bodhakatha.create({
44+
data: rest
45+
});
46+
}
47+
revalidatePath('/bodhakatha');
48+
revalidatePath('/admin/bodhakatha');
49+
}
50+
51+
export async function deleteBodhakatha(id: string) {
52+
if (!await isAdmin()) throw new Error('Unauthorized');
53+
await prisma.bodhakatha.delete({ where: { id } });
54+
revalidatePath('/bodhakatha');
55+
revalidatePath('/admin/bodhakatha');
56+
}
57+
58+
// Glossary Actions
59+
export async function saveGlossary(data: any) {
60+
if (!await isAdmin()) throw new Error('Unauthorized');
61+
const { id, ...rest } = data;
62+
if (id && id !== 'new') {
63+
await prisma.glossary.update({
64+
where: { id },
65+
data: rest
66+
});
67+
} else {
68+
await prisma.glossary.create({
69+
data: rest
70+
});
71+
}
72+
revalidatePath('/glossary');
73+
revalidatePath('/admin/glossary');
74+
}
75+
76+
export async function deleteGlossary(id: string) {
77+
if (!await isAdmin()) throw new Error('Unauthorized');
78+
await prisma.glossary.delete({ where: { id } });
79+
revalidatePath('/glossary');
80+
revalidatePath('/admin/glossary');
81+
}

web/src/actions/tickets.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,7 @@
33
import prisma from '@/lib/db';
44
import { revalidatePath } from 'next/cache';
55
import { currentUser } from '@clerk/nextjs/server';
6-
7-
const ADMIN_EMAILS = ['pavankumarpai@gmail.com', 'pavanpaik2025@gmail.com'];
8-
9-
async function isAdmin() {
10-
const clerkUser = await currentUser();
11-
const email = clerkUser?.emailAddresses[0]?.emailAddress;
12-
return !!email && ADMIN_EMAILS.includes(email);
13-
}
6+
import { isAdmin } from '@/lib/auth';
147

158
export async function getTickets() {
169
try {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export default function AskPage() {
125125
<div className="w-20 h-20 bg-gray-100 rounded-full flex items-center justify-center text-gray-400 mb-4">
126126
<MessageCircleQuestion className="w-10 h-10" />
127127
</div>
128-
<h1 className="text-3xl font-bold text-gray-800">Ask Krishnaji</h1>
128+
<h1 className="text-3xl font-bold text-gray-800">Spiritual Inquiry</h1>
129129
<p className="text-gray-500 text-lg">
130130
Sign in to seek personalized spiritual guidance and track your questions effectively.
131131
</p>

web/src/app/bodhakatha/[articleId]/page.tsx renamed to web/src/app/(main)/bodhakatha/[articleId]/page.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
1-
import bodhakathaArticles from '@/data/bodhakatha_articles.json';
1+
import prisma from '@/lib/db';
22
import ReferenceVideos from '@/components/features/ReferenceVideos';
33
import ChapterTextViewer from '@/components/features/ChapterTextViewer';
44

55
import { Metadata } from 'next';
66

77
// Server Component
88
export async function generateStaticParams() {
9-
return bodhakathaArticles.map((article) => ({
10-
articleId: article.id.toString(),
9+
const bodhakathas = await prisma.bodhakatha.findMany({
10+
select: { id: true }
11+
});
12+
return bodhakathas.map((article: { id: string }) => ({
13+
articleId: article.id,
1114
}));
1215
}
1316

1417
export async function generateMetadata({ params }: { params: Promise<{ articleId: string }> }): Promise<Metadata> {
1518
const { articleId } = await params;
16-
const article = bodhakathaArticles.find((c) => c.id.toString() === articleId);
19+
const article = await prisma.bodhakatha.findUnique({
20+
where: { id: articleId }
21+
});
1722

1823
if (!article) return { title: 'Article Not Found' };
1924

@@ -33,7 +38,9 @@ export async function generateMetadata({ params }: { params: Promise<{ articleId
3338

3439
export default async function BodhakathaDetailPage({ params }: { params: Promise<{ articleId: string }> }) {
3540
const { articleId } = await params;
36-
const article = bodhakathaArticles.find((c) => c.id.toString() === articleId);
41+
const article = await prisma.bodhakatha.findUnique({
42+
where: { id: articleId }
43+
});
3744

3845
if (!article) {
3946
return <div>Article not found</div>;
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import Link from 'next/link';
2-
import bodhakathaArticles from '@/data/bodhakatha_articles.json';
2+
import prisma from '@/lib/db';
33
import { Lightbulb } from 'lucide-react';
44

5-
export default function BodhakathaPage() {
5+
export default async function BodhakathaPage() {
6+
const bodhakathaArticles = await prisma.bodhakatha.findMany({
7+
orderBy: { orderId: 'asc' }
8+
});
9+
610
return (
711
<div className="max-w-4xl mx-auto space-y-6 pt-6 px-4">
812
<div className="flex items-center space-x-4 pb-2 border-b border-gray-100">
@@ -16,10 +20,10 @@ export default function BodhakathaPage() {
1620
</div>
1721

1822
<div className="grid gap-6">
19-
{bodhakathaArticles.map((article) => (
23+
{bodhakathaArticles.map((article: any) => (
2024
<Link
2125
key={article.id}
22-
href={`/bodhakatha/${article.id}`} // We'll reuse the same Detail view structure maybe? Or simple wrapper
26+
href={`/bodhakatha/${article.id}`}
2327
className="block p-6 bg-white rounded-lg shadow-sm border border-gray-100 hover:shadow-md hover:border-gold transition-all group"
2428
>
2529
<div className="flex flex-col gap-2">

0 commit comments

Comments
 (0)