perf: improve monitor badge display, add title in copy text
This commit is contained in:
parent
8ff5db80e2
commit
4a1ea8557a
@ -6,8 +6,9 @@ import copy from 'copy-to-clipboard';
|
||||
export const MonitorBadgeView: React.FC<{
|
||||
workspaceId: string;
|
||||
monitorId: string;
|
||||
monitorName?: string;
|
||||
}> = React.memo((props) => {
|
||||
const { workspaceId, monitorId } = props;
|
||||
const { workspaceId, monitorId, monitorName = '' } = props;
|
||||
|
||||
const [showDetail, setShowDetail] = useState(false);
|
||||
|
||||
@ -48,11 +49,13 @@ export const MonitorBadgeView: React.FC<{
|
||||
<div className="flex flex-col gap-2">
|
||||
<Input
|
||||
addonBefore="HTML Embed"
|
||||
value={`<img src="${url}" />`}
|
||||
value={`<img src="${url}" title="${monitorName}" />`}
|
||||
addonAfter={
|
||||
<div
|
||||
className="cursor-pointer"
|
||||
onClick={() => handleCopy(`<img src="${url}" />`)}
|
||||
onClick={() =>
|
||||
handleCopy(`<img src="${url}" title="${monitorName}" />`)
|
||||
}
|
||||
>
|
||||
Copy
|
||||
</div>
|
||||
@ -61,11 +64,11 @@ export const MonitorBadgeView: React.FC<{
|
||||
|
||||
<Input
|
||||
addonBefore="Markdown"
|
||||
value={`![](${url})`}
|
||||
value={`![${monitorName}](${url})`}
|
||||
addonAfter={
|
||||
<div
|
||||
className="cursor-pointer"
|
||||
onClick={() => handleCopy(`![](${url})`)}
|
||||
onClick={() => handleCopy(`![${monitorName}](${url})`)}
|
||||
>
|
||||
Copy
|
||||
</div>
|
||||
|
@ -238,6 +238,7 @@ export const MonitorInfo: React.FC<MonitorInfoProps> = React.memo((props) => {
|
||||
<MonitorBadgeView
|
||||
workspaceId={workspaceId}
|
||||
monitorId={monitorId}
|
||||
monitorName={monitorInfo.name}
|
||||
/>
|
||||
</Modal>
|
||||
</div>
|
||||
|
@ -2,7 +2,6 @@ import { MonitorProvider } from './type';
|
||||
import axios, { AxiosRequestConfig, AxiosResponse } from 'axios';
|
||||
import { logger } from '../../../utils/logger';
|
||||
import dayjs from 'dayjs';
|
||||
import { prisma } from '../../_client';
|
||||
import https from 'https';
|
||||
import { saveMonitorStatus } from './_utils';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user