chore(ui): prettier

This commit is contained in:
psychedelicious 2024-08-23 16:52:42 +10:00
parent ee57302fc3
commit 685eb9927d
24 changed files with 28 additions and 40 deletions

View File

@ -19,7 +19,7 @@ import { configChanged } from 'features/system/store/configSlice';
import { languageSelector } from 'features/system/store/systemSelectors'; import { languageSelector } from 'features/system/store/systemSelectors';
import { AppContent } from 'features/ui/components/AppContent'; import { AppContent } from 'features/ui/components/AppContent';
import { setActiveTab } from 'features/ui/store/uiSlice'; import { setActiveTab } from 'features/ui/store/uiSlice';
import type { TabName } from "features/ui/store/uiTypes"; import type { TabName } from 'features/ui/store/uiTypes';
import { useGetAndLoadLibraryWorkflow } from 'features/workflowLibrary/hooks/useGetAndLoadLibraryWorkflow'; import { useGetAndLoadLibraryWorkflow } from 'features/workflowLibrary/hooks/useGetAndLoadLibraryWorkflow';
import { AnimatePresence } from 'framer-motion'; import { AnimatePresence } from 'framer-motion';
import i18n from 'i18n'; import i18n from 'i18n';

View File

@ -19,7 +19,7 @@ import type { PartialAppConfig } from 'app/types/invokeai';
import Loading from 'common/components/Loading/Loading'; import Loading from 'common/components/Loading/Loading';
import AppDndContext from 'features/dnd/components/AppDndContext'; import AppDndContext from 'features/dnd/components/AppDndContext';
import type { WorkflowCategory } from 'features/nodes/types/workflow'; import type { WorkflowCategory } from 'features/nodes/types/workflow';
import type { TabName } from "features/ui/store/uiTypes"; import type { TabName } from 'features/ui/store/uiTypes';
import type { PropsWithChildren, ReactNode } from 'react'; import type { PropsWithChildren, ReactNode } from 'react';
import React, { lazy, memo, useEffect, useMemo } from 'react'; import React, { lazy, memo, useEffect, useMemo } from 'react';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';

View File

