hide workflow library buttons if feature is disabled

This commit is contained in:
Mary Hipp
2023-12-05 12:18:27 -05:00
parent 7e36343cf1
commit e007dbf32f
3 changed files with 17 additions and 4 deletions

View File

@ -23,7 +23,8 @@ export type AppFeature =
| 'resumeQueue'
| 'prependQueue'
| 'invocationCache'
| 'bulkDownload';
| 'bulkDownload'
| 'workflowLibrary';
/**
* A disable-able Stable Diffusion feature

View File

@ -5,8 +5,12 @@ import UploadWorkflowButton from 'features/workflowLibrary/components/LoadWorkfl
import ResetWorkflowEditorButton from 'features/workflowLibrary/components/ResetWorkflowButton';
import SaveWorkflowButton from 'features/workflowLibrary/components/SaveWorkflowButton';
import SaveWorkflowAsButton from 'features/workflowLibrary/components/SaveWorkflowAsButton';
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
const TopCenterPanel = () => {
const isWorkflowLibraryEnabled =
useFeatureStatus('workflowLibrary').isFeatureEnabled;
return (
<Flex
sx={{
@ -19,8 +23,12 @@ const TopCenterPanel = () => {
>
<DownloadWorkflowButton />
<UploadWorkflowButton />
<SaveWorkflowButton />
<SaveWorkflowAsButton />
{isWorkflowLibraryEnabled && (
<>
<SaveWorkflowButton />
<SaveWorkflowAsButton />
</>
)}
<ResetWorkflowEditorButton />
</Flex>
);

View File

@ -2,11 +2,15 @@ import { Flex } from '@chakra-ui/react';
import WorkflowLibraryButton from 'features/workflowLibrary/components/WorkflowLibraryButton';
import { memo } from 'react';
import WorkflowEditorSettings from './WorkflowEditorSettings';
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
const TopRightPanel = () => {
const isWorkflowLibraryEnabled =
useFeatureStatus('workflowLibrary').isFeatureEnabled;
return (
<Flex sx={{ gap: 2, position: 'absolute', top: 2, insetInlineEnd: 2 }}>
<WorkflowLibraryButton />
{isWorkflowLibraryEnabled && <WorkflowLibraryButton />}
<WorkflowEditorSettings />
</Flex>
);