2023-09-01 18:31:44 +08:00
|
|
|
import InfiniteScroll from 'solid-infinite-scroll'
|
|
|
|
import { createMemo, createSignal } from 'solid-js'
|
2023-09-03 05:35:08 +08:00
|
|
|
import { ProxyNodeCard } from '~/components'
|
2023-09-01 18:31:44 +08:00
|
|
|
|
2023-09-03 03:26:29 +08:00
|
|
|
export const ProxyCardGroups = (props: {
|
2023-09-03 06:08:53 +08:00
|
|
|
proxyNames: string[]
|
2023-09-01 18:37:19 +08:00
|
|
|
now?: string
|
|
|
|
onClick?: (name: string) => void
|
|
|
|
}) => {
|
2023-09-02 15:00:13 +08:00
|
|
|
const [maxRender, setMaxRender] = createSignal(100)
|
2023-09-03 06:08:53 +08:00
|
|
|
const proxyNames = createMemo(() => props.proxyNames.slice(0, maxRender()))
|
2023-09-01 18:31:44 +08:00
|
|
|
|
|
|
|
return (
|
|
|
|
<InfiniteScroll
|
2023-09-03 06:08:53 +08:00
|
|
|
each={proxyNames()}
|
|
|
|
hasMore={proxyNames().length < props.proxyNames.length}
|
2023-09-01 18:31:44 +08:00
|
|
|
next={() => setMaxRender(maxRender() + 30)}
|
|
|
|
>
|
|
|
|
{(proxy) => (
|
2023-09-01 18:37:19 +08:00
|
|
|
<ProxyNodeCard
|
|
|
|
proxyName={proxy}
|
|
|
|
isSelected={props.now === proxy}
|
|
|
|
onClick={() => {
|
|
|
|
props.onClick?.(proxy!)
|
|
|
|
}}
|
|
|
|
/>
|
2023-09-01 18:31:44 +08:00
|
|
|
)}
|
|
|
|
</InfiniteScroll>
|
|
|
|
)
|
|
|
|
}
|