Skip to content

Commit

Permalink
perf: improve monitor badge display, add title in copy text
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed Jan 30, 2024
1 parent 8ff5db8 commit 4a1ea85
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions src/client/components/monitor/MonitorBadgeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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>
Expand All @@ -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>
Expand Down
1 change: 1 addition & 0 deletions src/client/components/monitor/MonitorInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ export const MonitorInfo: React.FC<MonitorInfoProps> = React.memo((props) => {
<MonitorBadgeView
workspaceId={workspaceId}
monitorId={monitorId}
monitorName={monitorInfo.name}
/>
</Modal>
</div>
Expand Down
1 change: 0 additions & 1 deletion src/server/model/monitor/provider/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down

0 comments on commit 4a1ea85

Please sign in to comment.