1
1
import { getProjects } from "@/api/projects" ;
2
- import { getTeams } from "@/api/team" ;
2
+ import { getTeamBySlug , getTeams } from "@/api/team" ;
3
3
import { AppFooter } from "@/components/blocks/app-footer" ;
4
+ import { Button } from "@/components/ui/button" ;
4
5
import { TabPathLinks } from "@/components/ui/tabs" ;
5
6
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client" ;
6
7
import { AnnouncementBanner } from "components/notices/AnnouncementBanner" ;
8
+ import Link from "next/link" ;
7
9
import { redirect } from "next/navigation" ;
8
10
import { siwaExamplePrompts } from "../../../(dashboard)/support/page" ;
9
11
import { CustomChatButton } from "../../../../nebula-app/(app)/components/CustomChat/CustomChatButton" ;
@@ -20,25 +22,18 @@ export default async function TeamLayout(props: {
20
22
} ) {
21
23
const params = await props . params ;
22
24
23
- const [ accountAddress , account , teams , authToken ] = await Promise . all ( [
25
+ const [ accountAddress , account , teams , authToken , team ] = await Promise . all ( [
24
26
getAuthTokenWalletAddress ( ) ,
25
27
getValidAccount ( `/team/${ params . team_slug } ` ) ,
26
28
getTeams ( ) ,
27
29
getAuthToken ( ) ,
30
+ getTeamBySlug ( params . team_slug ) ,
28
31
] ) ;
29
32
30
- if ( ! teams || ! accountAddress || ! authToken ) {
33
+ if ( ! teams || ! accountAddress || ! authToken || ! team ) {
31
34
redirect ( "/login" ) ;
32
35
}
33
36
34
- const team = teams . find (
35
- ( t ) => t . slug === decodeURIComponent ( params . team_slug ) ,
36
- ) ;
37
-
38
- if ( ! team ) {
39
- redirect ( "/team" ) ;
40
- }
41
-
42
37
const teamsAndProjects = await Promise . all (
43
38
teams . map ( async ( team ) => ( {
44
39
team,
@@ -53,6 +48,21 @@ export default async function TeamLayout(props: {
53
48
54
49
return (
55
50
< 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
+ ) }
56
66
< AnnouncementBanner />
57
67
< div className = "bg-card" >
58
68
< TeamHeaderLoggedIn
0 commit comments