-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add button to navigate to model manager if tab is enabled
- Loading branch information
Showing
3 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...rontend/web/src/features/parameters/components/MainModel/NavigateToModelManagerButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import type { IconButtonProps } from '@invoke-ai/ui-library'; | ||
import { IconButton } from '@invoke-ai/ui-library'; | ||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; | ||
import { setActiveTab } from 'features/ui/store/uiSlice'; | ||
import { memo, useCallback, useMemo } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { PiGearSixBold } from 'react-icons/pi'; | ||
|
||
export const NavigateToModelManagerButton = memo((props: Omit<IconButtonProps, 'aria-label'>) => { | ||
const { t } = useTranslation(); | ||
const dispatch = useAppDispatch(); | ||
const disabledTabs = useAppSelector((s) => s.config.disabledTabs); | ||
const shouldShowButton = useMemo(() => !disabledTabs.includes('modelManager'), [disabledTabs]); | ||
|
||
const handleClick = useCallback(() => { | ||
dispatch(setActiveTab('modelManager')); | ||
}, [dispatch]); | ||
|
||
if (!shouldShowButton) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<IconButton | ||
icon={<PiGearSixBold />} | ||
tooltip={t('modelManager.modelManager')} | ||
aria-label={t('modelManager.modelManager')} | ||
onClick={handleClick} | ||
size="sm" | ||
variant="ghost" | ||
{...props} | ||
/> | ||
); | ||
}); | ||
|
||
NavigateToModelManagerButton.displayName = 'NavigateToModelManagerButton'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters