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