From 14582e6bf4d262a3c42aa8cd240a844b1b6f3f4e Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Tue, 6 Feb 2024 19:32:03 -0800 Subject: [PATCH] Minor tweaks --- src-web/components/GrpcConnectionLayout.tsx | 1 - .../components/GrpcConnectionSetupPane.tsx | 3 -- .../components/RecentConnectionsDropdown.tsx | 28 ++++++++----------- src-web/components/core/FormattedError.tsx | 1 - 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/src-web/components/GrpcConnectionLayout.tsx b/src-web/components/GrpcConnectionLayout.tsx index 10fdaa9e..7d0aeaf6 100644 --- a/src-web/components/GrpcConnectionLayout.tsx +++ b/src-web/components/GrpcConnectionLayout.tsx @@ -87,7 +87,6 @@ export function GrpcConnectionLayout({ style }: Props) { onCommit={grpc.commit.mutate} onCancel={grpc.cancel.mutate} onSend={grpc.send.mutate} - onReflectRefetch={grpc.reflect.refetch} services={services ?? null} reflectionError={grpc.reflect.error as string | undefined} reflectionLoading={grpc.reflect.isFetching} diff --git a/src-web/components/GrpcConnectionSetupPane.tsx b/src-web/components/GrpcConnectionSetupPane.tsx index 886aa0b6..82eeb19b 100644 --- a/src-web/components/GrpcConnectionSetupPane.tsx +++ b/src-web/components/GrpcConnectionSetupPane.tsx @@ -34,7 +34,6 @@ interface Props { onClientStreaming: () => void; onServerStreaming: () => void; onStreaming: () => void; - onReflectRefetch: () => void; services: ReflectResponseService[] | null; } @@ -45,7 +44,6 @@ export function GrpcConnectionSetupPane({ activeRequest, reflectionError, reflectionLoading, - onReflectRefetch, onStreaming, onClientStreaming, onServerStreaming, @@ -230,7 +228,6 @@ export function GrpcConnectionSetupPane({ className="bg-gray-50" reflectionError={reflectionError} reflectionLoading={reflectionLoading} - onReflect={onReflectRefetch} request={activeRequest} /> diff --git a/src-web/components/RecentConnectionsDropdown.tsx b/src-web/components/RecentConnectionsDropdown.tsx index 1e69ac4f..0c4f8f5f 100644 --- a/src-web/components/RecentConnectionsDropdown.tsx +++ b/src-web/components/RecentConnectionsDropdown.tsx @@ -1,8 +1,8 @@ -import { formatDistanceToNow } from 'date-fns'; +import { formatDistanceToNowStrict } from 'date-fns'; import { useDeleteGrpcConnection } from '../hooks/useDeleteGrpcConnection'; import { useDeleteGrpcConnections } from '../hooks/useDeleteGrpcConnections'; import type { GrpcConnection } from '../lib/models'; -import { pluralize } from '../lib/pluralize'; +import { count, pluralize } from '../lib/pluralize'; import { Dropdown } from './core/Dropdown'; import { Icon } from './core/Icon'; import { IconButton } from './core/IconButton'; @@ -14,27 +14,23 @@ interface Props { onPinned: (r: GrpcConnection) => void; } -export const RecentConnectionsDropdown = function ResponsePane({ - activeConnection, - connections, - onPinned, -}: Props) { - const deleteResponse = useDeleteGrpcConnection(activeConnection?.id ?? null); - const deleteAllResponses = useDeleteGrpcConnections(activeConnection?.requestId); +export function RecentConnectionsDropdown({ activeConnection, connections, onPinned }: Props) { + const deleteConnection = useDeleteGrpcConnection(activeConnection?.id ?? null); + const deleteAllConnections = useDeleteGrpcConnections(activeConnection?.requestId); return ( - {formatDistanceToNow(c.createdAt)} •{' '} + {formatDistanceToNowStrict(c.createdAt + 'Z')} ago •{' '} {c.elapsed}ms ), @@ -53,7 +49,7 @@ export const RecentConnectionsDropdown = function ResponsePane({ ]} > ); -}; +} diff --git a/src-web/components/core/FormattedError.tsx b/src-web/components/core/FormattedError.tsx index be9f456f..27b2da83 100644 --- a/src-web/components/core/FormattedError.tsx +++ b/src-web/components/core/FormattedError.tsx @@ -6,7 +6,6 @@ interface Props { } export function FormattedError({ children }: Props) { - console.log('ERROR', children); return (