From cac15b55ae39dc4f09cf2065b3a6fc2125a2f9c6 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Sun, 4 Feb 2024 20:17:05 -0800 Subject: [PATCH] Fixed component build. --- .../settings/teams/[teamId]/TeamSettings.tsx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/app/(main)/settings/teams/[teamId]/TeamSettings.tsx b/src/app/(main)/settings/teams/[teamId]/TeamSettings.tsx index d3463bbf..9ebfc973 100644 --- a/src/app/(main)/settings/teams/[teamId]/TeamSettings.tsx +++ b/src/app/(main)/settings/teams/[teamId]/TeamSettings.tsx @@ -1,26 +1,23 @@ 'use client'; -import { useState } from 'react'; -import { Item, Loading, Tabs, Flexbox, Text, Icon } from 'react-basics'; +import { useContext, useState } from 'react'; +import { Item, Tabs, Flexbox, Text, Icon } from 'react-basics'; import PageHeader from 'components/layout/PageHeader'; import { ROLES } from 'lib/constants'; import Icons from 'components/icons'; -import { useLogin, useTeam, useMessages } from 'components/hooks'; +import { useLogin, useMessages } from 'components/hooks'; import TeamEditForm from './TeamEditForm'; import TeamMembers from './TeamMembers'; import TeamWebsites from './TeamWebsites'; import TeamData from './TeamData'; import LinkButton from 'components/common/LinkButton'; +import { TeamContext } from 'app/(main)/teams/[teamId]/TeamProvider'; export function TeamSettings({ teamId }: { teamId: string }) { + const team = useContext(TeamContext); const { formatMessage, labels } = useMessages(); const { user } = useLogin(); - const { data: team, isLoading } = useTeam(teamId); const [tab, setTab] = useState('details'); - if (isLoading) { - return ; - } - const canEdit = team?.teamUser?.find( ({ userId, role }) => role === ROLES.teamOwner && userId === user.id, ); @@ -41,7 +38,7 @@ export function TeamSettings({ teamId }: { teamId: string }) { {formatMessage(labels.websites)} {formatMessage(labels.data)} - {tab === 'details' && } + {tab === 'details' && } {tab === 'members' && } {tab === 'websites' && } {canEdit && tab === 'data' && }