import { Trans, t } from '@i18next-toolkit/react'; import { Alert, Button, Collapse, Form, Input, Modal, Popconfirm, Table, Typography, } from 'antd'; import React, { useMemo, useState } from 'react'; import { AppRouterOutput, trpc } from '../../api/trpc'; import { useCurrentWorkspaceId } from '../../store/user'; import { type ColumnsType } from 'antd/es/table/interface'; import { BarChartOutlined, CodeOutlined, EditOutlined, PlusOutlined, DeleteOutlined, } from '@ant-design/icons'; import { useNavigate } from 'react-router'; import { PageHeader } from '../PageHeader'; import { useEvent } from '../../hooks/useEvent'; import { TelemetryCounter } from './TelemetryCounter'; import { LuDelete, LuTrash } from 'react-icons/lu'; type TelemetryInfo = AppRouterOutput['telemetry']['all'][number]; export const TelemetryList: React.FC = React.memo(() => { const workspaceId = useCurrentWorkspaceId(); const [isEditModalOpen, setIsEditModalOpen] = useState(false); const [form] = Form.useForm<{ id?: string; name: string }>(); const upsertTelemetryMutation = trpc.telemetry.upsert.useMutation(); const utils = trpc.useUtils(); const [modal, contextHolder] = Modal.useModal(); const handleAddTelemetry = useEvent(async () => { await form.validateFields(); const values = form.getFieldsValue(); await upsertTelemetryMutation.mutateAsync({ telemetryId: values.id, workspaceId, name: values.name, }); utils.telemetry.all.refetch(); setIsEditModalOpen(false); form.resetFields(); }); const handleShowUsage = useEvent((info: TelemetryInfo) => { const blankGif = `${window.location.origin}/telemetry/${workspaceId}/${info.id}.gif`; const countBadgeUrl = `${window.location.origin}/telemetry/${workspaceId}/${info.id}/badge.svg`; modal.info({ maskClosable: true, title: 'How to Use Telemetry', content: (
Here is some way to use telemetry:
if your article support raw html, you can direct insert it{' '}
Some website will not allow send `referer` field. so its maybe can not track source. so you can mark it by yourself. for example:
if your article support raw html, you can direct insert it{' '}
Like this:
), }); }); const handleEditTelemetry = useEvent(async (info: TelemetryInfo) => { setIsEditModalOpen(true); form.setFieldsValue({ id: info.id, name: info.name, }); }); return (