mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-18 00:01:27 -05:00
only show Add Model button if not adding models
This commit is contained in:
committed by
Mary Hipp Rogers
parent
5bd87ca89b
commit
336e6e0c19
@@ -1,6 +1,6 @@
|
||||
import { Button, Flex, Heading } from '@invoke-ai/ui-library';
|
||||
import { useAppDispatch } from 'app/store/storeHooks';
|
||||
import { setSelectedModelKey } from 'features/modelManagerV2/store/modelManagerV2Slice';
|
||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||
import { selectSelectedModelKey, setSelectedModelKey } from 'features/modelManagerV2/store/modelManagerV2Slice';
|
||||
import { memo, useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { PiPlusBold } from 'react-icons/pi';
|
||||
@@ -14,14 +14,19 @@ export const ModelManager = memo(() => {
|
||||
const handleClickAddModel = useCallback(() => {
|
||||
dispatch(setSelectedModelKey(null));
|
||||
}, [dispatch]);
|
||||
const selectedModelKey = useAppSelector(selectSelectedModelKey);
|
||||
|
||||
return (
|
||||
<Flex flexDir="column" layerStyle="first" p={4} gap={4} borderRadius="base" w="50%" h="full">
|
||||
<Flex w="full" gap={4} justifyContent="space-between" alignItems="center">
|
||||
<Heading fontSize="xl">{t('common.modelManager')}</Heading>
|
||||
<Button size="sm" colorScheme="invokeYellow" leftIcon={<PiPlusBold />} onClick={handleClickAddModel}>
|
||||
{t('modelManager.addModels')}
|
||||
</Button>
|
||||
<Heading fontSize="xl" py={1}>
|
||||
{t('common.modelManager')}
|
||||
</Heading>
|
||||
{!!selectedModelKey && (
|
||||
<Button size="sm" colorScheme="invokeYellow" leftIcon={<PiPlusBold />} onClick={handleClickAddModel}>
|
||||
{t('modelManager.addModels')}
|
||||
</Button>
|
||||
)}
|
||||
</Flex>
|
||||
<Flex flexDir="column" layerStyle="second" p={4} gap={4} borderRadius="base" w="full" h="full">
|
||||
<ModelListNavigation />
|
||||
|
||||
Reference in New Issue
Block a user