Skip to content

Commit 636ec1d

Browse files
Mary Hipppsychedelicious
authored andcommitted
add viewAllWorkflowsRecommended to studio init action to show library with only recomended workflows
1 parent 063d07f commit 636ec1d

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

invokeai/frontend/web/src/app/hooks/useStudioInitAction.ts

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ import { sentImageToCanvas } from 'features/gallery/store/actions';
1212
import { parseAndRecallAllMetadata } from 'features/metadata/util/handlers';
1313
import { $hasTemplates } from 'features/nodes/store/nodesSlice';
1414
import { $isWorkflowLibraryModalOpen } from 'features/nodes/store/workflowLibraryModal';
15+
import {
16+
$workflowLibraryTagOptions,
17+
workflowLibraryTagsReset,
18+
workflowLibraryTagToggled,
19+
} from 'features/nodes/store/workflowLibrarySlice';
1520
import { $isStylePresetsMenuOpen, activeStylePresetIdChanged } from 'features/stylePresets/store/stylePresetSlice';
1621
import { toast } from 'features/toast/toast';
1722
import { activeTabCanvasRightPanelChanged, setActiveTab } from 'features/ui/store/uiSlice';
@@ -30,9 +35,17 @@ type SendToCanvasAction = _StudioInitAction<'sendToCanvas', { imageName: string
3035
type UseAllParametersAction = _StudioInitAction<'useAllParameters', { imageName: string }>;
3136
type StudioDestinationAction = _StudioInitAction<
3237
'goToDestination',
33-
{ destination: 'generation' | 'canvas' | 'workflows' | 'upscaling' | 'viewAllWorkflows' | 'viewAllStylePresets' }
38+
{
39+
destination:
40+
| 'generation'
41+
| 'canvas'
42+
| 'workflows'
43+
| 'upscaling'
44+
| 'viewAllWorkflows'
45+
| 'viewAllWorkflowsRecommended'
46+
| 'viewAllStylePresets';
47+
}
3448
>;
35-
3649
// Use global state to show loader until we are ready to render the studio.
3750
export const $didStudioInit = atom(false);
3851

@@ -58,6 +71,7 @@ export const useStudioInitAction = (action?: StudioInitAction) => {
5871
const didParseOpenAPISchema = useStore($hasTemplates);
5972
const store = useAppStore();
6073
const loadWorkflowWithDialog = useLoadWorkflowWithDialog();
74+
const workflowLibraryTagOptions = useStore($workflowLibraryTagOptions);
6175

6276
const handleSendToCanvas = useCallback(
6377
async (imageName: string) => {
@@ -173,14 +187,25 @@ export const useStudioInitAction = (action?: StudioInitAction) => {
173187
store.dispatch(setActiveTab('workflows'));
174188
$isWorkflowLibraryModalOpen.set(true);
175189
break;
190+
case 'viewAllWorkflowsRecommended':
191+
// Go to the workflows tab and open the workflow library modal with the recommended workflows view
192+
store.dispatch(setActiveTab('workflows'));
193+
$isWorkflowLibraryModalOpen.set(true);
194+
store.dispatch(workflowLibraryTagsReset());
195+
for (const tag of workflowLibraryTagOptions) {
196+
if (tag.recommended) {
197+
store.dispatch(workflowLibraryTagToggled(tag.label));
198+
}
199+
}
200+
break;
176201
case 'viewAllStylePresets':
177202
// Go to the canvas tab and open the style presets menu
178203
store.dispatch(setActiveTab('canvas'));
179204
$isStylePresetsMenuOpen.set(true);
180205
break;
181206
}
182207
},
183-
[store]
208+
[store, workflowLibraryTagOptions]
184209
);
185210

186211
const handleStudioInitAction = useCallback(

0 commit comments

Comments
 (0)