feat: add news section with admin editor and public article view

- NewsSection with animated grid background, category filters, featured cards
- AdminNews list page with toggle publish/featured, pagination
- AdminNewsCreate with TipTap rich text editor, URL validation
- NewsArticle detail page with DOMPurify sanitization, Telegram back button
- Toggle component with WCAG 44px touch targets, role=switch
- Prose styles for highlight marks and responsive iframes
- i18n translations (en, ru, zh, fa)
This commit is contained in:
Fringg
2026-03-23 10:49:46 +03:00
parent 5b12784ab8
commit 99fc33625e
17 changed files with 7750 additions and 70 deletions

59
src/types/news.ts Normal file
View File

@@ -0,0 +1,59 @@
export interface NewsArticle {
id: number;
title: string;
slug: string;
content: string;
excerpt: string | null;
category: string;
category_color: string;
tag: string | null;
featured_image_url: string | null;
is_published: boolean;
is_featured: boolean;
published_at: string | null;
read_time_minutes: number;
views_count: number;
author_name?: string | null;
created_at: string;
updated_at: string | null;
}
export interface NewsListItem {
id: number;
title: string;
slug: string;
excerpt: string | null;
category: string;
category_color: string;
tag: string | null;
featured_image_url: string | null;
is_published: boolean;
is_featured: boolean;
published_at: string | null;
read_time_minutes: number;
views_count: number;
}
export interface NewsListResponse {
items: NewsListItem[];
total: number;
categories: string[];
}
export interface NewsCreateRequest {
title: string;
slug: string;
content: string;
excerpt: string | null;
category: string;
category_color: string;
tag: string | null;
featured_image_url: string | null;
is_published: boolean;
is_featured: boolean;
read_time_minutes: number;
}
export interface NewsUpdateRequest extends Partial<NewsCreateRequest> {
id?: never;
}