Add news feature with CRUD operations and real-time notifications
- Implemented news management functionality, allowing admins to create, read, update, and delete news posts. - Introduced a new SignalR event for broadcasting news updates to all connected clients. - Updated API documentation to include new endpoints for news management. - Enhanced frontend with a dedicated news page and admin interface for managing news posts. - Added necessary localization for news-related terms in both Russian and English.
This commit is contained in:
+12
-5
@@ -23,6 +23,7 @@ SPA на **React 19 + Vite + TypeScript**. Общается с бэком по R
|
||||
| Формы | react-hook-form + zod |
|
||||
| Realtime | @microsoft/signalr |
|
||||
| QR-коды | qrcode.react (рендерит QR из готовой строки на клиенте) |
|
||||
| Markdown | react-markdown + remark-gfm (лента новостей; без rehype-raw — сырой HTML не рендерится) |
|
||||
| Типы API | openapi-typescript (`pnpm gen:api`) — генерирует `schema.gen.ts` для сверки; фичи импортируют руками написанный `shared/api/types.ts` |
|
||||
| i18n | react-i18next (RU + EN) |
|
||||
| Линт | oxlint (не ESLint) |
|
||||
@@ -44,19 +45,20 @@ frontend/
|
||||
index.css # Tailwind v4 (@import), без отдельной styles/-папки
|
||||
routes/ # файловый роутинг TanStack Router
|
||||
__root.tsx # шапка (лого, нав, переключатель языка/темы), Outlet
|
||||
index.tsx, login.tsx, register.tsx, dashboard.tsx, instructions.tsx, settings.tsx
|
||||
index.tsx, login.tsx, register.tsx, dashboard.tsx, instructions.tsx, news.tsx, settings.tsx
|
||||
admin.tsx # layout админки (вкладки) + Outlet
|
||||
admin/
|
||||
index.tsx, activation.tsx, users.tsx, roles.tsx, nodes.tsx, apps.tsx, audit.tsx
|
||||
index.tsx, activation.tsx, users.tsx, roles.tsx, nodes.tsx, apps.tsx, news.tsx, audit.tsx
|
||||
features/
|
||||
auth/ # api.ts, store.ts (zustand), guards.ts, LoginForm.tsx, RegisterForm.tsx
|
||||
activation/ # api.ts, ActivationGate.tsx (экран "запросить активацию")
|
||||
configs/ # api.ts, ConfigCard.tsx, CreateConfigDialog.tsx, SubscriptionCard.tsx
|
||||
apps/ # api.ts, AppsCatalog.tsx (для /instructions)
|
||||
news/ # api.ts, NewsFeed.tsx (для /news)
|
||||
telegram/ # api.ts, TelegramLoginButton.tsx
|
||||
settings/ # ChangePasswordForm.tsx, TelegramLinkCard.tsx, DeleteAccountSection.tsx
|
||||
admin/
|
||||
users/, roles/, activation/, nodes/, inbounds/, apps/, audit/, stats/ # api.ts + диалоги CRUD в каждой
|
||||
users/, roles/, activation/, nodes/, inbounds/, apps/, news/, audit/, stats/ # api.ts + диалоги CRUD в каждой
|
||||
theme/
|
||||
ThemeProvider.tsx # React Context + localStorage (`pnv-theme`), НЕ zustand
|
||||
shared/
|
||||
@@ -69,7 +71,7 @@ frontend/
|
||||
realtime/
|
||||
connection.ts, RealtimeProvider.tsx
|
||||
ui/
|
||||
button.tsx, input.tsx, label.tsx, card.tsx, dialog.tsx, select.tsx, badge.tsx,
|
||||
button.tsx, input.tsx, textarea.tsx, label.tsx, card.tsx, dialog.tsx, select.tsx, badge.tsx,
|
||||
progress.tsx, toast-store.tsx, toaster.tsx
|
||||
index.html
|
||||
vite.config.ts
|
||||
@@ -93,6 +95,10 @@ frontend/
|
||||
- **Страница инструкций** (`/instructions`): статичные шаги + каталог приложений (`GET /api/apps`),
|
||||
сгруппированный по ОС и показан вкладками (по одной ОС за раз); клик по приложению открывает
|
||||
ссылку на скачивание.
|
||||
- **Лента новостей** (`/news`): хронологический список постов админа (заголовок + Markdown-тело,
|
||||
рендерится через `react-markdown` + `remark-gfm`), пагинация (`GET /api/news`), живое обновление
|
||||
по SignalR (`newsPublished`, широковещательно всем). Админка (`/admin/news`): CRUD, обычный
|
||||
`<textarea>` с переключателем предпросмотра Markdown вместо WYSIWYG-редактора.
|
||||
- **Настройки** (`/settings`): смена пароля, привязка/отвязка Telegram (`TelegramLinkCard`),
|
||||
удаление аккаунта с подтверждением (`DeleteAccountSection`).
|
||||
- **Админка** (`/admin/*`): вкладки — обзор (карточки статистики, без графиков), запросы активации,
|
||||
@@ -132,7 +138,8 @@ frontend/
|
||||
|
||||
- Одно SignalR-подключение к `/hubs/panel` с JWT (`RealtimeProvider`, `shared/realtime/connection.ts`).
|
||||
- Обработчики `configTrafficUpdated`/`configStatusChanged`/`nodeStatusChanged`/`activationRequested`/
|
||||
`userActivated` точечно инвалидируют/обновляют кэш TanStack Query — UI обновляется без перезагрузки.
|
||||
`userActivated`/`newsPublished` точечно инвалидируют/обновляют кэш TanStack Query — UI обновляется
|
||||
без перезагрузки.
|
||||
|
||||
## Скрипты
|
||||
|
||||
|
||||
Reference in New Issue
Block a user