mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat: Make the active processing node light up
This commit is contained in:
parent
90abd0fe49
commit
2ec8fd3dc7
@ -4,13 +4,16 @@ import {
|
|||||||
useColorModeValue,
|
useColorModeValue,
|
||||||
useToken,
|
useToken,
|
||||||
} from '@chakra-ui/react';
|
} from '@chakra-ui/react';
|
||||||
|
import { createSelector } from '@reduxjs/toolkit';
|
||||||
|
import { stateSelector } from 'app/store/store';
|
||||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||||
import {
|
import {
|
||||||
DRAG_HANDLE_CLASSNAME,
|
DRAG_HANDLE_CLASSNAME,
|
||||||
NODE_WIDTH,
|
NODE_WIDTH,
|
||||||
} from 'features/nodes/types/constants';
|
} from 'features/nodes/types/constants';
|
||||||
|
import { NodeStatus } from 'features/nodes/types/types';
|
||||||
import { contextMenusClosed } from 'features/ui/store/uiSlice';
|
import { contextMenusClosed } from 'features/ui/store/uiSlice';
|
||||||
import { PropsWithChildren, memo, useCallback } from 'react';
|
import { PropsWithChildren, memo, useCallback, useMemo } from 'react';
|
||||||
|
|
||||||
type NodeWrapperProps = PropsWithChildren & {
|
type NodeWrapperProps = PropsWithChildren & {
|
||||||
nodeId: string;
|
nodeId: string;
|
||||||
@ -19,7 +22,18 @@ type NodeWrapperProps = PropsWithChildren & {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const NodeWrapper = (props: NodeWrapperProps) => {
|
const NodeWrapper = (props: NodeWrapperProps) => {
|
||||||
const { width, children, selected } = props;
|
const { nodeId, width, children, selected } = props;
|
||||||
|
|
||||||
|
const selectNodeExecutionState = useMemo(
|
||||||
|
() =>
|
||||||
|
createSelector(
|
||||||
|
stateSelector,
|
||||||
|
({ nodes }) => nodes.nodeExecutionStates[nodeId]
|
||||||
|
),
|
||||||
|
[nodeId]
|
||||||
|
);
|
||||||
|
|
||||||
|
const nodeExecutionState = useAppSelector(selectNodeExecutionState);
|
||||||
|
|
||||||
const [
|
const [
|
||||||
nodeSelectedOutlineLight,
|
nodeSelectedOutlineLight,
|
||||||
@ -57,9 +71,24 @@ const NodeWrapper = (props: NodeWrapperProps) => {
|
|||||||
w: width ?? NODE_WIDTH,
|
w: width ?? NODE_WIDTH,
|
||||||
transitionProperty: 'common',
|
transitionProperty: 'common',
|
||||||
transitionDuration: '0.1s',
|
transitionDuration: '0.1s',
|
||||||
shadow: selected ? shadow : undefined,
|
shadow: selected
|
||||||
|
? nodeExecutionState?.status === NodeStatus.IN_PROGRESS
|
||||||
|
? undefined
|
||||||
|
: shadow
|
||||||
|
: undefined,
|
||||||
cursor: 'grab',
|
cursor: 'grab',
|
||||||
opacity,
|
opacity,
|
||||||
|
borderWidth: 2,
|
||||||
|
borderColor:
|
||||||
|
nodeExecutionState?.status === NodeStatus.IN_PROGRESS
|
||||||
|
? 'warning.300'
|
||||||
|
: 'base.200',
|
||||||
|
_dark: {
|
||||||
|
borderColor:
|
||||||
|
nodeExecutionState?.status === NodeStatus.IN_PROGRESS
|
||||||
|
? 'warning.500'
|
||||||
|
: 'base.900',
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
|
@ -58,12 +58,12 @@ export const theme: ThemeOverride = {
|
|||||||
nodeHeader: {
|
nodeHeader: {
|
||||||
bg: 'base.200',
|
bg: 'base.200',
|
||||||
color: 'base.900',
|
color: 'base.900',
|
||||||
'.chakra-ui-dark &': { bg: 'base.700', color: 'base.100' },
|
'.chakra-ui-dark &': { bg: 'base.900', color: 'base.100' },
|
||||||
},
|
},
|
||||||
nodeFooter: {
|
nodeFooter: {
|
||||||
bg: 'base.200',
|
bg: 'base.200',
|
||||||
color: 'base.900',
|
color: 'base.900',
|
||||||
'.chakra-ui-dark &': { bg: 'base.700', color: 'base.100' },
|
'.chakra-ui-dark &': { bg: 'base.900', color: 'base.100' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
styles: {
|
styles: {
|
||||||
|
Loading…
Reference in New Issue
Block a user