fixed ts build error

This commit is contained in:
LittleBoy 2024-12-23 10:37:22 +08:00
parent c73911eb95
commit 348d23f72c
9 changed files with 12 additions and 11 deletions

View File

@ -16,7 +16,7 @@ const TagSelect = (props: {
const allValues = useMemo(()=>{
const values:Id[][] = []
props.options.forEach(item=>{
if(item && item.children?.length > 0){
if(item && item.children?.length){
// eslint-disable-next-line no-unsafe-optional-chaining
values.push(...(item.children?.map(c => [item.value, c.value])))
}

View File

@ -10,7 +10,7 @@ export type InfiniteScrollerProps = {
rootClassName?: string;
style?: CSSProperties;
loadingPlaceholder?: React.ReactNode;
onCallback: (page: number, prevPage) => void;
onCallback?: (page: number, prevPage) => void;
onScroll?: (top: number) => void;
empty?: React.ReactNode;
loading?: boolean;
@ -53,7 +53,7 @@ const InfiniteScroller = React.forwardRef<InfiniteScrollerRef, InfiniteScrollerP
const maxPage = Math.ceil((pagination.total || 0) / pagination.limit)
const currentPage = pagination.page
if (maxPage > currentPage) {
props.onCallback(currentPage + 1, currentPage)
props.onCallback?.(currentPage + 1, currentPage)
}
}
}, [inView])

View File

@ -222,7 +222,11 @@ export default function LiveIndex() {
</div>
<div className="">
<div className="live-video-list-sort-container ">
<InfiniteScroller ref={scrollerRef} onScroll={top => setState({showToTop: top > 30})}>
<InfiniteScroller
ref={scrollerRef}
onScroll={top => setState({showToTop: top > 30})}
onCallback={()=>{}}
>
<div className="sort-list-container flex-1">
<DndContext onDragEnd={(e) => {
const {active, over} = e;

View File

@ -5,7 +5,7 @@ import {push2article} from "@/service/api/news.ts";
import {IconDelete} from "@/components/icons";
import {useNavigate} from "react-router-dom";
export default function ButtonDeleteBatch(props: { ids: Id[]; }) {
export default function ButtonDeleteBatch(props: { ids: Id[];onSuccess?: () => void; }) {
const {modal} = App.useApp();
const [loading, setLoading] = useState(false)
const navigate = useNavigate();

View File

@ -31,7 +31,6 @@ export default function ButtonPush2Video(props: { ids: Id[]; onSuccess?: () => v
return (
<div>
<button
type="primary"
disabled={loading}
className='bg-[#4096ff] hover:bg-blue-600 text-white'
onClick={onPushClick}

View File

@ -54,7 +54,7 @@ export default function EditSearchForm(props: {
type="text" className="rounded-3xl px-3 w-[270px]"
prefix={<SearchOutlined/>}
placeholder="请输入新闻标题关键词进行搜索"
onPressEnter={handleSubmit}
onPressEnter={()=>handleSubmit()}
/>
{/*<span className="ml-5 text-sm">来源</span>*/}
{/*<ArticleCascader*/}

View File

@ -83,7 +83,7 @@ export default function SearchPanel({onSearch}: SearchPanelProps) {
if (tags?.length > 0) {
const pinnedList = pinnedTag && pinnedTag?.length > 0 ? pinnedTag : tags.map(s => s.value)
return pinnedList.filter(it => tags.findIndex(s => s.value == it) != -1)
.sort((a, b) => a - b)
.sort((a, b) => Number(a) - Number(b))
.map(it => (tags.find(s => s.value == it) as OptionItem))
}
return [] as OptionItem[];
@ -99,7 +99,6 @@ export default function SearchPanel({onSearch}: SearchPanelProps) {
placeholder={'请输入新闻标题关键词进行搜索'}
onPressEnter={onFinish}
onBlur={onFinish}
shape="round"
prefix={<SearchOutlined/>}
/>
<TimeSelect

View File

@ -38,7 +38,6 @@ export default function ButtonPush2Room(props: { ids: Id[]; list: VideoInfo[];on
<div>
<button
type="primary"
disabled={loading}
className='bg-[#4096ff] hover:bg-blue-600 text-white'
onClick={onPushClick}

View File

@ -42,7 +42,7 @@ export function DashboardNavigation() {
{NavItems.map((it, idx) => (<div key={idx} className={"flex items-center"}>
{user ? <NavLink to={it.path} className={clsx('nav-item cursor-pointer items-center')}>
<span className="menu-text ml-2">{it.name}</span>
</NavLink> : <div to={it.path} className={clsx('nav-item cursor-pointer items-center')}>
</NavLink> : <div className={clsx('nav-item cursor-pointer items-center')}>
<span className="menu-text ml-2">{it.name}</span>
</div>}
{idx !== NavItems.length - 1 && <IconNavigationArrow className="ml-2" />}