2025-06-18 15:04:40 +08:00
|
|
|
'use client'
|
|
|
|
import type { FC } from 'react'
|
2025-06-19 16:11:02 +08:00
|
|
|
import React, { useCallback } from 'react'
|
2025-06-18 15:04:40 +08:00
|
|
|
import type { AutoUpdateConfig } from './types'
|
2025-06-19 16:11:02 +08:00
|
|
|
import Label from '../label'
|
|
|
|
import StrategyPicker from './strategy-picker'
|
2025-06-18 15:04:40 +08:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
payload: AutoUpdateConfig
|
2025-06-19 16:11:02 +08:00
|
|
|
onChange: (payload: AutoUpdateConfig) => void
|
2025-06-18 15:04:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const AutoUpdateSetting: FC<Props> = ({
|
|
|
|
payload,
|
2025-06-19 16:11:02 +08:00
|
|
|
onChange,
|
2025-06-18 15:04:40 +08:00
|
|
|
}) => {
|
2025-06-19 16:11:02 +08:00
|
|
|
const { strategy_setting } = payload
|
|
|
|
const handleChange = useCallback((key: keyof AutoUpdateConfig) => {
|
|
|
|
return (value: AutoUpdateConfig[keyof AutoUpdateConfig]) => {
|
|
|
|
onChange({
|
|
|
|
...payload,
|
|
|
|
[key]: value,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}, [payload, onChange])
|
2025-06-18 15:04:40 +08:00
|
|
|
return (
|
2025-06-19 16:11:02 +08:00
|
|
|
<div className='self-stretch px-6'>
|
|
|
|
<div className='my-3 flex items-center'>
|
|
|
|
<div className='system-xs-medium-uppercase text-text-tertiary'>Updates Settings</div>
|
|
|
|
<div className='ml-2 h-px grow bg-divider-subtle'></div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className='space-y-4'>
|
|
|
|
<div className='flex items-center justify-between'>
|
|
|
|
<Label label='Automatic updates' />
|
|
|
|
<StrategyPicker value={strategy_setting} onChange={handleChange('strategy_setting')} />
|
|
|
|
</div>
|
|
|
|
<div className='flex items-center justify-between'>
|
|
|
|
<Label label='Update time' />
|
|
|
|
</div>
|
|
|
|
<div className='flex items-center'>
|
|
|
|
<Label label='Specify plugins to update' />
|
|
|
|
</div>
|
|
|
|
</div>
|
2025-06-18 15:04:40 +08:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
export default React.memo(AutoUpdateSetting)
|