Skip to content

Commit 21d225a

Browse files
authored
chore: add team check (langwatch#600)
* add team check * add public
1 parent ee41980 commit 21d225a

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

langwatch/src/components/DashboardLayout.tsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
Text,
1212
VStack,
1313
Progress,
14-
Link,
1514
type StackProps,
1615
} from "@chakra-ui/react";
1716
import { type Organization, type Project, type Team } from "@prisma/client";
@@ -46,6 +45,7 @@ import { ProjectTechStackIcon } from "./TechStack";
4645
import { ChecklistIcon } from "./icons/Checklist";
4746
import { useColorRawValue } from "./ui/color-mode";
4847
import { InputGroup } from "./ui/input-group";
48+
import { Link } from "./ui/link";
4949
import { Menu } from "./ui/menu";
5050
import { Popover } from "./ui/popover";
5151
import { Tooltip } from "./ui/tooltip";
@@ -320,6 +320,8 @@ export const DashboardLayout = ({
320320

321321
const user = session?.user;
322322
const currentRoute = findCurrentRoute(router.pathname);
323+
const userIsPartOfTeam =
324+
publicPage || team?.members.some((member) => member.userId === user?.id);
323325

324326
return (
325327
<HStack
@@ -651,7 +653,24 @@ export const DashboardLayout = ({
651653
</HStack>
652654
)}
653655
<CurrentDrawer />
654-
{children}
656+
{userIsPartOfTeam ? (
657+
children
658+
) : (
659+
<Alert.Root
660+
status="warning"
661+
width="full"
662+
borderBottom="1px solid"
663+
borderBottomColor="yellow.300"
664+
>
665+
<Alert.Indicator />
666+
<Alert.Content>
667+
<Text>
668+
You are not part of any team in this organization, please ask
669+
your administrator to add you to a team.
670+
</Text>
671+
</Alert.Content>
672+
</Alert.Root>
673+
)}
655674
</VStack>
656675
</HStack>
657676
);

0 commit comments

Comments
 (0)