import { SettingsDevelopersWebhookTooltip } from '@/settings/developers/webhook/components/SettingsDevelopersWebhookTooltip'; import { useGraphData } from '@/settings/developers/webhook/hooks/useGraphData'; import { webhookGraphDataState } from '@/settings/developers/webhook/states/webhookGraphDataState'; import { Select } from '@/ui/input/components/Select'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { ResponsiveLine } from '@nivo/line'; import { Section } from '@react-email/components'; import { useState } from 'react'; import { useRecoilValue, useSetRecoilState } from 'recoil'; import { H2Title } from 'twenty-ui'; export type NivoLineInput = { id: string | number; color?: string; data: Array<{ x: number | string | Date; y: number | string | Date; }>; }; const StyledGraphContainer = styled.div` background-color: ${({ theme }) => theme.background.secondary}; border: 1px solid ${({ theme }) => theme.border.color.medium}; border-radius: ${({ theme }) => theme.border.radius.md}; height: 199px; padding: ${({ theme }) => theme.spacing(4, 2, 2, 2)}; width: 496px; `; const StyledTitleContainer = styled.div` align-items: flex-start; display: flex; justify-content: space-between; `; type SettingsDevelopersWebhookUsageGraphProps = { webhookId: string; }; export const SettingsDevelopersWebhookUsageGraph = ({ webhookId, }: SettingsDevelopersWebhookUsageGraphProps) => { const webhookGraphData = useRecoilValue(webhookGraphDataState); const setWebhookGraphData = useSetRecoilState(webhookGraphDataState); const theme = useTheme(); const [windowLengthGraphOption, setWindowLengthGraphOption] = useState< '7D' | '1D' | '12H' | '4H' >('7D'); const { fetchGraphData } = useGraphData(webhookId); return ( <> {webhookGraphData.length ? (