workflow publish

This commit is contained in:
StyleZhang
2024-03-18 18:38:17 +08:00
parent 7320ac41af
commit 4eb7546177
23 changed files with 375 additions and 80 deletions

View File

@ -13,9 +13,11 @@ import { File05 } from '@/app/components/base/icons/src/vender/solid/files'
type FileUploadProps = {
onChange?: OnFeaturesChange
disabled?: boolean
}
const FileUpload = ({
onChange,
disabled,
}: FileUploadProps) => {
const { t } = useTranslation()
const featuresStore = useFeaturesStore()
@ -45,11 +47,12 @@ const FileUpload = ({
</div>
<div className='grow' />
<div className='flex items-center'>
<ParamConfig onChange={onChange} />
<ParamConfig onChange={onChange} disabled={disabled} />
<div className='ml-4 mr-3 w-[1px] h-3.5 bg-gray-200'></div>
<Switch
defaultValue={file.image.enabled}
onChange={handleSwitch}
disabled={disabled}
size='md'
/>
</div>

View File

@ -14,9 +14,11 @@ import {
type ParamsConfigProps = {
onChange?: OnFeaturesChange
disabled?: boolean
}
const ParamsConfig = ({
onChange,
disabled,
}: ParamsConfigProps) => {
const { t } = useTranslation()
const [open, setOpen] = useState(false)
@ -30,8 +32,8 @@ const ParamsConfig = ({
mainAxis: 4,
}}
>
<PortalToFollowElemTrigger onClick={() => setOpen(v => !v)}>
<div className={cn('flex items-center rounded-md h-7 px-3 space-x-1 text-gray-700 cursor-pointer hover:bg-gray-200', open && 'bg-gray-200')}>
<PortalToFollowElemTrigger onClick={() => !disabled && setOpen(v => !v)}>
<div className={cn('flex items-center rounded-md h-7 px-3 space-x-1 text-gray-700 cursor-pointer hover:bg-gray-200', open && 'bg-gray-200', disabled && 'cursor-not-allowed opacity-50')}>
<Settings01 className='w-3.5 h-3.5 ' />
<div className='ml-1 leading-[18px] text-xs font-medium '>{t('appDebug.voice.settings')}</div>
</div>

View File

@ -17,10 +17,12 @@ import Moderation from './moderation'
export type FeaturePanelProps = {
onChange?: OnFeaturesChange
openingStatementProps: OpeningStatementProps
disabled?: boolean
}
const FeaturePanel = ({
onChange,
openingStatementProps,
disabled,
}: FeaturePanelProps) => {
const { t } = useTranslation()
const features = useFeatures(s => s.features)
@ -35,7 +37,10 @@ const FeaturePanel = ({
return (
<div className='space-y-3'>
<FileUpload onChange={onChange} />
<FileUpload
onChange={onChange}
disabled={disabled}
/>
{
showAdvanceFeature && (
<div>
@ -51,7 +56,11 @@ const FeaturePanel = ({
<div className='py-2 space-y-2'>
{
features.opening.enabled && (
<OpeningStatement {...openingStatementProps} onChange={onChange} />
<OpeningStatement
{...openingStatementProps}
onChange={onChange}
readonly={disabled}
/>
)
}
{
@ -61,7 +70,7 @@ const FeaturePanel = ({
}
{
features.text2speech.enabled && (
<TextToSpeech onChange={onChange} />
<TextToSpeech onChange={onChange} disabled={disabled} />
)
}
{
@ -93,7 +102,7 @@ const FeaturePanel = ({
<div className='py-2 space-y-2'>
{
features.moderation.enabled && (
<Moderation onChange={onChange} />
<Moderation onChange={onChange} disabled={disabled} />
)
}
</div>

View File

@ -16,9 +16,11 @@ import I18n from '@/context/i18n'
type ModerationProps = {
onChange?: OnFeaturesChange
disabled?: boolean
}
const Moderation = ({
onChange,
disabled,
}: ModerationProps) => {
const { t } = useTranslation()
const { setShowModerationSettingModal } = useModalContext()
@ -32,6 +34,9 @@ const Moderation = ({
)
const handleOpenModerationSettingModal = () => {
if (disabled)
return
const {
features,
setFeatures,
@ -89,6 +94,7 @@ const Moderation = ({
className={`
shrink-0 flex items-center px-3 h-7 cursor-pointer rounded-md
text-xs text-gray-700 font-medium hover:bg-gray-200
${disabled && '!cursor-not-allowed'}
`}
onClick={handleOpenModerationSettingModal}
>

View File

@ -13,9 +13,11 @@ import AudioBtn from '@/app/components/base/audio-btn'
type TextToSpeechProps = {
onChange?: OnFeaturesChange
disabled?: boolean
}
const TextToSpeech = ({
onChange,
disabled,
}: TextToSpeechProps) => {
const { t } = useTranslation()
const textToSpeech = useFeatures(s => s.features.text2speech)
@ -50,7 +52,7 @@ const TextToSpeech = ({
)}
</div>
<div className='shrink-0 flex items-center'>
<ParamsConfig onChange={onChange} />
<ParamsConfig onChange={onChange} disabled={disabled} />
</div>
</div>
)

View File

@ -13,9 +13,11 @@ import {
type ParamsConfigProps = {
onChange?: OnFeaturesChange
disabled?: boolean
}
const ParamsConfig = ({
onChange,
disabled,
}: ParamsConfigProps) => {
const { t } = useTranslation()
const [open, setOpen] = useState(false)
@ -29,7 +31,7 @@ const ParamsConfig = ({
mainAxis: 4,
}}
>
<PortalToFollowElemTrigger onClick={() => setOpen(v => !v)}>
<PortalToFollowElemTrigger onClick={() => !disabled && setOpen(v => !v)}>
<div className={cn('flex items-center rounded-md h-7 px-3 space-x-1 text-gray-700 cursor-pointer hover:bg-gray-200', open && 'bg-gray-200')}>
<Settings01 className='w-3.5 h-3.5 ' />
<div className='ml-1 leading-[18px] text-xs font-medium '>{t('appDebug.voice.settings')}</div>