Fix types

This commit is contained in:
Konstantin Wohlwend
2026-06-01 16:25:49 -07:00
parent f9d081da09
commit 2e1bfecb5f
24 changed files with 215 additions and 656 deletions
+22 -6
View File
@@ -185,12 +185,28 @@ function renderNode(node: MessageNode, index: number): React.ReactNode {
}
case 'heading': {
const HeadingTag = `h${Math.min(node.level || 1, 6)}` as keyof JSX.IntrinsicElements;
return (
<HeadingTag key={index} className="font-semibold mt-4 mb-2 text-sm">
{node.children?.map(renderNode)}
</HeadingTag>
);
const children = node.children?.map(renderNode);
const className = "font-semibold mt-4 mb-2 text-sm";
switch (Math.min(node.level || 1, 6)) {
case 1: {
return <h1 key={index} className={className}>{children}</h1>;
}
case 2: {
return <h2 key={index} className={className}>{children}</h2>;
}
case 3: {
return <h3 key={index} className={className}>{children}</h3>;
}
case 4: {
return <h4 key={index} className={className}>{children}</h4>;
}
case 5: {
return <h5 key={index} className={className}>{children}</h5>;
}
default: {
return <h6 key={index} className={className}>{children}</h6>;
}
}
}
case 'paragraph': {
@@ -202,7 +202,7 @@ export function CustomSearchDialog({ open, onOpenChange }: CustomSearchDialogPro
const [selectedIndex, setSelectedIndex] = useState(0);
const inputRef = useRef<HTMLInputElement>(null);
const searchTimeoutRef = useRef<NodeJS.Timeout>();
const searchTimeoutRef = useRef<NodeJS.Timeout | null>(null);
const sidebarContext = useSidebar();
// Handle AI chat opening
+1 -1
View File
@@ -21,7 +21,7 @@ export type BaseCodeblockProps = {
/** Custom key to force re-render when theme changes externally */
themeKey?: string,
/** Ref to attach to the code container div for measuring line positions */
codeContainerRef?: React.RefObject<HTMLDivElement>,
codeContainerRef?: React.RefObject<HTMLDivElement | null>,
};
/**
+2 -2
View File
@@ -3,7 +3,7 @@
import { useUser } from '@hexclave/next';
import { runAsynchronously } from '@hexclave/shared/dist/utils/promises';
import { decodeProtectedHeader, decodeJwt as joseDecodeJwt } from 'jose';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { useCallback, useEffect, useMemo, useRef, useState, type ReactElement } from 'react';
import { cn } from '../../lib/cn';
type DecodedJWT = {
@@ -177,7 +177,7 @@ export function JWTViewer({ defaultToken = '', className = '' }: JWTViewerProps)
return { status, exp, iat, nbf, issuer, audience, subject } as const;
}, [decoded]);
const summaryRows: Array<{ key: string, label: string, content: JSX.Element }> = [];
const summaryRows: Array<{ key: string, label: string, content: ReactElement }> = [];
if (decoded && tokenMeta) {
if (tokenMeta.issuer) {
summaryRows.push({