1- import { getProjects } from "@/api/projects" ;
2- import { getTeams } from "@/api/team" ;
1+ import { getProject , getProjects } from "@/api/projects" ;
2+ import { getTeamBySlug , getTeams } from "@/api/team" ;
3+ import { Button } from "@/components/ui/button" ;
34import { SidebarProvider } from "@/components/ui/sidebar" ;
45import { getClientThirdwebClient } from "@/constants/thirdweb-client.client" ;
56import { AnnouncementBanner } from "components/notices/AnnouncementBanner" ;
7+ import Link from "next/link" ;
68import { redirect } from "next/navigation" ;
79import { siwaExamplePrompts } from "../../../../(dashboard)/support/page" ;
810import { CustomChatButton } from "../../../../../nebula-app/(app)/components/CustomChat/CustomChatButton" ;
@@ -21,21 +23,20 @@ export default async function ProjectLayout(props: {
2123 params : Promise < { team_slug : string ; project_slug : string } > ;
2224} ) {
2325 const params = await props . params ;
24- const [ accountAddress , teams , account , authToken ] = await Promise . all ( [
25- getAuthTokenWalletAddress ( ) ,
26- getTeams ( ) ,
27- getValidAccount ( `/team/${ params . team_slug } /${ params . project_slug } ` ) ,
28- getAuthToken ( ) ,
29- ] ) ;
26+ const [ accountAddress , teams , account , authToken , team , project ] =
27+ await Promise . all ( [
28+ getAuthTokenWalletAddress ( ) ,
29+ getTeams ( ) ,
30+ getValidAccount ( `/team/${ params . team_slug } /${ params . project_slug } ` ) ,
31+ getAuthToken ( ) ,
32+ getTeamBySlug ( params . team_slug ) ,
33+ getProject ( params . team_slug , params . project_slug ) ,
34+ ] ) ;
3035
3136 if ( ! teams || ! accountAddress || ! authToken ) {
3237 redirect ( "/login" ) ;
3338 }
3439
35- const team = teams . find (
36- ( t ) => t . slug === decodeURIComponent ( params . team_slug ) ,
37- ) ;
38-
3940 if ( ! team ) {
4041 redirect ( "/team" ) ;
4142 }
@@ -47,10 +48,6 @@ export default async function ProjectLayout(props: {
4748 } ) ) ,
4849 ) ;
4950
50- const project = teamsAndProjects
51- . find ( ( t ) => t . team . slug === decodeURIComponent ( params . team_slug ) )
52- ?. projects . find ( ( p ) => p . slug === params . project_slug ) ;
53-
5451 if ( ! project ) {
5552 // not a valid project, redirect back to team page
5653 redirect ( `/team/${ params . team_slug } ` ) ;
@@ -65,6 +62,21 @@ export default async function ProjectLayout(props: {
6562 return (
6663 < SidebarProvider >
6764 < div className = "flex h-dvh min-w-0 grow flex-col" >
65+ { ! teams . some ( ( t ) => t . slug === team . slug ) && (
66+ < div className = "bg-warning-text" >
67+ < div className = "container flex items-center justify-between py-4" >
68+ < div className = "flex flex-col gap-2" >
69+ < p className = "font-bold text-white text-xl" > 👀 STAFF MODE 👀</ p >
70+ < p className = "text-sm text-white" >
71+ You can only view this team, not take any actions.
72+ </ p >
73+ </ div >
74+ < Button variant = "default" asChild >
75+ < Link href = "/team/~" > Leave Staff Mode</ Link >
76+ </ Button >
77+ </ div >
78+ </ div >
79+ ) }
6880 < div className = "sticky top-0 z-10 border-border border-b bg-card" >
6981 < AnnouncementBanner />
7082 < TeamHeaderLoggedIn
0 commit comments