refactor: move website component into folder
This commit is contained in:
parent
40719094aa
commit
162bec86d5
@ -1,4 +1,4 @@
|
||||
import React, { useState } from 'react';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { Button, DatePicker, Dropdown, MenuProps, Modal, Space } from 'antd';
|
||||
import { Dayjs } from 'dayjs';
|
||||
import { DownOutlined } from '@ant-design/icons';
|
||||
@ -19,7 +19,8 @@ export const DateFilter: React.FC<DateFilterProps> = React.memo((props) => {
|
||||
const { label, startDate, endDate } = useGlobalRangeDate();
|
||||
const [range, setRange] = useState<[Dayjs, Dayjs]>([startDate, endDate]);
|
||||
|
||||
const menu: MenuProps = {
|
||||
const menu: MenuProps = useMemo(
|
||||
() => ({
|
||||
onClick: () => {
|
||||
setShowDropdown(false);
|
||||
},
|
||||
@ -94,7 +95,9 @@ export const DateFilter: React.FC<DateFilterProps> = React.memo((props) => {
|
||||
},
|
||||
},
|
||||
] as MenuProps['items']),
|
||||
};
|
||||
}),
|
||||
[]
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Tag } from 'antd';
|
||||
import React from 'react';
|
||||
import { formatNumber } from '../utils/common';
|
||||
import { formatNumber } from '../../utils/common';
|
||||
|
||||
interface MetricCardProps {
|
||||
value?: number;
|
@ -1,21 +1,21 @@
|
||||
import { Button, Form, Input, message, Popconfirm, Tabs } from 'antd';
|
||||
import React from 'react';
|
||||
import { useNavigate, useParams } from 'react-router';
|
||||
import { deleteWorkspaceWebsite } from '../api/model/website';
|
||||
import { useRequest } from '../hooks/useRequest';
|
||||
import { useCurrentWorkspaceId } from '../store/user';
|
||||
import { ErrorTip } from './ErrorTip';
|
||||
import { Loading } from './Loading';
|
||||
import { NoWorkspaceTip } from './NoWorkspaceTip';
|
||||
import { MonitorPicker } from './monitor/MonitorPicker';
|
||||
import { deleteWorkspaceWebsite } from '../../api/model/website';
|
||||
import { useRequest } from '../../hooks/useRequest';
|
||||
import { useCurrentWorkspaceId } from '../../store/user';
|
||||
import { ErrorTip } from '../ErrorTip';
|
||||
import { Loading } from '../Loading';
|
||||
import { NoWorkspaceTip } from '../NoWorkspaceTip';
|
||||
import { MonitorPicker } from '../monitor/MonitorPicker';
|
||||
import {
|
||||
defaultErrorHandler,
|
||||
defaultSuccessHandler,
|
||||
getQueryKey,
|
||||
trpc,
|
||||
} from '../api/trpc';
|
||||
} from '../../api/trpc';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { useEvent } from '../hooks/useEvent';
|
||||
import { useEvent } from '../../hooks/useEvent';
|
||||
|
||||
export const WebsiteInfo: React.FC = React.memo(() => {
|
||||
const workspaceId = useCurrentWorkspaceId();
|
||||
@ -107,7 +107,11 @@ export const WebsiteInfo: React.FC = React.memo(() => {
|
||||
<Input size="large" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="Monitor" name="monitorId" tooltip="You can bind a monitor which will display health status in website overview">
|
||||
<Form.Item
|
||||
label="Monitor"
|
||||
name="monitorId"
|
||||
tooltip="You can bind a monitor which will display health status in website overview"
|
||||
>
|
||||
<MonitorPicker size="large" allowClear={true} />
|
||||
</Form.Item>
|
||||
|
@ -12,15 +12,15 @@ import {
|
||||
refreshWorkspaceWebsites,
|
||||
useWorspaceWebsites,
|
||||
WebsiteInfo,
|
||||
} from '../api/model/website';
|
||||
import { Loading } from './Loading';
|
||||
import { NoWorkspaceTip } from './NoWorkspaceTip';
|
||||
import { useRequest } from '../hooks/useRequest';
|
||||
import { useUserStore } from '../store/user';
|
||||
import { useEvent } from '../hooks/useEvent';
|
||||
} from '../../api/model/website';
|
||||
import { Loading } from '../Loading';
|
||||
import { NoWorkspaceTip } from '../NoWorkspaceTip';
|
||||
import { useRequest } from '../../hooks/useRequest';
|
||||
import { useUserStore } from '../../store/user';
|
||||
import { useEvent } from '../../hooks/useEvent';
|
||||
import { useNavigate } from 'react-router';
|
||||
import { PageHeader } from './PageHeader';
|
||||
import { ModalButton } from './ModalButton';
|
||||
import { PageHeader } from '../PageHeader';
|
||||
import { ModalButton } from '../ModalButton';
|
||||
|
||||
export const WebsiteList: React.FC = React.memo(() => {
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { trpc } from '../api/trpc';
|
||||
import { trpc } from '../../api/trpc';
|
||||
|
||||
export const WebsiteOnlineCount: React.FC<{
|
||||
workspaceId: string;
|
@ -16,10 +16,10 @@ import {
|
||||
getDateArray,
|
||||
} from '../../utils/date';
|
||||
import { useEvent } from '../../hooks/useEvent';
|
||||
import { MetricCard } from '../MetricCard';
|
||||
import { MetricCard } from './MetricCard';
|
||||
import { formatNumber, formatShortTime } from '../../utils/common';
|
||||
import { useTheme } from '../../hooks/useTheme';
|
||||
import { WebsiteOnlineCount } from '../WebsiteOnlineCount';
|
||||
import { WebsiteOnlineCount } from './WebsiteOnlineCount';
|
||||
import { useGlobalRangeDate } from '../../hooks/useGlobalRangeDate';
|
||||
import { MonitorHealthBar } from '../monitor/MonitorHealthBar';
|
||||
import { useNavigate } from 'react-router';
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { Menu, MenuProps } from 'antd';
|
||||
import React from 'react';
|
||||
import { Routes, Route, useLocation, useNavigate } from 'react-router-dom';
|
||||
import { WebsiteInfo } from '../../components/WebsiteInfo';
|
||||
import { WebsiteList } from '../../components/WebsiteList';
|
||||
import { WebsiteInfo } from '../../components/website/WebsiteInfo';
|
||||
import { WebsiteList } from '../../components/website/WebsiteList';
|
||||
import { useEvent } from '../../hooks/useEvent';
|
||||
import { NotificationList } from './NotificationList';
|
||||
import { Profile } from './Profile';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { Route, Routes } from 'react-router';
|
||||
import { WebsiteList } from '../../components/WebsiteList';
|
||||
import { WebsiteList } from '../../components/website/WebsiteList';
|
||||
import { WebsiteDetail } from './Detail';
|
||||
|
||||
export const WebsitePage: React.FC = React.memo(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user