This commit is contained in:
Mary Hipp 2024-01-12 14:38:58 -05:00 committed by psychedelicious
parent 0a4cbc4e16
commit 4f95c077d4
13 changed files with 53 additions and 36 deletions

View File

@ -5,6 +5,7 @@ import {
controlAdapterImageChanged,
controlAdapterIsEnabledChanged,
} from 'features/controlAdapters/store/controlAdaptersSlice';
import { imageUploaded } from 'features/gallery/store/actions';
import { fieldImageValueChanged } from 'features/nodes/store/nodesSlice';
import {
initialImageChanged,
@ -17,7 +18,6 @@ import { boardsApi } from 'services/api/endpoints/boards';
import { imagesApi } from 'services/api/endpoints/images';
import { startAppListening } from '..';
import { imageUploaded } from '../../../../../features/gallery/store/actions';
export const addImageUploadedFulfilledListener = () => {
startAppListening({
@ -41,7 +41,7 @@ export const addImageUploadedFulfilledListener = () => {
return;
}
dispatch(imageUploaded({ postUploadAction: postUploadAction?.type }))
dispatch(imageUploaded({ postUploadAction: postUploadAction?.type }));
const DEFAULT_UPLOADED_TOAST: UseToastOptions = {
title: t('toast.imageUploaded'),

View File

@ -4,9 +4,8 @@ import { Collapse, Icon, useDisclosure } from '@chakra-ui/react';
import type { InvExpanderProps } from 'common/components/InvExpander/types';
import { InvText } from 'common/components/InvText/wrapper';
import { t } from 'i18next';
import { BiCollapseVertical, BiExpandVertical } from 'react-icons/bi';
import { useAppDispatch } from '../../../app/store/storeHooks';
import { useCallback } from 'react';
import { BiCollapseVertical, BiExpandVertical } from 'react-icons/bi';
const buttonStyles: SystemStyleObject = {
color: 'base.400',

View File

@ -1,8 +1,7 @@
import { ThunkAction } from '@reduxjs/toolkit';
import type { PropsWithChildren } from 'react';
export type InvExpanderProps = PropsWithChildren<{
label?: string;
defaultIsOpen?: boolean;
onClick?: (isOpen: boolean) => void
onClick?: (isOpen: boolean) => void;
}>;

View File

@ -13,7 +13,7 @@ export const InvSingleAccordion = memo((props: InvSingleAccordionProps) => {
(isExpanded: boolean) => {
props.onClick && props.onClick(isExpanded);
},
[props.onClick]
[props]
);
return (
@ -26,7 +26,7 @@ export const InvSingleAccordion = memo((props: InvSingleAccordionProps) => {
<>
<InvAccordionButton
badges={props.badges}
onClick={() => handleAccordionClick(isExpanded)}
onClick={handleAccordionClick.bind(null, isExpanded)}
>
{props.label}
</InvAccordionButton>

View File

@ -4,5 +4,5 @@ export type InvSingleAccordionProps = PropsWithChildren<{
label: string;
badges?: (string | number)[];
defaultIsOpen?: boolean;
onClick?: (isOpen?: boolean) => void
onClick?: (isOpen?: boolean) => void;
}>;

View File

@ -5,6 +5,7 @@ import { InvContextMenu } from 'common/components/InvContextMenu/InvContextMenu'
import { InvMenuItem } from 'common/components/InvMenu/InvMenuItem';
import { InvMenuList } from 'common/components/InvMenu/InvMenuList';
import { InvMenuGroup } from 'common/components/InvMenu/wrapper';
import { bulkDownloadRequested } from 'features/gallery/store/actions';
import {
autoAddBoardIdChanged,
selectGallerySlice,
@ -20,7 +21,6 @@ import { useBoardName } from 'services/api/hooks/useBoardName';
import type { BoardDTO } from 'services/api/types';
import GalleryBoardContextMenuItems from './GalleryBoardContextMenuItems';
import { bulkDownloadRequested } from '../../store/actions';
type Props = {
board?: BoardDTO;

View File

@ -1,10 +1,10 @@
import { useAppDispatch } from 'app/store/storeHooks';
import { InvIconButton } from 'common/components/InvIconButton/InvIconButton';
import { boardCreated } from 'features/gallery/store/actions';
import { memo, useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { PiPlusBold } from 'react-icons/pi';
import { useCreateBoardMutation } from 'services/api/endpoints/boards';
import { useAppDispatch } from '../../../../../app/store/storeHooks';
import { boardCreated } from '../../../store/actions';
const AddBoardButton = () => {
const { t } = useTranslation();

View File

@ -8,6 +8,7 @@ import {
isModalOpenChanged,
} from 'features/changeBoardModal/store/slice';
import { imagesToDeleteSelected } from 'features/deleteImageModal/store/slice';
import { bulkDownloadRequested } from 'features/gallery/store/actions';
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
import { addToast } from 'features/system/store/systemSlice';
import { memo, useCallback, useMemo } from 'react';
@ -24,7 +25,6 @@ import {
useStarImagesMutation,
useUnstarImagesMutation,
} from 'services/api/endpoints/images';
import { bulkDownloadRequested } from '../../store/actions';
const MultipleSelectionMenuItems = () => {
const { t } = useTranslation();

View File

@ -16,7 +16,11 @@ export const sentImageToCanvas = createAction('gallery/sentImageToCanvas');
export const sentImageToImg2Img = createAction('gallery/sentImageToImg2Img');
export const imageUploaded = createAction<{ postUploadAction?: string }>('gallery/imageUploaded');
export const imageUploaded = createAction<{ postUploadAction?: string }>(
'gallery/imageUploaded'
);
export const boardCreated = createAction('gallery/boardCreated');
export const bulkDownloadRequested = createAction<{ type: string }>('gallery/bulkDownloadRequested')
export const bulkDownloadRequested = createAction<{ type: string }>(
'gallery/bulkDownloadRequested'
);

View File

@ -9,7 +9,13 @@ export const modelSelected = createAction<MainModelField>(
'generation/modelSelected'
);
export const imageAdvancedOptionsExpanded = createAction('parameters/imageAdvancedOptionsExpanded')
export const generationAdvancedOptionsExpanded = createAction('parameters/generationAdvancedOptionsExpanded')
export const imageAdvancedOptionsExpanded = createAction(
'parameters/imageAdvancedOptionsExpanded'
);
export const generationAdvancedOptionsExpanded = createAction(
'parameters/generationAdvancedOptionsExpanded'
);
export const advancedPanelExpanded = createAction('parameters/advancedPanelExpanded')
export const advancedPanelExpanded = createAction(
'parameters/advancedPanelExpanded'
);

View File

@ -10,10 +10,10 @@ import ParamSeamlessXAxis from 'features/parameters/components/Seamless/ParamSea
import ParamSeamlessYAxis from 'features/parameters/components/Seamless/ParamSeamlessYAxis';
import ParamVAEModelSelect from 'features/parameters/components/VAEModel/ParamVAEModelSelect';
import ParamVAEPrecision from 'features/parameters/components/VAEModel/ParamVAEPrecision';
import { advancedPanelExpanded } from 'features/parameters/store/actions';
import { selectGenerationSlice } from 'features/parameters/store/generationSlice';
import { memo, useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { advancedPanelExpanded } from '../../parameters/store/actions';
const labelProps: InvLabelProps = {
minW: '9.2rem',
@ -54,11 +54,14 @@ export const AdvancedSettingsAccordion = memo(() => {
const { t } = useTranslation();
const dispatch = useAppDispatch();
const onAccordionClick = useCallback((isOpen?: boolean) => {
if (!isOpen) {
dispatch(advancedPanelExpanded());
}
}, []);
const onAccordionClick = useCallback(
(isOpen?: boolean) => {
if (!isOpen) {
dispatch(advancedPanelExpanded());
}
},
[dispatch]
);
return (
<InvSingleAccordion

View File

@ -20,11 +20,11 @@ import ParamCFGScale from 'features/parameters/components/Core/ParamCFGScale';
import ParamScheduler from 'features/parameters/components/Core/ParamScheduler';
import ParamSteps from 'features/parameters/components/Core/ParamSteps';
import ParamMainModelSelect from 'features/parameters/components/MainModel/ParamMainModelSelect';
import { generationAdvancedOptionsExpanded } from 'features/parameters/store/actions';
import { selectGenerationSlice } from 'features/parameters/store/generationSlice';
import { size } from 'lodash-es';
import { memo, useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { generationAdvancedOptionsExpanded } from '../../parameters/store/actions';
const labelProps: InvLabelProps = {
minW: '4rem',
@ -50,11 +50,14 @@ export const GenerationSettingsAccordion = memo(() => {
const { loraTabBadges, accordionBadges } = useAppSelector(badgesSelector);
const dispatch = useAppDispatch();
const onToggleExpander = useCallback((isOpen?: boolean) => {
if (!isOpen) {
dispatch(generationAdvancedOptionsExpanded());
}
}, []);
const onToggleExpander = useCallback(
(isOpen?: boolean) => {
if (!isOpen) {
dispatch(generationAdvancedOptionsExpanded());
}
},
[dispatch]
);
return (
<InvSingleAccordion

View File

@ -16,6 +16,7 @@ import ImageToImageStrength from 'features/parameters/components/ImageToImage/Im
import { ParamSeedNumberInput } from 'features/parameters/components/Seed/ParamSeedNumberInput';
import { ParamSeedRandomize } from 'features/parameters/components/Seed/ParamSeedRandomize';
import { ParamSeedShuffle } from 'features/parameters/components/Seed/ParamSeedShuffle';
import { imageAdvancedOptionsExpanded } from 'features/parameters/store/actions';
import { selectGenerationSlice } from 'features/parameters/store/generationSlice';
import { activeTabNameSelector } from 'features/ui/store/uiSelectors';
import { memo, useCallback } from 'react';
@ -23,7 +24,6 @@ import { useTranslation } from 'react-i18next';
import { ImageSizeCanvas } from './ImageSizeCanvas';
import { ImageSizeLinear } from './ImageSizeLinear';
import { imageAdvancedOptionsExpanded } from '../../parameters/store/actions';
const selector = createMemoizedSelector(
[
@ -76,11 +76,14 @@ export const ImageSettingsAccordion = memo(() => {
const { badges, activeTabName } = useAppSelector(selector);
const dispatch = useAppDispatch();
const onToggleExpander = useCallback((isOpen?: boolean) => {
if (!isOpen) {
dispatch(imageAdvancedOptionsExpanded());
}
}, []);
const onToggleExpander = useCallback(
(isOpen?: boolean) => {
if (!isOpen) {
dispatch(imageAdvancedOptionsExpanded());
}
},
[dispatch]
);
return (
<InvSingleAccordion