From 0bc1d790529cbc5dc5815b91f952ab99d3f1d97b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20Kadir=20Ak=C4=B1n?= Date: Fri, 12 Dec 2025 12:22:27 +0300 Subject: [PATCH] chore(i18n): Update language translations for feed page and navigation menus --- messages/ar.json | 1 + messages/en.json | 1 + messages/es.json | 1 + messages/ja.json | 1 + messages/tr.json | 1 + messages/zh.json | 1 + prompts.config.ts | 9 +- src/app/feed/page.tsx | 160 ++++++++++++++++ src/app/layout.tsx | 4 +- src/app/page.tsx | 314 ++++++++++--------------------- src/components/layout/header.tsx | 16 ++ src/i18n/request.ts | 1 + src/lib/config/index.ts | 2 + 13 files changed, 295 insertions(+), 217 deletions(-) create mode 100644 src/app/feed/page.tsx 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("yourFeed")}

+

+ {t("feedDescription")} +

+
+
+ + +
+
+ + {/* Subscribed Categories */} + {subscriptions.length > 0 && ( +
+ {subscriptions.map(({ category }) => ( + + + + {category.name} + + + ))} +
+ )} + + {/* Feed */} + {prompts.length > 0 ? ( + + ) : ( +
+ +

{t("noPromptsInFeed")}

+

+ {t("subscribeToCategories")} +

+ + {/* Category suggestions */} +
+ {categories.slice(0, 6).map((category) => ( + + + {category.name} + ({category._count.prompts}) + + + ))} +
+ +
+ +
+
+ )} +
+ ); +} diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 709bd08d..ef85df8f 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -94,7 +94,7 @@ export default async function RootLayout({ return ( - + {process.env.GOOGLE_ANALYTICS_ID && ( <>