Files
PnvPanel/frontend/src/routes/news.tsx
T
Leonid Pershin 7f9a441050
CI / Backend (build + test) (push) Successful in 1m18s
CI / Frontend (lint + typecheck + build) (push) Successful in 32s
Implement activation requirement for protected routes
- Added a new `useRequireActivated` hook to enforce user activation before accessing certain routes, redirecting unauthenticated users to the login page and inactive users to the dashboard.
- Updated the `InstructionsPage` and `NewsPage` components to utilize the new activation check, enhancing user flow and security.
- Conditional rendering of navigation links in the `RootLayout` based on user activation status, improving user experience by hiding inaccessible features.
2026-07-13 18:36:14 +03:00

23 lines
654 B
TypeScript

import { createFileRoute } from '@tanstack/react-router'
import { useTranslation } from 'react-i18next'
import { useRequireActivated } from '@/features/auth/guards'
import { NewsFeed } from '@/features/news/NewsFeed'
export const Route = createFileRoute('/news')({ component: NewsPage })
function NewsPage() {
const { t } = useTranslation()
const { isReady } = useRequireActivated()
if (!isReady) return null
return (
<div className="mx-auto flex w-full max-w-4xl flex-col gap-8 px-6 py-10">
<div>
<h1 className="text-2xl font-semibold tracking-tight">{t('news.title')}</h1>
</div>
<NewsFeed />
</div>
)
}