localization updates, terminal errors, etc
This commit is contained in:
@@ -2,6 +2,7 @@ import { pb, getPbImage } from "@/lib/pb";
|
||||
import { notFound } from "next/navigation";
|
||||
import Link from "next/link";
|
||||
import { ArrowLeft, Calendar, Clock, ShieldCheck } from "lucide-react";
|
||||
import { getDictionary } from "@/lib/dictionaries";
|
||||
|
||||
interface PBPost {
|
||||
id: string;
|
||||
@@ -21,12 +22,11 @@ interface Props {
|
||||
|
||||
export default async function BlogPostPage({ params }: Props) {
|
||||
const { lang, slug } = await params;
|
||||
const isRu = lang === "ru";
|
||||
const dict = await getDictionary(lang);
|
||||
|
||||
let post: PBPost;
|
||||
|
||||
try {
|
||||
// Ищем в соответствующей коллекции по слагу
|
||||
post = await pb
|
||||
.collection(`posts_${lang}`)
|
||||
.getFirstListItem<PBPost>(`slug = "${slug}" && published = true`, {
|
||||
@@ -38,7 +38,6 @@ export default async function BlogPostPage({ params }: Props) {
|
||||
return (
|
||||
<main className="min-h-screen pt-32 pb-20 bg-background">
|
||||
<div className="container mx-auto max-w-3xl px-4">
|
||||
{/* Хлебные крошки / Назад */}
|
||||
<Link
|
||||
href={`/${lang}/blog`}
|
||||
className="inline-flex items-center gap-2 text-sm font-mono text-muted-foreground hover:text-primary mb-12 transition-colors group"
|
||||
@@ -48,11 +47,10 @@ export default async function BlogPostPage({ params }: Props) {
|
||||
className="group-hover:-translate-x-1 transition-transform"
|
||||
/>
|
||||
<span className="opacity-50">root@netrunner:~#</span>
|
||||
<span>cd ../logs</span>
|
||||
<span>{dict.blog.backBtn}</span>
|
||||
</Link>
|
||||
|
||||
<article className="relative">
|
||||
{/* Обложка с неоновым свечением */}
|
||||
{post.image && (
|
||||
<div className="w-full h-[300px] md:h-[450px] rounded-3xl overflow-hidden mb-12 border border-border/50 shadow-2xl shadow-primary/10 relative">
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
@@ -65,21 +63,20 @@ export default async function BlogPostPage({ params }: Props) {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Шапка статьи */}
|
||||
<div className="flex flex-wrap items-center gap-6 text-[10px] font-mono text-primary mb-8 uppercase tracking-[0.2em]">
|
||||
<span className="flex items-center gap-2 px-3 py-1 bg-primary/10 rounded-full border border-primary/20">
|
||||
<Calendar size={12} />
|
||||
{new Date(post.created).toLocaleDateString(
|
||||
isRu ? "ru-RU" : "en-US",
|
||||
lang === "ru" ? "ru-RU" : "en-US",
|
||||
)}
|
||||
</span>
|
||||
<span className="flex items-center gap-2 text-muted-foreground">
|
||||
<Clock size={12} />
|
||||
{isRu ? "Чтение: 4 мин" : "Read: 4 min"}
|
||||
{dict.blog.readTime}
|
||||
</span>
|
||||
<span className="flex items-center gap-2 text-green-500/70">
|
||||
<ShieldCheck size={12} />
|
||||
{isRu ? "Проверено: Netrunner" : "Verified: Netrunner"}
|
||||
{dict.blog.verified}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -87,16 +84,14 @@ export default async function BlogPostPage({ params }: Props) {
|
||||
{post.title}
|
||||
</h1>
|
||||
|
||||
{/* Тело статьи с Tailwind Typography (prose) */}
|
||||
<div
|
||||
className="prose prose-invert prose-p:text-muted-foreground/90 prose-p:leading-relaxed prose-headings:text-foreground prose-headings:tracking-tighter prose-a:text-primary prose-strong:text-foreground prose-code:text-primary max-w-none text-lg selection:bg-primary/30"
|
||||
dangerouslySetInnerHTML={{ __html: post.content }}
|
||||
/>
|
||||
|
||||
{/* Футер статьи */}
|
||||
<div className="mt-20 pt-10 border-t border-border/30 flex justify-between items-center">
|
||||
<div className="text-[10px] font-mono text-muted-foreground/40 uppercase tracking-widest">
|
||||
End of transmission // node_th_01
|
||||
{dict.blog.endTransmission}
|
||||
</div>
|
||||
<div className="flex gap-4">
|
||||
<div className="w-2 h-2 bg-primary rounded-full animate-ping" />
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { pb } from "@/lib/pb";
|
||||
import Link from "next/link";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { getDictionary } from "@/lib/dictionaries";
|
||||
|
||||
// Типизация записи из PocketBase
|
||||
interface PBPost {
|
||||
id: string;
|
||||
title: string;
|
||||
@@ -19,7 +19,7 @@ interface Props {
|
||||
|
||||
export default async function BlogIndexPage({ params }: Props) {
|
||||
const { lang } = await params;
|
||||
const isRu = lang === "ru";
|
||||
const dict = await getDictionary(lang); // Подключаем словарь
|
||||
|
||||
let records: PBPost[] = [];
|
||||
|
||||
@@ -40,19 +40,17 @@ export default async function BlogIndexPage({ params }: Props) {
|
||||
variant="outline"
|
||||
className="mb-6 border-primary/30 text-primary uppercase tracking-widest"
|
||||
>
|
||||
{isRu ? "Архив терминала" : "Terminal Archive"}
|
||||
{dict.blog.archive}
|
||||
</Badge>
|
||||
|
||||
<h1 className="text-5xl md:text-6xl font-extrabold tracking-tighter mb-12">
|
||||
{isRu ? "Data Logs" : "System Logs"}
|
||||
{dict.blog.systemLogs}
|
||||
</h1>
|
||||
|
||||
{records.length === 0 ? (
|
||||
<div className="p-20 border border-dashed border-border/50 rounded-3xl text-center bg-card/10">
|
||||
<p className="text-muted-foreground font-mono italic">
|
||||
{isRu
|
||||
? "[Записи не найдены в этом секторе]"
|
||||
: "[No records found in this sector]"}
|
||||
{dict.blog.emptySector}
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
@@ -67,7 +65,7 @@ export default async function BlogIndexPage({ params }: Props) {
|
||||
<div className="text-xs text-primary font-mono mb-4 flex items-center gap-2">
|
||||
<span className="w-1.5 h-1.5 bg-primary rounded-full animate-pulse" />
|
||||
{new Date(post.created).toLocaleDateString(
|
||||
isRu ? "ru-RU" : "en-US",
|
||||
lang === "ru" ? "ru-RU" : "en-US",
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -80,7 +78,7 @@ export default async function BlogIndexPage({ params }: Props) {
|
||||
</p>
|
||||
|
||||
<div className="mt-8 pt-4 border-t border-border/30 text-xs font-bold uppercase tracking-widest text-primary/50 group-hover:text-primary transition-colors">
|
||||
{isRu ? "Дешифровать →" : "Decrypt entry →"}
|
||||
{dict.blog.decrypt}
|
||||
</div>
|
||||
</article>
|
||||
</Link>
|
||||
|
||||
Reference in New Issue
Block a user