mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-04 09:42:10 +08:00
显示源版本号信息
This commit is contained in:
parent
2914d10fbb
commit
91875eca87
@ -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
|
||||
|
@ -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 <CheckBox marginBottom={5} check={isActive} label={name} onChange={() => { change(id) }} need />
|
||||
return (
|
||||
<CheckBox marginBottom={5} check={isActive} onChange={() => { change(id) }} need>
|
||||
<Text style={styles.sourceLabel}>
|
||||
{name}
|
||||
{
|
||||
desc ? <Text style={styles.sourceDesc} color={theme['c-500']} size={13}> {desc}</Text> : null
|
||||
}
|
||||
{
|
||||
statusLabel ? <Text style={styles.sourceStatus} size={13}> {statusLabel}</Text> : null
|
||||
}
|
||||
</Text>
|
||||
</CheckBox>
|
||||
)
|
||||
}
|
||||
|
||||
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 }) => <Item name={name} id={id} key={id} change={setApiSourceId} />)
|
||||
}
|
||||
{
|
||||
userApiList.map(({ id, name }) => <Item name={name} id={id} key={id} change={setApiSourceId} />)
|
||||
userApiList.map(({ id, name, desc, statusLabel }) => <Item name={name} desc={desc} statusLabel={statusLabel} id={id} key={id} change={setApiSourceId} />)
|
||||
}
|
||||
</View>
|
||||
<View style={styles.btn}>
|
||||
@ -103,4 +124,13 @@ const styles = createStyle({
|
||||
marginTop: 10,
|
||||
flexDirection: 'row',
|
||||
},
|
||||
sourceLabel: {
|
||||
|
||||
},
|
||||
sourceDesc: {
|
||||
|
||||
},
|
||||
sourceStatus: {
|
||||
|
||||
},
|
||||
})
|
||||
|
@ -39,12 +39,12 @@ const ListItem = ({ item, activeId, onRemove, onChangeAllowShowUpdateAlert }: {
|
||||
{item.name}
|
||||
{
|
||||
item.version ? (
|
||||
<Text size={11} color={theme['c-font-label']}>{ ' ' + formatVersionName(item.version) }</Text>
|
||||
<Text size={12} color={theme['c-font-label']}>{ ' ' + formatVersionName(item.version) }</Text>
|
||||
) : null
|
||||
}
|
||||
{
|
||||
item.author ? (
|
||||
<Text size={11} color={theme['c-font-label']}>{ ' ' + item.author }</Text>
|
||||
<Text size={12} color={theme['c-font-label']}>{ ' ' + item.author }</Text>
|
||||
) : null
|
||||
}
|
||||
</Text>
|
||||
|
6
src/types/user_api.d.ts
vendored
6
src/types/user_api.d.ts
vendored
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user