11import { getProjects } from "@/api/projects" ;
2- import { getTeams } from "@/api/team" ;
2+ import { getTeamBySlug , getTeams } from "@/api/team" ;
33import { AppFooter } from "@/components/blocks/app-footer" ;
4+ import { Button } from "@/components/ui/button" ;
45import { TabPathLinks } from "@/components/ui/tabs" ;
56import { getClientThirdwebClient } from "@/constants/thirdweb-client.client" ;
67import { AnnouncementBanner } from "components/notices/AnnouncementBanner" ;
8+ import Link from "next/link" ;
79import { redirect } from "next/navigation" ;
810import { siwaExamplePrompts } from "../../../(dashboard)/support/page" ;
911import { CustomChatButton } from "../../../../nebula-app/(app)/components/CustomChat/CustomChatButton" ;
@@ -20,25 +22,18 @@ export default async function TeamLayout(props: {
2022} ) {
2123 const params = await props . params ;
2224
23- const [ accountAddress , account , teams , authToken ] = await Promise . all ( [
25+ const [ accountAddress , account , teams , authToken , team ] = await Promise . all ( [
2426 getAuthTokenWalletAddress ( ) ,
2527 getValidAccount ( `/team/${ params . team_slug } ` ) ,
2628 getTeams ( ) ,
2729 getAuthToken ( ) ,
30+ getTeamBySlug ( params . team_slug ) ,
2831 ] ) ;
2932
30- if ( ! teams || ! accountAddress || ! authToken ) {
33+ if ( ! teams || ! accountAddress || ! authToken || ! team ) {
3134 redirect ( "/login" ) ;
3235 }
3336
34- const team = teams . find (
35- ( t ) => t . slug === decodeURIComponent ( params . team_slug ) ,
36- ) ;
37-
38- if ( ! team ) {
39- redirect ( "/team" ) ;
40- }
41-
4237 const teamsAndProjects = await Promise . all (
4338 teams . map ( async ( team ) => ( {
4439 team,
@@ -53,6 +48,21 @@ export default async function TeamLayout(props: {
5348
5449 return (
5550 < div className = "flex h-full grow flex-col" >
51+ { ! teams . some ( ( t ) => t . slug === team . slug ) && (
52+ < div className = "bg-warning-text" >
53+ < div className = "container flex items-center justify-between py-4" >
54+ < div className = "flex flex-col gap-2" >
55+ < p className = "font-bold text-white text-xl" > 👀 STAFF MODE 👀</ p >
56+ < p className = "text-sm text-white" >
57+ You can only view this team, not take any actions.
58+ </ p >
59+ </ div >
60+ < Button variant = "default" asChild >
61+ < Link href = "/team/~" > Leave Staff Mode</ Link >
62+ </ Button >
63+ </ div >
64+ </ div >
65+ ) }
5666 < AnnouncementBanner />
5767 < div className = "bg-card" >
5868 < TeamHeaderLoggedIn
0 commit comments