upgrade react 19, remove preact usage

This commit is contained in:
2024-12-27 15:43:48 +08:00
parent 4b36debd0b
commit 48ead03629
14 changed files with 43 additions and 43 deletions

View File

@@ -1,13 +1,7 @@
import { themeChange } from "theme-change";
import { createRef } from "preact";
import {
StateUpdater,
useContext,
useEffect,
useState,
Dispatch,
} from "preact/hooks";
import { useRef } from "react";
import { useContext, useEffect, useState, Dispatch } from "react";
import { clearTotalCost, getTotalCost } from "@/utils/totalCost";
import {
ChatStore,
@@ -484,7 +478,7 @@ const Choice = (props: {
export default (props: {
chatStore: ChatStore;
setChatStore: (cs: ChatStore) => void;
setShow: Dispatch<StateUpdater<boolean>>;
setShow: Dispatch<boolean>;
selectedChatStoreIndex: number;
templates: TemplateChatStore[];
setTemplates: (templates: TemplateChatStore[]) => void;
@@ -515,7 +509,7 @@ export default (props: {
link = link + `&dev=true`;
}
const importFileRef = createRef();
const importFileRef = useRef<any>(null);
const [totalCost, setTotalCost] = useState(getTotalCost());
// @ts-ignore
const { langCode, setLangCode } = useContext(langCodeContext);

View File

@@ -1,7 +1,7 @@
import { createRef } from "preact";
import { createRef } from "react";
import { ChatStore } from "@/types/chatstore";
import { StateUpdater, useEffect, useState, Dispatch } from "preact/hooks";
import { useEffect, useState, Dispatch } from "react";
import { Button } from "@/components/ui/button";
import {
AudioWaveform,
@@ -14,7 +14,7 @@ import {
const WhisperButton = (props: {
chatStore: ChatStore;
inputMsg: string;
setInputMsg: Dispatch<StateUpdater<string>>;
setInputMsg: Dispatch<string>;
}) => {
const { chatStore, inputMsg, setInputMsg } = props;
const mediaRef = createRef();
@@ -25,7 +25,7 @@ const WhisperButton = (props: {
size="icon"
className={`m-1 p-1 ${isRecording !== "Mic" ? "animate-pulse" : ""}`}
disabled={isRecording === "Transcribing"}
ref={mediaRef}
ref={mediaRef as any}
onClick={async (event) => {
event.preventDefault(); // Prevent the default behavior

View File

@@ -57,14 +57,18 @@ function Calendar({
day_hidden: "invisible",
...classNames,
}}
components={{
IconLeft: ({ className, ...props }) => (
components={
{
/*
IconLeft: ({ className, ...props }: any) => (
<ChevronLeft className={cn("h-4 w-4", className)} {...props} />
),
IconRight: ({ className, ...props }) => (
IconRight: ({ className, ...props }: any) => (
<ChevronRight className={cn("h-4 w-4", className)} {...props} />
),
}}
*/
}
}
{...props}
/>
);