mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-04 03:22:09 +08:00
显示源版本号信息
This commit is contained in:
parent
2914d10fbb
commit
91875eca87
@ -10,7 +10,7 @@ import { Icon } from '../Icon'
|
|||||||
|
|
||||||
export interface CheckBoxProps {
|
export interface CheckBoxProps {
|
||||||
check: boolean
|
check: boolean
|
||||||
label: string
|
label?: string
|
||||||
children?: React.ReactNode
|
children?: React.ReactNode
|
||||||
onChange: (check: boolean) => void
|
onChange: (check: boolean) => void
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
|
@ -12,6 +12,8 @@ import { useSettingValue } from '@/store/setting/hook'
|
|||||||
import { useStatus, useUserApiList } from '@/store/userApi'
|
import { useStatus, useUserApiList } from '@/store/userApi'
|
||||||
import Button from '../../components/Button'
|
import Button from '../../components/Button'
|
||||||
import UserApiEditModal, { type UserApiEditModalType } from './UserApiEditModal'
|
import UserApiEditModal, { type UserApiEditModalType } from './UserApiEditModal'
|
||||||
|
import Text from '@/components/common/Text'
|
||||||
|
import { useTheme } from '@/store/theme/hook'
|
||||||
// import { importUserApi, removeUserApi } from '@/core/userApi'
|
// import { importUserApi, removeUserApi } from '@/core/userApi'
|
||||||
|
|
||||||
const apiSourceList = apiSourceInfo.map(api => ({
|
const apiSourceList = apiSourceInfo.map(api => ({
|
||||||
@ -26,14 +28,29 @@ const useActive = (id: string) => {
|
|||||||
return isActive
|
return isActive
|
||||||
}
|
}
|
||||||
|
|
||||||
const Item = ({ id, name, change }: {
|
const Item = ({ id, name, desc, statusLabel, change }: {
|
||||||
id: string
|
id: string
|
||||||
name: string
|
name: string
|
||||||
|
desc?: string
|
||||||
|
statusLabel?: string
|
||||||
change: (id: string) => void
|
change: (id: string) => void
|
||||||
}) => {
|
}) => {
|
||||||
const isActive = useActive(id)
|
const isActive = useActive(id)
|
||||||
|
const theme = useTheme()
|
||||||
// const [toggleCheckBox, setToggleCheckBox] = useState(false)
|
// 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(() => {
|
export default memo(() => {
|
||||||
@ -59,9 +76,13 @@ export default memo(() => {
|
|||||||
return status
|
return status
|
||||||
}
|
}
|
||||||
return userApiListRaw.map(api => {
|
return userApiListRaw.map(api => {
|
||||||
|
const statusLabel = api.id == apiSourceSetting ? `[${getApiStatus()}]` : ''
|
||||||
return {
|
return {
|
||||||
id: api.id,
|
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,
|
// status: apiStatus.status,
|
||||||
// message: apiStatus.message,
|
// message: apiStatus.message,
|
||||||
// disabled: false,
|
// disabled: false,
|
||||||
@ -81,7 +102,7 @@ export default memo(() => {
|
|||||||
list.map(({ id, name }) => <Item name={name} id={id} key={id} change={setApiSourceId} />)
|
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>
|
||||||
<View style={styles.btn}>
|
<View style={styles.btn}>
|
||||||
@ -103,4 +124,13 @@ const styles = createStyle({
|
|||||||
marginTop: 10,
|
marginTop: 10,
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
},
|
},
|
||||||
|
sourceLabel: {
|
||||||
|
|
||||||
|
},
|
||||||
|
sourceDesc: {
|
||||||
|
|
||||||
|
},
|
||||||
|
sourceStatus: {
|
||||||
|
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
@ -39,12 +39,12 @@ const ListItem = ({ item, activeId, onRemove, onChangeAllowShowUpdateAlert }: {
|
|||||||
{item.name}
|
{item.name}
|
||||||
{
|
{
|
||||||
item.version ? (
|
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
|
) : null
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
item.author ? (
|
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
|
) : null
|
||||||
}
|
}
|
||||||
</Text>
|
</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
|
description: string
|
||||||
// script: string
|
// script: string
|
||||||
allowShowUpdateAlert: boolean
|
allowShowUpdateAlert: boolean
|
||||||
author?: string
|
author: string
|
||||||
homepage?: string
|
homepage: string
|
||||||
version?: string
|
version: string
|
||||||
sources?: UserApiSources
|
sources?: UserApiSources
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user