chore(ui): prettier

This commit is contained in:
psychedelicious 2024-08-23 16:52:42 +10:00
parent b586d67bac
commit bf8bef2f00
23 changed files with 27 additions and 39 deletions

View File

@ -19,7 +19,7 @@ import type { PartialAppConfig } from 'app/types/invokeai';
import Loading from 'common/components/Loading/Loading';
import AppDndContext from 'features/dnd/components/AppDndContext';
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 React, { lazy, memo, useEffect, useMemo } from 'react';
import { Provider } from 'react-redux';

View File

@ -1,5 +1,5 @@
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<{
tabName: TabName;

View File

@ -1,6 +1,6 @@
import type { FilterType } from 'features/controlLayers/store/types';
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';
/**

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@ import { createSelector } from '@reduxjs/toolkit';
import { useAppSelector } from 'app/store/storeHooks';
import type { AppFeature, SDFeature } from 'app/types/invokeai';
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';
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 { usePanelStorage } from 'features/ui/hooks/usePanelStorage';
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 { memo, useMemo, useRef } from 'react';
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 { selectActiveTab } from 'features/ui/store/uiSelectors';
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';
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 { useAppSelector } from 'app/store/storeHooks';
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 { memo, useMemo } from 'react';

View File

@ -1,6 +1,6 @@
import { Box } from '@invoke-ai/ui-library';
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 { 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 { atom } from 'nanostores';
import type { TabName , UIState } from "./uiTypes";
import type { TabName, UIState } from './uiTypes';
const initialUIState: UIState = {
_version: 2,

View File

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