diff --git a/src/components/common/CheckBox/index.tsx b/src/components/common/CheckBox/index.tsx index 968185f..2f089bf 100644 --- a/src/components/common/CheckBox/index.tsx +++ b/src/components/common/CheckBox/index.tsx @@ -10,7 +10,7 @@ import { Icon } from '../Icon' export interface CheckBoxProps { check: boolean - label: string + label?: string children?: React.ReactNode onChange: (check: boolean) => void disabled?: boolean diff --git a/src/screens/Home/Views/Setting/settings/Basic/Source.tsx b/src/screens/Home/Views/Setting/settings/Basic/Source.tsx index ee74652..e097af8 100644 --- a/src/screens/Home/Views/Setting/settings/Basic/Source.tsx +++ b/src/screens/Home/Views/Setting/settings/Basic/Source.tsx @@ -12,6 +12,8 @@ import { useSettingValue } from '@/store/setting/hook' import { useStatus, useUserApiList } from '@/store/userApi' import Button from '../../components/Button' import UserApiEditModal, { type UserApiEditModalType } from './UserApiEditModal' +import Text from '@/components/common/Text' +import { useTheme } from '@/store/theme/hook' // import { importUserApi, removeUserApi } from '@/core/userApi' const apiSourceList = apiSourceInfo.map(api => ({ @@ -26,14 +28,29 @@ const useActive = (id: string) => { return isActive } -const Item = ({ id, name, change }: { +const Item = ({ id, name, desc, statusLabel, change }: { id: string name: string + desc?: string + statusLabel?: string change: (id: string) => void }) => { const isActive = useActive(id) + const theme = useTheme() // const [toggleCheckBox, setToggleCheckBox] = useState(false) - return { change(id) }} need /> + return ( + { change(id) }} need> + + {name} + { + desc ? {desc} : null + } + { + statusLabel ? {statusLabel} : null + } + + + ) } export default memo(() => { @@ -59,9 +76,13 @@ export default memo(() => { return status } return userApiListRaw.map(api => { + const statusLabel = api.id == apiSourceSetting ? `[${getApiStatus()}]` : '' return { id: api.id, - name: `${api.name}${api.id == apiSourceSetting ? `[${getApiStatus()}]` : ''}`, + name: api.name, + label: `${api.name}${statusLabel}`, + desc: [/^\d/.test(api.version) ? `v${api.version}` : api.version, api.author].filter(Boolean).join(', '), + statusLabel, // status: apiStatus.status, // message: apiStatus.message, // disabled: false, @@ -81,7 +102,7 @@ export default memo(() => { list.map(({ id, name }) => ) } { - userApiList.map(({ id, name }) => ) + userApiList.map(({ id, name, desc, statusLabel }) => ) } @@ -103,4 +124,13 @@ const styles = createStyle({ marginTop: 10, flexDirection: 'row', }, + sourceLabel: { + + }, + sourceDesc: { + + }, + sourceStatus: { + + }, }) diff --git a/src/screens/Home/Views/Setting/settings/Basic/UserApiEditModal/List.tsx b/src/screens/Home/Views/Setting/settings/Basic/UserApiEditModal/List.tsx index af3e2a2..d518cec 100644 --- a/src/screens/Home/Views/Setting/settings/Basic/UserApiEditModal/List.tsx +++ b/src/screens/Home/Views/Setting/settings/Basic/UserApiEditModal/List.tsx @@ -39,12 +39,12 @@ const ListItem = ({ item, activeId, onRemove, onChangeAllowShowUpdateAlert }: { {item.name} { item.version ? ( - { ' ' + formatVersionName(item.version) } + { ' ' + formatVersionName(item.version) } ) : null } { item.author ? ( - { ' ' + item.author } + { ' ' + item.author } ) : null } diff --git a/src/types/user_api.d.ts b/src/types/user_api.d.ts index 139a830..5a81c30 100644 --- a/src/types/user_api.d.ts +++ b/src/types/user_api.d.ts @@ -19,9 +19,9 @@ declare namespace LX { description: string // script: string allowShowUpdateAlert: boolean - author?: string - homepage?: string - version?: string + author: string + homepage: string + version: string sources?: UserApiSources }