chore: support install hide button

pull/12372/head
Joel 1 year ago
parent d4cda69b0e
commit 99942b26e6

@ -15,6 +15,7 @@ type Props = {
onInstalled: (plugins: Plugin[], installStatus: InstallStatusResponse[]) => void onInstalled: (plugins: Plugin[], installStatus: InstallStatusResponse[]) => void
onCancel: () => void onCancel: () => void
isFromMarketPlace?: boolean isFromMarketPlace?: boolean
isHideButton?: boolean
} }
const Install: FC<Props> = ({ const Install: FC<Props> = ({
@ -22,6 +23,7 @@ const Install: FC<Props> = ({
onInstalled, onInstalled,
onCancel, onCancel,
isFromMarketPlace, isFromMarketPlace,
isHideButton,
}) => { }) => {
const { t } = useTranslation() const { t } = useTranslation()
const [selectedPlugins, setSelectedPlugins] = React.useState<Plugin[]>([]) const [selectedPlugins, setSelectedPlugins] = React.useState<Plugin[]>([])
@ -82,22 +84,25 @@ const Install: FC<Props> = ({
</div> </div>
</div> </div>
{/* Action Buttons */} {/* Action Buttons */}
<div className='flex p-6 pt-5 justify-end items-center gap-2 self-stretch'> {!isHideButton && (
{!canInstall && ( <div className='flex p-6 pt-5 justify-end items-center gap-2 self-stretch'>
<Button variant='secondary' className='min-w-[72px]' onClick={onCancel}> {!canInstall && (
{t('common.operation.cancel')} <Button variant='secondary' className='min-w-[72px]' onClick={onCancel}>
{t('common.operation.cancel')}
</Button>
)}
<Button
variant='primary'
className='min-w-[72px] flex space-x-0.5'
disabled={!canInstall || isInstalling || selectedPlugins.length === 0}
onClick={handleInstall}
>
{isInstalling && <RiLoader2Line className='w-4 h-4 animate-spin-slow' />}
<span>{t(`${i18nPrefix}.${isInstalling ? 'installing' : 'install'}`)}</span>
</Button> </Button>
)} </div>
<Button )}
variant='primary'
className='min-w-[72px] flex space-x-0.5'
disabled={!canInstall || isInstalling || selectedPlugins.length === 0}
onClick={handleInstall}
>
{isInstalling && <RiLoader2Line className='w-4 h-4 animate-spin-slow' />}
<span>{t(`${i18nPrefix}.${isInstalling ? 'installing' : 'install'}`)}</span>
</Button>
</div>
</> </>
) )
} }

@ -13,12 +13,14 @@ type Props = {
list: Plugin[] list: Plugin[]
installStatus: InstallStatusResponse[] installStatus: InstallStatusResponse[]
onCancel: () => void onCancel: () => void
isHideButton?: boolean
} }
const Installed: FC<Props> = ({ const Installed: FC<Props> = ({
list, list,
installStatus, installStatus,
onCancel, onCancel,
isHideButton,
}) => { }) => {
const { t } = useTranslation() const { t } = useTranslation()
const { getIconUrl } = useGetIcon() const { getIconUrl } = useGetIcon()
@ -45,15 +47,17 @@ const Installed: FC<Props> = ({
</div> </div>
</div> </div>
{/* Action Buttons */} {/* Action Buttons */}
<div className='flex p-6 pt-5 justify-end items-center gap-2 self-stretch'> {!isHideButton && (
<Button <div className='flex p-6 pt-5 justify-end items-center gap-2 self-stretch'>
variant='primary' <Button
className='min-w-[72px]' variant='primary'
onClick={onCancel} className='min-w-[72px]'
> onClick={onCancel}
{t('common.operation.close')} >
</Button> {t('common.operation.close')}
</div> </Button>
</div>
)}
</> </>
) )
} }

Loading…
Cancel
Save