diff --git a/src/client/components/monitor/MonitorList.tsx b/src/client/components/monitor/MonitorList.tsx
index c2f03fd..a4c160d 100644
--- a/src/client/components/monitor/MonitorList.tsx
+++ b/src/client/components/monitor/MonitorList.tsx
@@ -1,14 +1,10 @@
-import clsx from 'clsx';
import React, { useMemo, useState } from 'react';
-import { useNavigate } from 'react-router';
-import { AppRouterOutput, trpc } from '../../api/trpc';
+import { trpc } from '../../api/trpc';
import { useCurrentWorkspaceId } from '../../store/user';
import { NoWorkspaceTip } from '../NoWorkspaceTip';
-import { MonitorHealthBar } from './MonitorHealthBar';
import { Loading } from '../Loading';
import { Empty } from 'antd';
-
-type MonitorType = AppRouterOutput['monitor']['all'][number];
+import { MonitorListItem } from './MonitorListItem';
export const MonitorList: React.FC = React.memo(() => {
const workspaceId = useCurrentWorkspaceId();
@@ -49,6 +45,7 @@ export const MonitorList: React.FC = React.memo(() => {
@@ -57,83 +54,3 @@ export const MonitorList: React.FC = React.memo(() => {
);
});
MonitorList.displayName = 'MonitorList';
-
-export const MonitorListItem: React.FC<{
- monitor: MonitorType;
- selectedMonitorId: string | null;
- setSelectedMonitorId: (monitorId: string) => void;
-}> = React.memo((props) => {
- const { monitor, selectedMonitorId, setSelectedMonitorId } = props;
- const navigate = useNavigate();
- const workspaceId = useCurrentWorkspaceId();
- const [beats, setBeats] = useState<
- ({
- value: number;
- createdAt: string | Date;
- } | null)[]
- >([]);
-
- const upPercent = useMemo(() => {
- let up = 0;
- beats.forEach((b) => {
- if (!b) {
- return;
- }
-
- if (b.value >= 0) {
- up++;
- }
- });
-
- return parseFloat(((up / beats.length) * 100).toFixed(1));
- }, [beats]);
-
- return (
-
{
- navigate(`/monitor/${monitor.id}`);
- setSelectedMonitorId(monitor.id);
- }}
- >
-
-
- {upPercent}%
-
-
-
-
{monitor.name}
- {/*
- {monitor.tags.map((tag) => (
-
- {tag.label}
-
- ))}
-
*/}
-
-
-
-
-
-
- );
-});
-MonitorListItem.displayName = 'MonitorListItem';
diff --git a/src/client/components/monitor/MonitorListItem.tsx b/src/client/components/monitor/MonitorListItem.tsx
new file mode 100644
index 0000000..f067755
--- /dev/null
+++ b/src/client/components/monitor/MonitorListItem.tsx
@@ -0,0 +1,88 @@
+import clsx from 'clsx';
+import React, { useMemo, useState } from 'react';
+import { useNavigate } from 'react-router';
+import { AppRouterOutput } from '../../api/trpc';
+import { MonitorHealthBar } from './MonitorHealthBar';
+
+type MonitorType = AppRouterOutput['monitor']['all'][number];
+
+export const MonitorListItem: React.FC<{
+ monitor: MonitorType;
+ workspaceId: string;
+ selectedMonitorId: string | null;
+ setSelectedMonitorId: (monitorId: string) => void;
+}> = React.memo((props) => {
+ const { monitor, workspaceId, selectedMonitorId, setSelectedMonitorId } =
+ props;
+ const navigate = useNavigate();
+ const [beats, setBeats] = useState<
+ ({
+ value: number;
+ createdAt: string | Date;
+ } | null)[]
+ >([]);
+
+ const upPercent = useMemo(() => {
+ let up = 0;
+ beats.forEach((b) => {
+ if (!b) {
+ return;
+ }
+
+ if (b.value >= 0) {
+ up++;
+ }
+ });
+
+ return parseFloat(((up / beats.length) * 100).toFixed(1));
+ }, [beats]);
+
+ return (
+ {
+ navigate(`/monitor/${monitor.id}`);
+ setSelectedMonitorId(monitor.id);
+ }}
+ >
+
+
+ {upPercent}%
+
+
+
+
{monitor.name}
+ {/*
+ {monitor.tags.map((tag) => (
+
+ {tag.label}
+
+ ))}
+
*/}
+
+
+
+
+
+
+ );
+});
+MonitorListItem.displayName = 'MonitorListItem';