fix: resolve type errors and lint components/routes

This commit is contained in:
Aarnav Tale
2025-01-06 08:18:46 +05:30
parent 414b95c293
commit 6745ee8529
13 changed files with 63 additions and 28 deletions
+6 -2
View File
@@ -1,4 +1,4 @@
import { useState, type HTMLProps } from 'react';
import { useState, HTMLProps } from 'react';
import { CopyIcon, CheckIcon } from '@primer/octicons-react';
import { cn } from '~/utils/cn';
import { toast } from '~/components/Toaster';
@@ -20,7 +20,7 @@ export default function Code(props: Props) {
>
{props.children}
</code>
{props.isCopyable && props.children ? (
{props.isCopyable ? (
<button
className={cn(
'ml-1 p-1 rounded-md',
@@ -29,6 +29,10 @@ export default function Code(props: Props) {
'inline-flex items-center justify-center',
)}
onClick={() => {
if (!props.children) {
throw new Error('Made copyable without children');
}
navigator.clipboard.writeText(props.children.join(''));
toast('Copied to clipboard');
setIsCopied(true);
+5 -1
View File
@@ -1,12 +1,16 @@
import { cn } from '~/utils/cn';
import Link from '~/components/Link';
declare global {
const __VERSION__: string;
}
interface FooterProps {
url: string;
debug: boolean;
}
export default function Footer({ url, debug, integration }: FooterProps) {
export default function Footer({ url, debug }: FooterProps) {
return (
<footer
className={cn(
+11 -6
View File
@@ -1,7 +1,15 @@
import { XIcon } from '@primer/octicons-react';
import { type AriaToastProps, useToast, useToastRegion } from '@react-aria/toast';
import { ToastQueue, type ToastState, useToastQueue } from '@react-stately/toast';
import { type ReactNode, useRef } from 'react';
import {
AriaToastProps,
useToast,
useToastRegion,
} from '@react-aria/toast';
import {
ToastQueue,
ToastState,
useToastQueue,
} from '@react-stately/toast';
import { ReactNode, useRef } from 'react';
import { Button } from 'react-aria-components';
import { createPortal } from 'react-dom';
import { ClientOnly } from 'remix-utils/client-only';
@@ -14,7 +22,6 @@ type ToastProps = AriaToastProps<ReactNode> & {
function Toast({ state, ...properties }: ToastProps) {
const reference = useRef(null);
// @ts-expect-error: RefObject doesn't map to FocusableElement?
const { toastProps, titleProps, closeButtonProps } = useToast(
properties,
state,
@@ -58,13 +65,11 @@ export function Toaster() {
const reference = useRef(null);
const state = useToastQueue(toasts);
// @ts-expect-error: React 19 has weird types for Portal vs Node
const { regionProps } = useToastRegion({}, state, reference);
return (
<ClientOnly>
{
// @ts-expect-error: Portal doesn't match Node in React 19 yet
() =>
createPortal(
state.visibleToasts.length >= 0 ? (