Remove add buttons for cloud mode.

This commit is contained in:
Brian Cao 2023-08-16 13:56:12 -07:00
parent 38445fce7a
commit 0dfa6c120c
3 changed files with 20 additions and 18 deletions

View File

@ -3,11 +3,13 @@ import Page from 'components/layout/Page';
import PageHeader from 'components/layout/PageHeader';
import { useMessages, useReports } from 'hooks';
import Link from 'next/link';
import useConfig from 'hooks/useConfig';
import { Button, Icon, Icons, Text } from 'react-basics';
import ReportsTable from './ReportsTable';
export function ReportsPage() {
const { formatMessage, labels, messages } = useMessages();
const { cloudMode } = useConfig();
const {
reports,
error,
@ -21,21 +23,19 @@ export function ReportsPage() {
const hasData = (reports && reports?.data.length !== 0) || filter;
const handleDelete = async id => {
await deleteReport(id);
};
return (
<Page loading={isLoading} error={error}>
<PageHeader title={formatMessage(labels.reports)}>
<Link href="/reports/create">
<Button variant="primary">
<Icon>
<Icons.Plus />
</Icon>
<Text>{formatMessage(labels.createReport)}</Text>
</Button>
</Link>
{!cloudMode && (
<Link href="/reports/create">
<Button variant="primary">
<Icon>
<Icons.Plus />
</Icon>
<Text>{formatMessage(labels.createReport)}</Text>
</Button>
</Link>
)}
</PageHeader>
{hasData && (

View File

@ -1,18 +1,18 @@
import { Button, Icon, Text, Modal, ModalTrigger, useToasts, Icons } from 'react-basics';
import Page from 'components/layout/Page';
import PageHeader from 'components/layout/PageHeader';
import EmptyPlaceholder from 'components/common/EmptyPlaceholder';
import WebsiteAddForm from 'components/pages/settings/websites/WebsiteAddForm';
import WebsitesTable from 'components/pages/settings/websites/WebsitesTable';
import useApi from 'hooks/useApi';
import useUser from 'hooks/useUser';
import useMessages from 'hooks/useMessages';
import { ROLES } from 'lib/constants';
import useApiFilter from 'hooks/useApiFilter';
import useMessages from 'hooks/useMessages';
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 }) {
const { formatMessage, labels, messages } = useMessages();
const { user } = useUser();
const { filter, page, pageSize, handleFilterChange, handlePageChange, handlePageSizeChange } =
useApiFilter();
const { get, useQuery } = useApi();

View File

@ -4,6 +4,7 @@ import WebsiteAddForm from 'components/pages/settings/websites/WebsiteAddForm';
import WebsiteList from 'components/pages/settings/websites/WebsitesList';
import { useMessages } from 'hooks';
import useUser from 'hooks/useUser';
import useConfig from 'hooks/useConfig';
import { ROLES } from 'lib/constants';
import { useState } from 'react';
import {
@ -23,6 +24,7 @@ export function WebsitesPage() {
const [tab, setTab] = useState('my-websites');
const [fetch, setFetch] = useState(1);
const { user } = useUser();
const { cloudMode } = useConfig();
const { showToast } = useToasts();
const handleSave = async () => {
@ -50,7 +52,7 @@ export function WebsitesPage() {
return (
<Page>
<PageHeader title={formatMessage(labels.websites)}>{addButton}</PageHeader>
<PageHeader title={formatMessage(labels.websites)}>{!cloudMode && addButton}</PageHeader>
<Tabs selectedKey={tab} onSelect={setTab} style={{ marginBottom: 30 }}>
<Item key="my-websites">{formatMessage(labels.myWebsites)}</Item>
<Item key="team-webaites">{formatMessage(labels.teamWebsites)}</Item>