mirror of
https://github.com/tale/headplane.git
synced 2026-08-26 04:16:49 +00:00
fix: resolve type errors and lint components/routes
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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 ? (
|
||||
|
||||
Reference in New Issue
Block a user