Hide edit button cloudMode.

This commit is contained in:
Brian Cao 2023-08-17 21:25:12 -07:00
parent 530fc5dcd1
commit d3e175a31d
3 changed files with 21 additions and 4 deletions

View File

@ -9,7 +9,14 @@ import useUser from 'hooks/useUser';
import { ROLES } from 'lib/constants';
import { Button, Icon, Icons, Modal, ModalTrigger, Text, useToasts } from 'react-basics';
export function WebsitesList({ showTeam, showHeader = true, includeTeams, onlyTeams, fetch }) {
export function WebsitesList({
showTeam,
showEditButton = true,
showHeader = true,
includeTeams,
onlyTeams,
fetch,
}) {
const { formatMessage, labels, messages } = useMessages();
const { user } = useUser();
@ -59,6 +66,7 @@ export function WebsitesList({ showTeam, showHeader = true, includeTeams, onlyTe
<WebsitesTable
data={data}
showTeam={showTeam}
showEditButton={showEditButton}
onFilterChange={handleFilterChange}
onPageChange={handlePageChange}
onPageSizeChange={handlePageSizeChange}

View File

@ -13,6 +13,7 @@ export function WebsitesTable({
onPageChange,
onPageSizeChange,
showTeam,
showEditButton,
}) {
const { formatMessage, labels, messages } = useMessages();
const { openExternal } = useConfig();
@ -58,7 +59,7 @@ export function WebsitesTable({
return (
<>
{(!showTeam || ownerId === user.id) && (
{showEditButton && (!showTeam || ownerId === user.id) && (
<Link href={`/settings/websites/${id}`}>
<Button>
<Icon>

View File

@ -58,9 +58,17 @@ export function WebsitesPage() {
<Item key="team-webaites">{formatMessage(labels.teamWebsites)}</Item>
</Tabs>
{tab === 'my-websites' && <WebsiteList showHeader={false} fetch={fetch} />}
{tab === 'my-websites' && (
<WebsiteList showEditButton={!cloudMode} showHeader={false} fetch={fetch} />
)}
{tab === 'team-webaites' && (
<WebsiteList showHeader={false} fetch={fetch} showTeam={true} onlyTeams={true} />
<WebsiteList
showEditButton={!cloudMode}
showHeader={false}
fetch={fetch}
showTeam={true}
onlyTeams={true}
/>
)}
</Page>
);