-
Notifications
You must be signed in to change notification settings - Fork 3
Development #408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Development #408
Changes from all commits
6d29cc7
d7e4139
e0ed5d8
49b9bf9
f61e694
cdeb255
bdbc178
3b68136
b67ff9c
276f863
a2a43c1
f17b9ef
5c1a90a
21e18d4
6af39b2
f81e775
cc5b55c
0fc9633
bfcd885
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,62 @@ | ||||||||||||||||||||||||||||||||||||||||||
| 'use client' | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| import { useRouter } from "next/navigation" | ||||||||||||||||||||||||||||||||||||||||||
| import { FaDiscord, FaTelegram } from "react-icons/fa" | ||||||||||||||||||||||||||||||||||||||||||
| import { FaXTwitter } from "react-icons/fa6" | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| import { MODULE_CONTEXT } from "@/constants/ModuleContext" | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| export default function CommunityGuardianPage() { | ||||||||||||||||||||||||||||||||||||||||||
| const router = useRouter() | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| // TODO: rename to community-guardian | ||||||||||||||||||||||||||||||||||||||||||
| const data = MODULE_CONTEXT.find(module => module.name === 'violationDetection') | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| if (!data || data === undefined) { | ||||||||||||||||||||||||||||||||||||||||||
| router.push('/dashboard') | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+15
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix the redirect pattern to use useEffect The current redirect implementation has two issues:
Use the useEffect hook for the redirect: - if (!data || data === undefined) {
- router.push('/dashboard')
- }
+ useEffect(() => {
+ if (!data) {
+ router.push('/dashboard')
+ }
+ }, [data, router]);Don't forget to import useEffect: -import { useRouter } from "next/navigation"
+import { useEffect } from "react"
+import { useRouter } from "next/navigation"📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||
| <div className="flex flex-col gap-4"> | ||||||||||||||||||||||||||||||||||||||||||
| <div className="flex items-center gap-2"> | ||||||||||||||||||||||||||||||||||||||||||
| {data && <data.icon size={24} className="text-secondary" />} | ||||||||||||||||||||||||||||||||||||||||||
| <h1 className="text-2xl font-semibold">{data?.title}</h1> | ||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||
| <p className="text-md text-gray-400"> | ||||||||||||||||||||||||||||||||||||||||||
| Neutral, AI-powered Code of Conduct enforcement for safer, healthier communities. | ||||||||||||||||||||||||||||||||||||||||||
| </p> | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| <div className="flex flex-col gap-4 w-full md:w-1/2"> | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| <p className="text-sm leading-relaxed">Community Guardian helps maintain respectful and inclusive conversations by detecting potential Code of Conduct violations and flagging them early.</p> | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| <p className="text-sm leading-relaxed">This module is currently in beta and access is limited.</p> | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| <p className="text-sm leading-relaxed">We're working with selected communities to fine-tune detection, alerts, and recommendations. If you're interested in early access or want to learn more, reach out to us on:</p> | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| <ul className="flex flex-col gap-2 text-sm"> | ||||||||||||||||||||||||||||||||||||||||||
| <li className="w-fit"> | ||||||||||||||||||||||||||||||||||||||||||
| <a href="https://discord.gg/QNJGeZeT" target="_blank" className="text-blue-500 hover:text-blue-600 hover:underline flex items-center gap-2" rel="noreferrer"> | ||||||||||||||||||||||||||||||||||||||||||
| <FaDiscord /> | ||||||||||||||||||||||||||||||||||||||||||
| <span>Discord</span> | ||||||||||||||||||||||||||||||||||||||||||
| </a> | ||||||||||||||||||||||||||||||||||||||||||
| </li> | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+39
to
+43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainVerify the Discord link is current The Discord invite link appears to be a specific channel invitation. These links can expire - verify that this is a permanent invite link that won't break in the future. 🌐 Web query: 💡 Result: Discord invite links with the format "discord.gg/QNJGeZeT" do not have a single, fixed expiration rule—their validity depends on how the link was configured when it was generated. By default, most Discord invite links are set to expire after 7 days and have a limited number of uses, but both of these settings can be customized:
If a link is created with "Expire After = Never" and "Max Uses = No Limit," the invite will not expire automatically and will remain valid indefinitely, unless it is manually revoked by a server admin[1][2][5]. However, links can expire if:
It’s also worth noting that even links set to "never expire" have sometimes been reported to stop working due to Discord bugs or accidental revocation[3][7][9]. Summary Table
Conclusion: Citations:
Ensure the Discord invite link won’t expire
If it isn’t permanent, ask for or generate a non-expiring invite and update the link here:
|
||||||||||||||||||||||||||||||||||||||||||
| <li className="w-fit"> | ||||||||||||||||||||||||||||||||||||||||||
| <a href="https://x.com/together_crew" target="_blank" className="text-blue-500 hover:text-blue-600 hover:underline flex items-center gap-2" rel="noreferrer"> | ||||||||||||||||||||||||||||||||||||||||||
| <FaXTwitter /> | ||||||||||||||||||||||||||||||||||||||||||
| <span>Twitter</span> | ||||||||||||||||||||||||||||||||||||||||||
| </a> | ||||||||||||||||||||||||||||||||||||||||||
| </li> | ||||||||||||||||||||||||||||||||||||||||||
| <li className="w-fit"> | ||||||||||||||||||||||||||||||||||||||||||
| <a href="https://t.me/k_bc0" target="_blank" className="text-blue-500 hover:text-blue-600 hover:underline flex items-center gap-2" rel="noreferrer"> | ||||||||||||||||||||||||||||||||||||||||||
| <FaTelegram /> | ||||||||||||||||||||||||||||||||||||||||||
| <span>Telegram</span> | ||||||||||||||||||||||||||||||||||||||||||
| </a> | ||||||||||||||||||||||||||||||||||||||||||
| </li> | ||||||||||||||||||||||||||||||||||||||||||
| </ul> | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||
| </div > | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| "use client"; | ||
|
|
||
| import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; | ||
|
|
||
| import ProtectedRoute from "@/components/auth/ProtectedRoute"; | ||
| import DashboardLayout from "@/components/layouts/DashboardLayout"; | ||
|
|
||
| import { TokenProvider } from "@/context/TokenContext"; | ||
|
|
||
| const queryClient = new QueryClient(); | ||
|
|
||
| export default function RootLayout({ children }: { children: React.ReactNode }) { | ||
|
|
||
|
|
||
| return ( | ||
| <ProtectedRoute> | ||
| <QueryClientProvider client={queryClient}> | ||
| <TokenProvider> | ||
| <DashboardLayout> | ||
| {children} | ||
| </DashboardLayout> | ||
| </TokenProvider> | ||
| </QueryClientProvider> | ||
| </ProtectedRoute> | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| 'use client'; | ||
|
|
||
| import { FaHome } from "react-icons/fa"; | ||
|
|
||
| import SEO from "@/components/global/SEO"; | ||
| import ModuleList from "@/components/home/modules/ModuleList"; | ||
| import PlatformList from "@/components/home/platforms/PlatformList"; | ||
|
|
||
| export default function Page() { | ||
|
|
||
| return ( | ||
| <> | ||
| <SEO title="Home" /> | ||
| <div className="flex flex-col gap-6 sm:gap-8"> | ||
| <h1 className="text-2xl font-semibold flex items-center gap-2"> | ||
| <FaHome className="text-secondary" /> | ||
| <span>Home</span> | ||
| </h1> | ||
| {/* <OnlyAdminWarning /> */} | ||
| <div className="flex flex-col md:flex-row gap-6 md:gap-8"> | ||
| <div className="flex-1"> | ||
| <PlatformList /> | ||
| </div> | ||
| <div className="flex-1"> | ||
| <ModuleList /> | ||
| </div> | ||
| </div > | ||
| </div> | ||
|
|
||
| </ > | ||
| ); | ||
| } | ||
|
Comment on lines
+9
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainClean dashboard page layout with responsive design The dashboard page implementation provides a clean, responsive layout that properly integrates both platform and module lists. The use of Tailwind CSS classes for responsive behavior is well-executed. What is the purpose of the commented-out 🏁 Script executed: #!/bin/bash
# Search for OnlyAdminWarning component to understand its context and usage
rg "OnlyAdminWarning" -A 5 -B 5Length of output: 763 Remove or Implement the The commented-out
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import { Inter, Roboto_Mono } from 'next/font/google' | ||
|
|
||
| import "@/styles/globals.css"; | ||
|
|
||
| import { AuthProvider } from '@/context/AuthProvider'; | ||
|
|
||
| const inter = Inter({ | ||
| subsets: ['latin'], | ||
| display: 'swap', | ||
| variable: '--font-inter', | ||
| }) | ||
|
|
||
| const roboto_mono = Roboto_Mono({ | ||
| subsets: ['latin'], | ||
| display: 'swap', | ||
| variable: '--font-roboto-mono', | ||
| }) | ||
|
|
||
|
|
||
| export default function RootLayout({ children }: { children: React.ReactNode }) { | ||
| return ( | ||
| <html lang="en" data-theme="light"> | ||
| <body className={`${inter.variable} ${roboto_mono.variable} antialiased`}> | ||
| <AuthProvider> | ||
| <div className="flex min-h-screen bg-gray-100 overflow-y-hidden"> | ||
| {children} | ||
| </div> | ||
| </AuthProvider> | ||
| </body> | ||
| </html> | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { atomWithStorage } from "jotai/utils"; | ||
|
|
||
| type AuthStateType = { | ||
| accessToken: string | null; | ||
| refreshToken: string | null; | ||
| } | ||
|
|
||
| const defaultValue: AuthStateType = { | ||
| accessToken: null, | ||
| refreshToken: null, | ||
| } | ||
|
|
||
| // TODO: rename to authState | ||
| export const authState = atomWithStorage<AuthStateType>("TC_user", defaultValue); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { atomWithStorage } from "jotai/utils"; | ||
|
|
||
|
|
||
|
|
||
| export const uiAtom = atomWithStorage('ui', { | ||
| isSidebarOpen: false, | ||
| theme: 'light', | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import Image from 'next/image'; | ||
|
|
||
| import tcLogo from '../assets/svg/tc-logo.svg'; | ||
|
|
||
| export default function LoadingScreen() { | ||
| return ( | ||
| <div className="flex flex-col gap-4 h-screen w-screen items-center justify-center"> | ||
| <Image src={tcLogo} alt="Logo" width={100} height={100} /> | ||
| <div> | ||
| <span className="loading loading-infinity loading-lg"></span> | ||
| </div> | ||
| </div> | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { useEffect } from "react"; | ||
| import { useRouter } from "next/navigation"; | ||
|
|
||
| import { useAuth } from "@/context/AuthProvider"; | ||
|
|
||
| import LoadingScreen from "../LoadingScreen"; | ||
|
|
||
| export default function ProtectedRoute({ children }: { children: React.ReactNode }) { | ||
| const { isAuthenticated } = useAuth(); | ||
| const router = useRouter(); | ||
|
|
||
| useEffect(() => { | ||
| if (!isAuthenticated) { | ||
| router.push('/centric'); // TODO: change to /login | ||
| } | ||
| }, [isAuthenticated, router]); | ||
|
|
||
| if (!isAuthenticated) { | ||
| return <LoadingScreen />; | ||
| } | ||
|
|
||
| return children; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Address the TODO comment about renaming the module
There's a pending TODO about renaming 'violationDetection' to 'community-guardian'. This should be addressed to maintain consistency between the module name and URL path.
🏁 Script executed:
Length of output: 96
🏁 Script executed:
Length of output: 1577
Rename the dashboard module key to ‘community-guardian’
Please update the module name in both the context definition and the page lookup to match the URL path, and remove the outstanding TODO:
📝 Committable suggestion