diff --git a/console/client/.eslintrc.cjs b/console/client/.eslintrc.cjs index f94f680b21..ad545b8dd1 100644 --- a/console/client/.eslintrc.cjs +++ b/console/client/.eslintrc.cjs @@ -24,8 +24,8 @@ module.exports = { rules: { 'react/react-in-jsx-scope': 'off', 'react/jsx-uses-react': 'off', - 'react/prop-types': 'off', 'func-style': ['error', 'expression'], + 'react/prop-types': 'off', '@typescript-eslint/consistent-type-definitions': ['error', 'interface'], '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }], '@typescript-eslint/ban-ts-comment': [ diff --git a/console/client/src/features/calls/CallList.tsx b/console/client/src/features/calls/CallList.tsx index 0ce1f6ca68..c2aa53a468 100644 --- a/console/client/src/features/calls/CallList.tsx +++ b/console/client/src/features/calls/CallList.tsx @@ -1,17 +1,13 @@ -import React from 'react' +import { useContext, useState } from 'react' import { CallEvent } from '../../protos/xyz/block/ftl/v1/console/console_pb' import { SidePanelContext } from '../../providers/side-panel-provider' import { formatDuration, formatTimestampShort } from '../../utils' import { TimelineCallDetails } from '../timeline/details/TimelineCallDetails' import { verbRefString } from '../verbs/verb.utils' -interface Props { - calls: CallEvent[] | undefined -} - -export const CallList = ({ calls }: Props) => { - const { openPanel, closePanel } = React.useContext(SidePanelContext) - const [selectedCall, setSelectedCall] = React.useState() +export const CallList = ({ calls }: { calls: CallEvent[] | undefined }) => { + const { openPanel, closePanel } = useContext(SidePanelContext) + const [selectedCall, setSelectedCall] = useState() const handleCallClicked = (call: CallEvent) => { if (selectedCall?.equals(call)) { diff --git a/console/client/src/features/deployments/DeploymentPage.tsx b/console/client/src/features/deployments/DeploymentPage.tsx index 807e174831..31aa48528c 100644 --- a/console/client/src/features/deployments/DeploymentPage.tsx +++ b/console/client/src/features/deployments/DeploymentPage.tsx @@ -1,5 +1,5 @@ import { RocketLaunchIcon } from '@heroicons/react/24/outline' -import React from 'react' +import { useContext, useEffect, useState } from 'react' import { useNavigate, useParams } from 'react-router-dom' import { ButtonSmall } from '../../components/ButtonSmall' import { Card } from '../../components/Card' @@ -12,18 +12,18 @@ import { verbRefString } from '../verbs/verb.utils' export const DeploymentPage = () => { const navigate = useNavigate() const { deploymentName } = useParams() - const modules = React.useContext(modulesContext) - const [module, setModule] = React.useState() - const [calls, setCalls] = React.useState([]) + const modules = useContext(modulesContext) + const [module, setModule] = useState() + const [calls, setCalls] = useState([]) - React.useEffect(() => { + useEffect(() => { if (modules) { const module = modules.modules.find((module) => module.deploymentName === deploymentName) setModule(module) } }, [modules, deploymentName]) - React.useEffect(() => { + useEffect(() => { if (!module) return const verbCalls: VerbRef[] = [] diff --git a/console/client/src/features/deployments/DeploymentsPage.tsx b/console/client/src/features/deployments/DeploymentsPage.tsx index c854ef0760..a2faf449e9 100644 --- a/console/client/src/features/deployments/DeploymentsPage.tsx +++ b/console/client/src/features/deployments/DeploymentsPage.tsx @@ -1,12 +1,12 @@ import { RocketLaunchIcon } from '@heroicons/react/24/outline' -import React from 'react' +import { useContext } from 'react' import { useNavigate } from 'react-router-dom' import { Card } from '../../components/Card' -import { modulesContext } from '../../providers/modules-provider' import { Page } from '../../layout' +import { modulesContext } from '../../providers/modules-provider' export const DeploymentsPage = () => { - const modules = React.useContext(modulesContext) + const modules = useContext(modulesContext) const navigate = useNavigate() return ( diff --git a/console/client/src/features/modules/ModulePage.tsx b/console/client/src/features/modules/ModulePage.tsx index 51d2ec3088..39377fe0ef 100644 --- a/console/client/src/features/modules/ModulePage.tsx +++ b/console/client/src/features/modules/ModulePage.tsx @@ -1,5 +1,5 @@ import { Square3Stack3DIcon } from '@heroicons/react/24/outline' -import React from 'react' +import { useContext, useEffect, useState } from 'react' import { useNavigate, useParams } from 'react-router-dom' import { Card } from '../../components/Card' import { Page } from '../../layout' @@ -12,18 +12,18 @@ import { CallList } from '../calls/CallList' export const ModulePage = () => { const navigate = useNavigate() const { moduleName } = useParams() - const modules = React.useContext(modulesContext) - const [module, setModule] = React.useState() - const [calls, setCalls] = React.useState() + const modules = useContext(modulesContext) + const [module, setModule] = useState() + const [calls, setCalls] = useState() - React.useEffect(() => { + useEffect(() => { if (modules) { const module = modules.modules.find((module) => module.name === moduleName?.toLocaleLowerCase()) setModule(module) } }, [modules, moduleName]) - React.useEffect(() => { + useEffect(() => { const abortController = new AbortController() if (!module) return diff --git a/console/client/src/features/modules/ModulesGraph.tsx b/console/client/src/features/modules/ModulesGraph.tsx index 217e1241b1..2645dc0677 100644 --- a/console/client/src/features/modules/ModulesGraph.tsx +++ b/console/client/src/features/modules/ModulesGraph.tsx @@ -1,24 +1,21 @@ -import React from 'react' -import { PlusCircleIcon, MinusCircleIcon, ArrowPathIcon } from '@heroicons/react/24/outline' +import { ArrowPathIcon, MinusCircleIcon, PlusCircleIcon } from '@heroicons/react/24/outline' +import React, { useContext, useEffect, useRef, useState } from 'react' import { modulesContext } from '../../providers/modules-provider' -import { VerbId, ZoomCallbacks } from './modules.constants' import { Panel } from './components' -import { svgZoom, formatSVG, dotToSVG, generateDot } from './graph' +import { dotToSVG, formatSVG, generateDot, svgZoom } from './graph' +import { ZoomCallbacks } from './modules.constants' export const ModulesGraph: React.FC<{ className?: string - zoomId?: string - setSelectedVerbs: React.Dispatch> - selectedVerbs: VerbId[] setZoomCallbacks: React.Dispatch> zoomCallbacks?: ZoomCallbacks }> = ({ className, setZoomCallbacks, zoomCallbacks }) => { - const modules = React.useContext(modulesContext) - const canvasRef = React.useRef(null) - const [resizeCount, setResizeCount] = React.useState(0) - const previousDimensions = React.useRef({ width: 0, height: 0 }) // Store previous dimensions + const modules = useContext(modulesContext) + const canvasRef = useRef(null) + const [resizeCount, setResizeCount] = useState(0) + const previousDimensions = useRef({ width: 0, height: 0 }) // Store previous dimensions - React.useEffect(() => { + useEffect(() => { const canvasCur = canvasRef.current if (canvasCur) { const observer = new ResizeObserver((entries) => { @@ -39,7 +36,7 @@ export const ModulesGraph: React.FC<{ } }, [canvasRef]) - React.useEffect(() => { + useEffect(() => { const canvas = canvasRef.current const ready = canvas && Boolean(modules) let animationFrameId: number diff --git a/console/client/src/features/modules/ModulesPage.tsx b/console/client/src/features/modules/ModulesPage.tsx index e608e4abf3..b7512be7d0 100644 --- a/console/client/src/features/modules/ModulesPage.tsx +++ b/console/client/src/features/modules/ModulesPage.tsx @@ -1,5 +1,5 @@ import { Square3Stack3DIcon } from '@heroicons/react/24/outline' -import React from 'react' +import { useContext, useState } from 'react' import { Page } from '../../layout' import { modulesContext } from '../../providers/modules-provider' import { SidePanelProvider } from '../../providers/side-panel-provider' @@ -12,10 +12,10 @@ import type { ZoomCallbacks } from './modules.constants' import { VerbId } from './modules.constants' export const ModulesPage = () => { - const { modules } = React.useContext(modulesContext) - const [selectedVerbs, setSelectedVerbs] = React.useState([]) + const { modules } = useContext(modulesContext) + const [selectedVerbs, setSelectedVerbs] = useState([]) const hasVerbs = Boolean(selectedVerbs.length) - const [zoomCallbacks, setZoomCallbacks] = React.useState() + const [zoomCallbacks, setZoomCallbacks] = useState() return ( @@ -37,8 +37,6 @@ export const ModulesPage = () => { )} > = ({ className, modules }) => { +export const ModulesRequests = ({ className, modules }: { className?: string; modules: Module[] }) => { const [searchParams, setSearchParams] = useSearchParams() - const [entries, setEntries] = React.useState([]) - const { openPanel, closePanel } = React.useContext(SidePanelContext) - const [selectedEntry, setSelectedEntry] = React.useState(null) + const [entries, setEntries] = useState([]) + const { openPanel, closePanel } = useContext(SidePanelContext) + const [selectedEntry, setSelectedEntry] = useState(null) const deployments = modules.map(({ deploymentName }) => deploymentName) const filters: EventsQuery_Filter[] = [] @@ -35,7 +31,7 @@ export const ModulesRequests: React.FC<{ filters.push(modulesFilter(deployments)) } - React.useEffect(() => { + useEffect(() => { setEntries([]) if (!filters.length) return const abortController = new AbortController() diff --git a/console/client/src/features/modules/ModulesSelectedVerbs.tsx b/console/client/src/features/modules/ModulesSelectedVerbs.tsx index 1f6c4c1a90..61f4698c93 100644 --- a/console/client/src/features/modules/ModulesSelectedVerbs.tsx +++ b/console/client/src/features/modules/ModulesSelectedVerbs.tsx @@ -1,18 +1,22 @@ -import React from 'react' import { Tab } from '@headlessui/react' +import React from 'react' import { CodeBlock } from '../../components' -import { Panel } from './components' -import { Module, Verb, Data } from '../../protos/xyz/block/ftl/v1/console/console_pb' -import { VerbId } from './modules.constants' -import { getNames, buildVerbSchema } from './modules.utils' +import { Data, Module, Verb } from '../../protos/xyz/block/ftl/v1/console/console_pb' import { classNames } from '../../utils' import { VerbForm } from '../verbs/VerbForm' +import { Panel } from './components' +import { VerbId } from './modules.constants' +import { buildVerbSchema, getNames } from './modules.utils' -export const ModulesSelectedVerbs: React.FC<{ +export const ModulesSelectedVerbs = ({ + className, + modules, + selectedVerbs, +}: { className?: string modules: Module[] selectedVerbs?: VerbId[] -}> = ({ className, modules, selectedVerbs }) => { +}) => { if (!selectedVerbs?.length) return <> const verbs: { module: Module; verb: Verb; callData: Data[] }[] = [] for (const verbId of selectedVerbs) { diff --git a/console/client/src/features/modules/ModulesSidebar.tsx b/console/client/src/features/modules/ModulesSidebar.tsx index dc0f4d9c02..1d0f01a144 100644 --- a/console/client/src/features/modules/ModulesSidebar.tsx +++ b/console/client/src/features/modules/ModulesSidebar.tsx @@ -1,11 +1,11 @@ -import React from 'react' import { Listbox } from '@headlessui/react' import { EyeIcon } from '@heroicons/react/20/solid' +import React, { useState } from 'react' import { Module } from '../../protos/xyz/block/ftl/v1/console/console_pb' -import { VerbId, ZoomCallbacks } from './modules.constants' -import { getNames } from './modules.utils' import { classNames } from '../../utils' import { backgrounds, borders, colors } from './components' +import { VerbId, ZoomCallbacks } from './modules.constants' +import { getNames } from './modules.utils' interface DeploymentVerbs { deploymentName: string @@ -14,12 +14,17 @@ interface DeploymentVerbs { queriedVerbs: Set } -const ModulesOption: React.FC<{ +const ModulesOption = ({ + id, + zoomCallbacks, + verbs, + deploymentName, +}: { id: string verbs: VerbId[] deploymentName: string zoomCallbacks?: ZoomCallbacks -}> = ({ id, zoomCallbacks, verbs, deploymentName }) => { +}) => { return (
  • @@ -73,10 +78,8 @@ export const ModulesSidebar: React.FC<{ selectedVerbs: VerbId[] zoomCallbacks?: ZoomCallbacks }> = ({ className, modules, setSelectedVerbs, selectedVerbs, zoomCallbacks }) => { - /** Setup hooks */ - const [query, setQuery] = React.useState('') + const [query, setQuery] = useState('') - /** Format data */ const map: Map = new Map() for (const { name: moduleName, verbs, deploymentName } of modules) { const value: DeploymentVerbs = { diff --git a/console/client/src/features/modules/components/Select.tsx b/console/client/src/features/modules/components/Select.tsx deleted file mode 100644 index 008514b743..0000000000 --- a/console/client/src/features/modules/components/Select.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import React from 'react' -import { Listbox } from '@headlessui/react' - -type OptionTypes = 'verb' | 'module' -interface Option { - key: string - value: string - type?: OptionTypes -} -const SelectIcon: React.FC<{ type: OptionTypes }> = ({ type }) => {type} - -export const Select: React.FC<{ - data: Option[] - onChange: (value: string) => void -}> = ({ data, onChange }) => { - const [selected, setSelected] = React.useState(data[0]) - const handleChange = (option: Option) => { - setSelected(option) - onChange(option.value) - } - return ( - - {selected.value} - - {data.map((item) => ( - - {item.type && } - {item.value} - - ))} - - - ) -} diff --git a/console/client/src/features/modules/components/index.ts b/console/client/src/features/modules/components/index.ts index a7d4722670..8c554565a1 100644 --- a/console/client/src/features/modules/components/index.ts +++ b/console/client/src/features/modules/components/index.ts @@ -1,3 +1,2 @@ -export * from './Select' export * from './Panel' export * from './components.constants' diff --git a/console/client/src/features/modules/graph/svg-zoom.ts b/console/client/src/features/modules/graph/svg-zoom.ts index f0c27898f5..f77b2ecb9c 100644 --- a/console/client/src/features/modules/graph/svg-zoom.ts +++ b/console/client/src/features/modules/graph/svg-zoom.ts @@ -1,4 +1,4 @@ -import { SVG, Element, Svg } from '@svgdotjs/svg.js' +import { Element, SVG, Svg } from '@svgdotjs/svg.js' import '@svgdotjs/svg.panzoom.js/dist/svg.panzoom.esm.js' const centerGroup = ({ diff --git a/console/client/src/features/requests/RequestGraph.tsx b/console/client/src/features/requests/RequestGraph.tsx index 83185ddd35..152a6172bb 100644 --- a/console/client/src/features/requests/RequestGraph.tsx +++ b/console/client/src/features/requests/RequestGraph.tsx @@ -2,14 +2,17 @@ import { Duration, Timestamp } from '@bufbuild/protobuf' import { CallEvent } from '../../protos/xyz/block/ftl/v1/console/console_pb' import { verbRefString } from '../verbs/verb.utils' -interface CallBlockProps { +const CallBlock = ({ + call, + selectedCall, + firstTimeStamp, + firstDuration, +}: { call: CallEvent selectedCall?: CallEvent firstTimeStamp: Timestamp firstDuration: Duration -} - -const CallBlock = ({ call, selectedCall, firstTimeStamp, firstDuration }: CallBlockProps) => { +}) => { const totalDurationMillis = (firstDuration.nanos ?? 0) / 1000000 const durationInMillis = (call.duration?.nanos ?? 0) / 1000000 let width = (durationInMillis / totalDurationMillis) * 100 diff --git a/console/client/src/features/timeline/Timeline.tsx b/console/client/src/features/timeline/Timeline.tsx index c74fc7aad0..52479164b0 100644 --- a/console/client/src/features/timeline/Timeline.tsx +++ b/console/client/src/features/timeline/Timeline.tsx @@ -1,11 +1,12 @@ import { Timestamp } from '@bufbuild/protobuf' -import React from 'react' +import { useContext, useEffect, useState } from 'react' import { useSearchParams } from 'react-router-dom' import { Event, EventsQuery_Filter } from '../../protos/xyz/block/ftl/v1/console/console_pb.ts' import { SidePanelContext } from '../../providers/side-panel-provider.tsx' import { eventIdFilter, getEvents, streamEvents, timeFilter } from '../../services/console.service.ts' import { formatTimestampShort } from '../../utils/date.utils.ts' import { panelColor } from '../../utils/style.utils.ts' +import { DeploymentLabel } from './DeploymentLabel.tsx' import { TimelineCall } from './TimelineCall.tsx' import { TimelineDeploymentCreated } from './TimelineDeploymentCreated.tsx' import { TimelineDeploymentUpdated } from './TimelineDeploymentUpdated.tsx' @@ -16,22 +17,16 @@ import { TimelineDeploymentCreatedDetails } from './details/TimelineDeploymentCr import { TimelineDeploymentUpdatedDetails } from './details/TimelineDeploymentUpdatedDetails.tsx' import { TimelineLogDetails } from './details/TimelineLogDetails.tsx' import { TimeSettings } from './filters/TimelineTimeControls.tsx' -import { DeploymentLabel } from './DeploymentLabel.tsx' - -interface Props { - timeSettings: TimeSettings - filters: EventsQuery_Filter[] -} const maxTimelineEntries = 1000 -export const Timeline = ({ timeSettings, filters }: Props) => { +export const Timeline = ({ timeSettings, filters }: { timeSettings: TimeSettings; filters: EventsQuery_Filter[] }) => { const [searchParams, setSearchParams] = useSearchParams() - const { openPanel, closePanel, isOpen } = React.useContext(SidePanelContext) - const [entries, setEntries] = React.useState([]) - const [selectedEntry, setSelectedEntry] = React.useState(null) + const { openPanel, closePanel, isOpen } = useContext(SidePanelContext) + const [entries, setEntries] = useState([]) + const [selectedEntry, setSelectedEntry] = useState(null) - React.useEffect(() => { + useEffect(() => { const eventId = searchParams.get('id') const abortController = new AbortController() @@ -75,7 +70,7 @@ export const Timeline = ({ timeSettings, filters }: Props) => { } }, [filters, timeSettings]) - React.useEffect(() => { + useEffect(() => { if (!isOpen) { setSelectedEntry(null) } diff --git a/console/client/src/features/timeline/TimelineCall.tsx b/console/client/src/features/timeline/TimelineCall.tsx index 4c8e73b307..34851fe2a2 100644 --- a/console/client/src/features/timeline/TimelineCall.tsx +++ b/console/client/src/features/timeline/TimelineCall.tsx @@ -1,11 +1,7 @@ import { CallEvent } from '../../protos/xyz/block/ftl/v1/console/console_pb' import { verbRefString } from '../verbs/verb.utils' -interface Props { - call: CallEvent -} - -export const TimelineCall = ({ call }: Props) => { +export const TimelineCall = ({ call }: { call: CallEvent }) => { return ( {call.sourceVerbRef?.module && ( diff --git a/console/client/src/features/timeline/TimelineDeploymentCreated.tsx b/console/client/src/features/timeline/TimelineDeploymentCreated.tsx index 3b5df4aecb..85058b8d65 100644 --- a/console/client/src/features/timeline/TimelineDeploymentCreated.tsx +++ b/console/client/src/features/timeline/TimelineDeploymentCreated.tsx @@ -1,10 +1,6 @@ import { DeploymentCreatedEvent } from '../../protos/xyz/block/ftl/v1/console/console_pb' -interface Props { - deployment: DeploymentCreatedEvent -} - -export const TimelineDeploymentCreated = ({ deployment }: Props) => { +export const TimelineDeploymentCreated = ({ deployment }: { deployment: DeploymentCreatedEvent }) => { return ( <> Created deployment {deployment.name} for language{' '} diff --git a/console/client/src/features/timeline/TimelineDeploymentUpdated.tsx b/console/client/src/features/timeline/TimelineDeploymentUpdated.tsx index 2d30699370..44ba850b97 100644 --- a/console/client/src/features/timeline/TimelineDeploymentUpdated.tsx +++ b/console/client/src/features/timeline/TimelineDeploymentUpdated.tsx @@ -1,10 +1,6 @@ import { DeploymentUpdatedEvent } from '../../protos/xyz/block/ftl/v1/console/console_pb' -interface Props { - deployment: DeploymentUpdatedEvent -} - -export const TimelineDeploymentUpdated = ({ deployment }: Props) => { +export const TimelineDeploymentUpdated = ({ deployment }: { deployment: DeploymentUpdatedEvent }) => { return ( <> Updated deployment {deployment.name} min replicas to{' '} diff --git a/console/client/src/features/timeline/TimelineIcon.tsx b/console/client/src/features/timeline/TimelineIcon.tsx index de65e867bb..6b8a05c9d9 100644 --- a/console/client/src/features/timeline/TimelineIcon.tsx +++ b/console/client/src/features/timeline/TimelineIcon.tsx @@ -2,11 +2,7 @@ import { ListBulletIcon, PhoneArrowDownLeftIcon, PhoneIcon, RocketLaunchIcon } f import { Event } from '../../protos/xyz/block/ftl/v1/console/console_pb' import { LogLevelBadgeSmall } from '../logs/LogLevelBadgeSmall' -interface Props { - event: Event -} - -export const TimelineIcon = ({ event }: Props) => { +export const TimelineIcon = ({ event }: { event: Event }) => { const icon = (event: Event) => { const style = 'h4 w-4 text-indigo-600' switch (event.entry.case) { diff --git a/console/client/src/features/timeline/TimelineLog.tsx b/console/client/src/features/timeline/TimelineLog.tsx index ec7cab5419..5fb4127c19 100644 --- a/console/client/src/features/timeline/TimelineLog.tsx +++ b/console/client/src/features/timeline/TimelineLog.tsx @@ -1,9 +1,5 @@ import { LogEvent } from '../../protos/xyz/block/ftl/v1/console/console_pb' -interface Props { - log: LogEvent -} - -export const TimelineLog = ({ log }: Props) => { +export const TimelineLog = ({ log }: { log: LogEvent }) => { return {log.message} } diff --git a/console/client/src/features/timeline/TimelinePage.tsx b/console/client/src/features/timeline/TimelinePage.tsx index ce107fdcae..b96ab0e06a 100644 --- a/console/client/src/features/timeline/TimelinePage.tsx +++ b/console/client/src/features/timeline/TimelinePage.tsx @@ -1,5 +1,5 @@ import { ListBulletIcon } from '@heroicons/react/24/outline' -import React from 'react' +import { useEffect, useState } from 'react' import { useSearchParams } from 'react-router-dom' import { Page } from '../../layout' import { EventsQuery_Filter } from '../../protos/xyz/block/ftl/v1/console/console_pb' @@ -10,13 +10,13 @@ import { TIME_RANGES, TimeSettings, TimelineTimeControls } from './filters/Timel export const TimelinePage = () => { const [searchParams] = useSearchParams() - const [timeSettings, setTimeSettings] = React.useState({ isTailing: true, isPaused: false }) - const [filters, setFilters] = React.useState([]) - const [selectedTimeRange, setSelectedTimeRange] = React.useState(TIME_RANGES['tail']) - const [isTimelinePaused, setIsTimelinePaused] = React.useState(false) + const [timeSettings, setTimeSettings] = useState({ isTailing: true, isPaused: false }) + const [filters, setFilters] = useState([]) + const [selectedTimeRange, setSelectedTimeRange] = useState(TIME_RANGES['tail']) + const [isTimelinePaused, setIsTimelinePaused] = useState(false) const initialEventId = searchParams.get('id') - React.useEffect(() => { + useEffect(() => { if (initialEventId) { // if we're loading a specific event, we don't want to tail. setSelectedTimeRange(TIME_RANGES['5m']) diff --git a/console/client/src/features/timeline/details/TimelineCallDetails.tsx b/console/client/src/features/timeline/details/TimelineCallDetails.tsx index b04ab6eebc..45b99847de 100644 --- a/console/client/src/features/timeline/details/TimelineCallDetails.tsx +++ b/console/client/src/features/timeline/details/TimelineCallDetails.tsx @@ -1,5 +1,5 @@ import { Timestamp } from '@bufbuild/protobuf' -import React, { useEffect, useState } from 'react' +import { useContext, useEffect, useState } from 'react' import { useNavigate } from 'react-router-dom' import { Card } from '../../../components' import { AttributeBadge } from '../../../components/AttributeBadge' @@ -15,15 +15,10 @@ import { RequestGraph } from '../../requests/RequestGraph' import { verbRefString } from '../../verbs/verb.utils' import { TimelineTimestamp } from './TimelineTimestamp' -interface Props { - timestamp: Timestamp - call: CallEvent -} - -export const TimelineCallDetails = ({ timestamp, call }: Props) => { +export const TimelineCallDetails = ({ timestamp, call }: { timestamp: Timestamp; call: CallEvent }) => { const client = useClient(ConsoleService) const navigate = useNavigate() - const { closePanel } = React.useContext(SidePanelContext) + const { closePanel } = useContext(SidePanelContext) const [requestCalls, setRequestCalls] = useState([]) const [selectedCall, setSelectedCall] = useState(call) diff --git a/console/client/src/features/timeline/details/TimelineDeploymentCreatedDetails.tsx b/console/client/src/features/timeline/details/TimelineDeploymentCreatedDetails.tsx index 0abdd6952a..0e93de7807 100644 --- a/console/client/src/features/timeline/details/TimelineDeploymentCreatedDetails.tsx +++ b/console/client/src/features/timeline/details/TimelineDeploymentCreatedDetails.tsx @@ -1,5 +1,5 @@ import { Timestamp } from '@bufbuild/protobuf' -import React from 'react' +import { useContext } from 'react' import { useNavigate } from 'react-router-dom' import { AttributeBadge } from '../../../components/AttributeBadge' import { Card } from '../../../components/Card' @@ -8,13 +8,14 @@ import { DeploymentCreatedEvent, Event } from '../../../protos/xyz/block/ftl/v1/ import { SidePanelContext } from '../../../providers/side-panel-provider' import { TimelineTimestamp } from './TimelineTimestamp' -interface Props { +export const TimelineDeploymentCreatedDetails = ({ + event, + deployment, +}: { event: Event deployment: DeploymentCreatedEvent -} - -export const TimelineDeploymentCreatedDetails = ({ event, deployment }: Props) => { - const { closePanel } = React.useContext(SidePanelContext) +}) => { + const { closePanel } = useContext(SidePanelContext) const navigate = useNavigate() return ( diff --git a/console/client/src/features/timeline/details/TimelineDeploymentUpdatedDetails.tsx b/console/client/src/features/timeline/details/TimelineDeploymentUpdatedDetails.tsx index 282c39b74c..18689fa0aa 100644 --- a/console/client/src/features/timeline/details/TimelineDeploymentUpdatedDetails.tsx +++ b/console/client/src/features/timeline/details/TimelineDeploymentUpdatedDetails.tsx @@ -1,5 +1,5 @@ import { Timestamp } from '@bufbuild/protobuf' -import React from 'react' +import { useContext } from 'react' import { useNavigate } from 'react-router-dom' import { AttributeBadge } from '../../../components/AttributeBadge' import { Card } from '../../../components/Card' @@ -8,13 +8,14 @@ import { DeploymentUpdatedEvent, Event } from '../../../protos/xyz/block/ftl/v1/ import { SidePanelContext } from '../../../providers/side-panel-provider' import { TimelineTimestamp } from './TimelineTimestamp' -interface Props { +export const TimelineDeploymentUpdatedDetails = ({ + event, + deployment, +}: { event: Event deployment: DeploymentUpdatedEvent -} - -export const TimelineDeploymentUpdatedDetails = ({ event, deployment }: Props) => { - const { closePanel } = React.useContext(SidePanelContext) +}) => { + const { closePanel } = useContext(SidePanelContext) const navigate = useNavigate() return ( diff --git a/console/client/src/features/timeline/details/TimelineLogDetails.tsx b/console/client/src/features/timeline/details/TimelineLogDetails.tsx index d5ecabb3d9..267fc15c6c 100644 --- a/console/client/src/features/timeline/details/TimelineLogDetails.tsx +++ b/console/client/src/features/timeline/details/TimelineLogDetails.tsx @@ -1,5 +1,5 @@ import { Timestamp } from '@bufbuild/protobuf' -import React from 'react' +import { useContext } from 'react' import { useNavigate } from 'react-router-dom' import { AttributeBadge } from '../../../components/AttributeBadge' import { Card } from '../../../components/Card' @@ -12,13 +12,8 @@ import { LogLevelBadge } from '../../logs/LogLevelBadge' import { logLevelBgColor } from '../../logs/log.utils' import { TimelineTimestamp } from './TimelineTimestamp' -interface Props { - event: Event - log: LogEvent -} - -export const TimelineLogDetails = ({ event, log }: Props) => { - const { closePanel } = React.useContext(SidePanelContext) +export const TimelineLogDetails = ({ event, log }: { event: Event; log: LogEvent }) => { + const { closePanel } = useContext(SidePanelContext) const navigate = useNavigate() return ( diff --git a/console/client/src/features/timeline/details/TimelineTimestamp.tsx b/console/client/src/features/timeline/details/TimelineTimestamp.tsx index e237e76d5b..ad108715cb 100644 --- a/console/client/src/features/timeline/details/TimelineTimestamp.tsx +++ b/console/client/src/features/timeline/details/TimelineTimestamp.tsx @@ -2,11 +2,7 @@ import { Timestamp } from '@bufbuild/protobuf' import { formatTimestampShort } from '../../../utils/date.utils' import { textColor } from '../../../utils/style.utils' -interface Props { - timestamp: Timestamp -} - -export const TimelineTimestamp = ({ timestamp }: Props) => { +export const TimelineTimestamp = ({ timestamp }: { timestamp: Timestamp }) => { return (