import cx from 'clsx'; import * as React from 'react'; import { Eye, EyeOff, X as Close } from '~/components/shared/FeatherIcons'; import { useToggle } from '~/hooks/basic'; import type { ClashAPIConfigWithAddedAt } from '~/store/types'; import type { ClashAPIConfig } from '~/types'; import s from './BackendList.module.scss'; type Props = { apiConfigs: ClashAPIConfigWithAddedAt[]; selectedClashAPIConfigIndex: number; onRemove: (x: ClashAPIConfig) => void; onSelect: (x: ClashAPIConfig) => void; }; export function BackendList({ apiConfigs, selectedClashAPIConfigIndex, onRemove, onSelect, }: Props) { return ( <> ); } function Item({ baseURL, secret, disableRemove, onRemove, onSelect, }: { baseURL: string; secret?: string; disableRemove: boolean; onRemove: (x: ClashAPIConfig) => void; onSelect: (x: ClashAPIConfig) => void; }) { const [show, toggle] = useToggle(); const Icon = show ? EyeOff : Eye; const handleTap = React.useCallback((e: React.KeyboardEvent) => { e.stopPropagation(); }, []); return ( <> onSelect({ baseURL, secret })} onKeyUp={handleTap} > {baseURL} {secret ? ( <> {show ? secret : '***'} ) : null} ); } function Button({ children, onClick, className, disabled, }: { children: React.ReactNode; onClick?: (e: React.MouseEvent) => unknown; className: string; disabled?: boolean; }) { return ( ); }