@ -1,5 +1,5 @@
import { createAction } from '@reduxjs/toolkit'; import { createAction } from '@reduxjs/toolkit';
import type { TabName } from "features/ui/store/uiTypes"; import type { TabName } from 'features/ui/store/uiTypes';
export const enqueueRequested = createAction<{ export const enqueueRequested = createAction<{
tabName: TabName; tabName: TabName;

View File

@ -1,6 +1,6 @@
import type { FilterType } from 'features/controlLayers/store/types'; import type { FilterType } from 'features/controlLayers/store/types';
import type { ParameterPrecision, ParameterScheduler } from 'features/parameters/types/parameterSchemas'; import type { ParameterPrecision, ParameterScheduler } from 'features/parameters/types/parameterSchemas';
import type { TabName } from "features/ui/store/uiTypes"; import type { TabName } from 'features/ui/store/uiTypes';
import type { O } from 'ts-toolbelt'; import type { O } from 'ts-toolbelt';
/** /**

View File

@ -239,7 +239,7 @@ const createSelector = (templates: Templates, isConnected: boolean) =>
export const useIsReadyToEnqueue = () => { export const useIsReadyToEnqueue = () => {
const templates = useStore($templates); const templates = useStore($templates);
const isConnected = useStore($isConnected) const isConnected = useStore($isConnected);
const selector = useMemo(() => createSelector(templates, isConnected), [templates, isConnected]); const selector = useMemo(() => createSelector(templates, isConnected), [templates, isConnected]);
const value = useAppSelector(selector); const value = useAppSelector(selector);
return value; return value;

View File

@ -55,7 +55,10 @@ export const ControlLayerControlAdapter = memo(() => {
<Weight weight={controlAdapter.weight} onChange={onChangeWeight} /> <Weight weight={controlAdapter.weight} onChange={onChangeWeight} />
<BeginEndStepPct beginEndStepPct={controlAdapter.beginEndStepPct} onChange={onChangeBeginEndStepPct} /> <BeginEndStepPct beginEndStepPct={controlAdapter.beginEndStepPct} onChange={onChangeBeginEndStepPct} />
{controlAdapter.type === 'controlnet' && ( {controlAdapter.type === 'controlnet' && (
<ControlLayerControlAdapterControlMode controlMode={controlAdapter.controlMode} onChange={onChangeControlMode} /> <ControlLayerControlAdapterControlMode
controlMode={controlAdapter.controlMode}
onChange={onChangeControlMode}
/>
)} )}
</Flex> </Flex>
); );

View File

@ -1,10 +1,7 @@
import { createMemoizedSelector } from 'app/store/createMemoizedSelector'; import { createMemoizedSelector } from 'app/store/createMemoizedSelector';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { useAssertSingleton } from 'common/hooks/useAssertSingleton'; import { useAssertSingleton } from 'common/hooks/useAssertSingleton';
import { import { entityDeleted, selectCanvasV2Slice } from 'features/controlLayers/store/canvasV2Slice';
entityDeleted,
selectCanvasV2Slice,
} from 'features/controlLayers/store/canvasV2Slice';
import { useCallback, useMemo } from 'react'; import { useCallback, useMemo } from 'react';
import { useHotkeys } from 'react-hotkeys-hook'; import { useHotkeys } from 'react-hotkeys-hook';

View File

@ -35,8 +35,7 @@ export const useDefaultControlAdapter = (): ControlNetConfig | T2IAdapterConfig
const defaultControlAdapter = useMemo(() => { const defaultControlAdapter = useMemo(() => {
const compatibleModels = modelConfigs.filter((m) => (baseModel ? m.base === baseModel : true)); const compatibleModels = modelConfigs.filter((m) => (baseModel ? m.base === baseModel : true));
const model = compatibleModels[0] ?? modelConfigs[0] ?? null; const model = compatibleModels[0] ?? modelConfigs[0] ?? null;
const controlAdapter = const controlAdapter = model?.type === 't2i_adapter' ? deepClone(initialT2IAdapter) : deepClone(initialControlNet);
model?.type === 't2i_adapter' ? deepClone(initialT2IAdapter) : deepClone(initialControlNet);
if (model) { if (model) {
controlAdapter.model = zModelIdentifierField.parse(model); controlAdapter.model = zModelIdentifierField.parse(model);

View File

@ -1,9 +1,5 @@
import type { PayloadAction, SliceCaseReducers } from '@reduxjs/toolkit'; import type { PayloadAction, SliceCaseReducers } from '@reduxjs/toolkit';
import type { import type { CanvasV2State, SessionMode, StagingAreaImage } from 'features/controlLayers/store/types';
CanvasV2State,
SessionMode,
StagingAreaImage,
} from 'features/controlLayers/store/types';
export const sessionReducers = { export const sessionReducers = {
sessionStartedStaging: (state) => { sessionStartedStaging: (state) => {

View File

@ -33,10 +33,7 @@ import {
setSteps, setSteps,
vaeSelected, vaeSelected,
} from 'features/controlLayers/store/canvasV2Slice'; } from 'features/controlLayers/store/canvasV2Slice';
import type { import type { CanvasRasterLayerState, LoRA } from 'features/controlLayers/store/types';
CanvasRasterLayerState,
LoRA,
} from 'features/controlLayers/store/types';
import { setHrfEnabled, setHrfMethod, setHrfStrength } from 'features/hrf/store/hrfSlice'; import { setHrfEnabled, setHrfMethod, setHrfStrength } from 'features/hrf/store/hrfSlice';
import type { import type {
ControlNetConfigMetadata, ControlNetConfigMetadata,

View File

@ -8,12 +8,9 @@ import { ParamSDXLNegativeStylePrompt } from 'features/sdxl/components/SDXLPromp
import { ParamSDXLPositiveStylePrompt } from 'features/sdxl/components/SDXLPrompts/ParamSDXLPositiveStylePrompt'; import { ParamSDXLPositiveStylePrompt } from 'features/sdxl/components/SDXLPrompts/ParamSDXLPositiveStylePrompt';
import { memo } from 'react'; import { memo } from 'react';
const concatPromptsSelector = createSelector( const concatPromptsSelector = createSelector([selectCanvasV2Slice], (canvasV2) => {
[selectCanvasV2Slice],
(canvasV2) => {
return canvasV2.params.model?.base !== 'sdxl' || canvasV2.params.shouldConcatPrompts; return canvasV2.params.model?.base !== 'sdxl' || canvasV2.params.shouldConcatPrompts;
} });
);
export const Prompts = memo(() => { export const Prompts = memo(() => {
const shouldConcatPrompts = useAppSelector(concatPromptsSelector); const shouldConcatPrompts = useAppSelector(concatPromptsSelector);

View File

@ -2,7 +2,7 @@ import { createSelector } from '@reduxjs/toolkit';
import { useAppSelector } from 'app/store/storeHooks'; import { useAppSelector } from 'app/store/storeHooks';
import type { AppFeature, SDFeature } from 'app/types/invokeai'; import type { AppFeature, SDFeature } from 'app/types/invokeai';
import { selectConfigSlice } from 'features/system/store/configSlice'; import { selectConfigSlice } from 'features/system/store/configSlice';
import type { TabName } from "features/ui/store/uiTypes"; import type { TabName } from 'features/ui/store/uiTypes';
import { useMemo } from 'react'; import { useMemo } from 'react';
export const useFeatureStatus = (feature: AppFeature | SDFeature | TabName) => { export const useFeatureStatus = (feature: AppFeature | SDFeature | TabName) => {

View File

@ -19,7 +19,7 @@ import type { UsePanelOptions } from 'features/ui/hooks/usePanel';
import { usePanel } from 'features/ui/hooks/usePanel'; import { usePanel } from 'features/ui/hooks/usePanel';
import { usePanelStorage } from 'features/ui/hooks/usePanelStorage'; import { usePanelStorage } from 'features/ui/hooks/usePanelStorage';
import { $isGalleryPanelOpen, $isParametersPanelOpen } from 'features/ui/store/uiSlice'; import { $isGalleryPanelOpen, $isParametersPanelOpen } from 'features/ui/store/uiSlice';
import type { TabName } from "features/ui/store/uiTypes"; import type { TabName } from 'features/ui/store/uiTypes';
import type { CSSProperties } from 'react'; import type { CSSProperties } from 'react';
import { memo, useMemo, useRef } from 'react'; import { memo, useMemo, useRef } from 'react';
import { useHotkeys } from 'react-hotkeys-hook'; import { useHotkeys } from 'react-hotkeys-hook';

View File

@ -2,7 +2,7 @@ import { IconButton, Tooltip } from '@invoke-ai/ui-library';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { selectActiveTab } from 'features/ui/store/uiSelectors'; import { selectActiveTab } from 'features/ui/store/uiSelectors';
import { setActiveTab } from 'features/ui/store/uiSlice'; import { setActiveTab } from 'features/ui/store/uiSlice';
import type { TabName } from "features/ui/store/uiTypes"; import type { TabName } from 'features/ui/store/uiTypes';
import { memo, type ReactElement, useCallback } from 'react'; import { memo, type ReactElement, useCallback } from 'react';
export const TabButton = memo(({ tab, icon, label }: { tab: TabName; icon: ReactElement; label: string }) => { export const TabButton = memo(({ tab, icon, label }: { tab: TabName; icon: ReactElement; label: string }) => {

View File

@ -1,7 +1,7 @@
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { useAppSelector } from 'app/store/storeHooks'; import { useAppSelector } from 'app/store/storeHooks';
import { selectConfigSlice } from 'features/system/store/configSlice'; import { selectConfigSlice } from 'features/system/store/configSlice';
import type { TabName } from "features/ui/store/uiTypes"; import type { TabName } from 'features/ui/store/uiTypes';
import type { PropsWithChildren } from 'react'; import type { PropsWithChildren } from 'react';
import { memo, useMemo } from 'react'; import { memo, useMemo } from 'react';

View File

@ -1,6 +1,6 @@
import { Box } from '@invoke-ai/ui-library'; import { Box } from '@invoke-ai/ui-library';
import { useAppSelector } from 'app/store/storeHooks'; import { useAppSelector } from 'app/store/storeHooks';
import type { TabName } from "features/ui/store/uiTypes"; import type { TabName } from 'features/ui/store/uiTypes';
import type { PropsWithChildren } from 'react'; import type { PropsWithChildren } from 'react';
import { memo } from 'react'; import { memo } from 'react';

View File

@ -4,7 +4,7 @@ import type { PersistConfig, RootState } from 'app/store/store';
import { workflowLoadRequested } from 'features/nodes/store/actions'; import { workflowLoadRequested } from 'features/nodes/store/actions';
import { atom } from 'nanostores'; import { atom } from 'nanostores';
import type { TabName , UIState } from "./uiTypes"; import type { TabName, UIState } from './uiTypes';
const initialUIState: UIState = { const initialUIState: UIState = {
_version: 2, _version: 2,

View File

@ -1,4 +1,3 @@
export type TabName = 'generation' | 'upscaling' | 'workflows' | 'models' | 'queue'; export type TabName = 'generation' | 'upscaling' | 'workflows' | 'models' | 'queue';
export interface UIState { export interface UIState {