From 860b6a138fafd4026fc2ce98a9b7af7f5998de6b Mon Sep 17 00:00:00 2001 From: Danish Arora Date: Fri, 5 Sep 2025 17:03:24 +0530 Subject: [PATCH] feat: admin can view moderated content --- src/App.tsx | 27 ++++---- src/components/CellList.tsx | 3 + src/components/FeedSidebar.tsx | 31 ++++++--- src/components/PostDetail.tsx | 2 +- src/components/ui/moderation-toggle.tsx | 46 ++++++++++++++ src/contexts/ModerationContext.tsx | 83 +++++++++++++++++++++++++ src/hooks/core/useForumData.ts | 63 +++++++++++++++++++ src/hooks/derived/useCellPosts.ts | 8 ++- src/hooks/derived/usePostComments.ts | 8 ++- src/pages/FeedPage.tsx | 25 +++----- 10 files changed, 259 insertions(+), 37 deletions(-) create mode 100644 src/components/ui/moderation-toggle.tsx create mode 100644 src/contexts/ModerationContext.tsx diff --git a/src/App.tsx b/src/App.tsx index 5f8b7f5..6af3a66 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -18,6 +18,7 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'; import { AuthProvider } from '@/contexts/AuthContext'; import { ForumProvider } from '@/contexts/ForumContext'; +import { ModerationProvider } from '@/contexts/ModerationContext'; import CellPage from './pages/CellPage'; import PostPage from './pages/PostPage'; import NotFound from './pages/NotFound'; @@ -39,18 +40,20 @@ const App = () => ( - - - - - } /> - } /> - } /> - } /> - } /> - } /> - - + + + + + + } /> + } /> + } /> + } /> + } /> + } /> + + + diff --git a/src/components/CellList.tsx b/src/components/CellList.tsx index 2747278..812b9a3 100644 --- a/src/components/CellList.tsx +++ b/src/components/CellList.tsx @@ -20,6 +20,7 @@ import { } from '@/components/ui/select'; import { CypherImage } from './ui/CypherImage'; import { RelevanceIndicator } from './ui/relevance-indicator'; +import { ModerationToggle } from './ui/moderation-toggle'; import { sortCells, SortOption } from '@/lib/utils/sorting'; import { Cell } from '@/types/forum'; import { usePending } from '@/hooks/usePending'; @@ -121,6 +122,8 @@ const CellList = () => {
+ + setSortOption(value)}