diff --git a/messages/ar.json b/messages/ar.json index 87e40baa..b7b34350 100644 --- a/messages/ar.json +++ b/messages/ar.json @@ -32,6 +32,7 @@ }, "nav": { "home": "الرئيسية", + "feed": "الخلاصة", "promptmasters": "Promptmasters", "prompts": "الأوامر", "categories": "التصنيفات", diff --git a/messages/en.json b/messages/en.json index e50a62ec..f48b81ef 100644 --- a/messages/en.json +++ b/messages/en.json @@ -32,6 +32,7 @@ }, "nav": { "home": "Home", + "feed": "Feed", "promptmasters": "Promptmasters", "prompts": "Prompts", "categories": "Categories", diff --git a/messages/es.json b/messages/es.json index eda121aa..672e5af2 100644 --- a/messages/es.json +++ b/messages/es.json @@ -32,6 +32,7 @@ }, "nav": { "home": "Inicio", + "feed": "Feed", "promptmasters": "Promptmasters", "prompts": "Prompts", "categories": "Categorías", diff --git a/messages/ja.json b/messages/ja.json index 2bdc8894..453f49b6 100644 --- a/messages/ja.json +++ b/messages/ja.json @@ -32,6 +32,7 @@ }, "nav": { "home": "ホーム", + "feed": "フィード", "promptmasters": "Promptmasters", "prompts": "プロンプト", "categories": "カテゴリー", diff --git a/messages/tr.json b/messages/tr.json index e0b0ca39..f1cd9ead 100644 --- a/messages/tr.json +++ b/messages/tr.json @@ -32,6 +32,7 @@ }, "nav": { "home": "Ana Sayfa", + "feed": "Akış", "promptmasters": "Promptmasters", "prompts": "Promptlar", "categories": "Kategoriler", diff --git a/messages/zh.json b/messages/zh.json index 56bc2ee9..35bc46a6 100644 --- a/messages/zh.json +++ b/messages/zh.json @@ -32,6 +32,7 @@ }, "nav": { "home": "首页", + "feed": "动态", "promptmasters": "Promptmasters", "prompts": "提示词", "categories": "分类", diff --git a/prompts.config.ts b/prompts.config.ts index 58e9fb3d..2582f8e2 100644 --- a/prompts.config.ts +++ b/prompts.config.ts @@ -1,5 +1,8 @@ import { defineConfig } from "@/lib/config"; +// Set to true to use clone branding (hide prompts.chat repo branding) +const useCloneBranding = false; + export default defineConfig({ // Branding - customize for white-label branding: { @@ -60,11 +63,13 @@ export default defineConfig({ // Homepage customization homepage: { + // Set to true to hide prompts.chat repo branding and use your own branding + useCloneBranding, achievements: { - enabled: true, + enabled: !useCloneBranding, }, sponsors: { - enabled: true, + enabled: !useCloneBranding, items: [ // Add sponsors here { name: "Clemta", logo: "https://clemta.com/wp-content/uploads/2023/03/logo-clemta-com-1.png.webp", url: "https://clemta.com" }, diff --git a/src/app/feed/page.tsx b/src/app/feed/page.tsx new file mode 100644 index 00000000..bea84205 --- /dev/null +++ b/src/app/feed/page.tsx @@ -0,0 +1,160 @@ +import Link from "next/link"; +import { redirect } from "next/navigation"; +import { getTranslations } from "next-intl/server"; +import { ArrowRight, Bell, FolderOpen, Sparkles } from "lucide-react"; +import { auth } from "@/lib/auth"; +import { db } from "@/lib/db"; +import { Button } from "@/components/ui/button"; +import { Badge } from "@/components/ui/badge"; +import { PromptList } from "@/components/prompts/prompt-list"; + +export default async function FeedPage() { + const t = await getTranslations("feed"); + const session = await auth(); + + // Redirect to login if not authenticated + if (!session?.user) { + redirect("/login"); + } + + // Get user's subscribed categories + const subscriptions = await db.categorySubscription.findMany({ + where: { userId: session.user.id }, + include: { + category: { + select: { + id: true, + name: true, + slug: true, + }, + }, + }, + }); + + const subscribedCategoryIds = subscriptions.map((s) => s.categoryId); + + // Fetch prompts from subscribed categories + const promptsRaw = subscribedCategoryIds.length > 0 + ? await db.prompt.findMany({ + where: { + isPrivate: false, + categoryId: { in: subscribedCategoryIds }, + }, + orderBy: { createdAt: "desc" }, + take: 30, + include: { + author: { + select: { + id: true, + name: true, + username: true, + avatar: true, + }, + }, + category: { + select: { + id: true, + name: true, + slug: true, + }, + }, + tags: { + include: { + tag: true, + }, + }, + _count: { + select: { votes: true, contributors: true }, + }, + }, + }) + : []; + + const prompts = promptsRaw.map((p) => ({ + ...p, + voteCount: p._count?.votes ?? 0, + contributorCount: p._count?.contributors ?? 0, + })); + + // Get all categories for subscription + const categories = await db.category.findMany({ + orderBy: { name: "asc" }, + include: { + _count: { + select: { prompts: true }, + }, + }, + }); + + return ( +
+ {t("feedDescription")} +
++ {t("subscribeToCategories")} +
+ + {/* Category suggestions */} +