Updated team and websites tables.

This commit is contained in:
Mike Cao 2024-02-04 21:27:12 -08:00
parent 1a9501d8ce
commit 36f207c97d
2 changed files with 25 additions and 15 deletions

View File

@ -5,7 +5,15 @@ import Icons from 'components/icons';
import { ROLES } from 'lib/constants'; import { ROLES } from 'lib/constants';
import LinkButton from 'components/common/LinkButton'; import LinkButton from 'components/common/LinkButton';
export function TeamsTable({ data = [] }: { data: any[] }) { export function TeamsTable({
data = [],
allowEdit = true,
showActions = true,
}: {
data: any[];
allowEdit?: boolean;
showActions?: boolean;
}) {
const { formatMessage, labels } = useMessages(); const { formatMessage, labels } = useMessages();
const { user } = useLogin(); const { user } = useLogin();
const breakpoint = useBreakpoint(); const breakpoint = useBreakpoint();
@ -29,9 +37,10 @@ export function TeamsTable({ data = [] }: { data: any[] }) {
const isOwner = user.id === owner?.userId; const isOwner = user.id === owner?.userId;
return ( return (
showActions && (
<> <>
{isOwner && ( {allowEdit && isOwner && (
<LinkButton href={`/settings/teams/${id}`}> <LinkButton href={`/teams/${id}/settings`}>
<Icon> <Icon>
<Icons.Edit /> <Icons.Edit />
</Icon> </Icon>
@ -45,6 +54,7 @@ export function TeamsTable({ data = [] }: { data: any[] }) {
<Text>{formatMessage(labels.switch)}</Text> <Text>{formatMessage(labels.switch)}</Text>
</LinkButton> </LinkButton>
</> </>
)
); );
}} }}
</GridColumn> </GridColumn>

View File

@ -46,7 +46,7 @@ export function WebsitesTable({
</LinkButton> </LinkButton>
)} )}
{allowView && ( {allowView && (
<LinkButton href={renderTeamUrl(renderTeamUrl(`/websites/${websiteId}`))}> <LinkButton href={renderTeamUrl(`/websites/${websiteId}`)}>
<Icon> <Icon>
<Icons.ArrowRight /> <Icons.ArrowRight />
</Icon> </Icon>