From 8926a1a42495f09a5f2839d7c356b0fd5a158cf0 Mon Sep 17 00:00:00 2001 From: Mary Hipp Date: Wed, 28 Feb 2024 12:04:51 -0500 Subject: [PATCH] lint fix --- .../subpanels/ModelPanel/Metadata/ModelMetadata.tsx | 9 +++++---- .../subpanels/ModelPanel/Metadata/TriggerPhrases.tsx | 10 +++++----- .../modelManagerV2/subpanels/ModelPanel/Model.tsx | 12 ++++++------ .../components/Core/ParamNegativePrompt.tsx | 4 ++-- .../components/Core/ParamPositivePrompt.tsx | 4 ++-- .../web/src/features/prompt/PromptTriggerSelect.tsx | 7 +++---- invokeai/frontend/web/src/features/prompt/types.ts | 1 - .../frontend/web/src/features/prompt/usePrompt.ts | 3 --- .../SDXLPrompts/ParamSDXLNegativeStylePrompt.tsx | 2 +- .../SDXLPrompts/ParamSDXLPositiveStylePrompt.tsx | 2 +- .../web/src/services/api/endpoints/models.ts | 2 +- invokeai/frontend/web/src/services/api/schema.ts | 6 +++--- 12 files changed, 29 insertions(+), 33 deletions(-) diff --git a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/Metadata/ModelMetadata.tsx b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/Metadata/ModelMetadata.tsx index 700a98c4ec..01e25745f8 100644 --- a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/Metadata/ModelMetadata.tsx +++ b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/Metadata/ModelMetadata.tsx @@ -1,8 +1,9 @@ -import { Flex, Box } from '@invoke-ai/ui-library'; +import { Box, Flex } from '@invoke-ai/ui-library'; import { skipToken } from '@reduxjs/toolkit/query'; -import { useAppSelector } from '../../../../../app/store/storeHooks'; -import { useGetModelMetadataQuery } from '../../../../../services/api/endpoints/models'; -import DataViewer from '../../../../gallery/components/ImageMetadataViewer/DataViewer'; +import { useAppSelector } from 'app/store/storeHooks'; +import DataViewer from 'features/gallery/components/ImageMetadataViewer/DataViewer'; +import { useGetModelMetadataQuery } from 'services/api/endpoints/models'; + import { TriggerPhrases } from './TriggerPhrases'; export const ModelMetadata = () => { diff --git a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/Metadata/TriggerPhrases.tsx b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/Metadata/TriggerPhrases.tsx index 0167adbd21..9ab51151c3 100644 --- a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/Metadata/TriggerPhrases.tsx +++ b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/Metadata/TriggerPhrases.tsx @@ -8,13 +8,13 @@ import { TagCloseButton, TagLabel, } from '@invoke-ai/ui-library'; -import { useState, useMemo, useCallback } from 'react'; -import type { ChangeEvent } from 'react'; -import { ModelListHeader } from '../../ModelManagerPanel/ModelListHeader'; import { skipToken } from '@reduxjs/toolkit/query'; -import { useAppSelector } from '../../../../../app/store/storeHooks'; -import { useGetModelMetadataQuery, useUpdateModelMetadataMutation } from '../../../../../services/api/endpoints/models'; +import { useAppSelector } from 'app/store/storeHooks'; +import { ModelListHeader } from 'features/modelManagerV2/subpanels/ModelManagerPanel/ModelListHeader'; +import type { ChangeEvent } from 'react'; +import { useCallback, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; +import { useGetModelMetadataQuery, useUpdateModelMetadataMutation } from 'services/api/endpoints/models'; export const TriggerPhrases = () => { const { t } = useTranslation(); diff --git a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/Model.tsx b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/Model.tsx index e0f6c04a0b..96e2629443 100644 --- a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/Model.tsx +++ b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/Model.tsx @@ -1,13 +1,13 @@ +import { Box, Flex, Heading, Tab, TabList, TabPanel, TabPanels, Tabs, Text } from '@invoke-ai/ui-library'; +import { skipToken } from '@reduxjs/toolkit/query'; import { useAppSelector } from 'app/store/storeHooks'; +import { useTranslation } from 'react-i18next'; +import { useGetModelConfigQuery } from 'services/api/endpoints/models'; +import { ModelMetadata } from './Metadata/ModelMetadata'; +import { ModelAttrView } from './ModelAttrView'; import { ModelEdit } from './ModelEdit'; import { ModelView } from './ModelView'; -import { Tabs, TabList, Tab, TabPanels, TabPanel, Flex, Heading, Text, Box } from '@invoke-ai/ui-library'; -import { ModelMetadata } from './Metadata/ModelMetadata'; -import { skipToken } from '@reduxjs/toolkit/query'; -import { useGetModelConfigQuery } from '../../../../services/api/endpoints/models'; -import { ModelAttrView } from './ModelAttrView'; -import { useTranslation } from 'react-i18next'; export const Model = () => { const { t } = useTranslation(); diff --git a/invokeai/frontend/web/src/features/parameters/components/Core/ParamNegativePrompt.tsx b/invokeai/frontend/web/src/features/parameters/components/Core/ParamNegativePrompt.tsx index ea6eafd8b9..d825723eb8 100644 --- a/invokeai/frontend/web/src/features/parameters/components/Core/ParamNegativePrompt.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/Core/ParamNegativePrompt.tsx @@ -1,10 +1,10 @@ import { Box, Textarea } from '@invoke-ai/ui-library'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; +import { PromptOverlayButtonWrapper } from 'features/parameters/components/Prompts/PromptOverlayButtonWrapper'; +import { setNegativePrompt } from 'features/parameters/store/generationSlice'; import { AddPromptTriggerButton } from 'features/prompt/AddPromptTriggerButton'; import { PromptPopover } from 'features/prompt/PromptPopover'; import { usePrompt } from 'features/prompt/usePrompt'; -import { PromptOverlayButtonWrapper } from 'features/parameters/components/Prompts/PromptOverlayButtonWrapper'; -import { setNegativePrompt } from 'features/parameters/store/generationSlice'; import { memo, useCallback, useRef } from 'react'; import { useTranslation } from 'react-i18next'; diff --git a/invokeai/frontend/web/src/features/parameters/components/Core/ParamPositivePrompt.tsx b/invokeai/frontend/web/src/features/parameters/components/Core/ParamPositivePrompt.tsx index 5da348f591..8c990e420e 100644 --- a/invokeai/frontend/web/src/features/parameters/components/Core/ParamPositivePrompt.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/Core/ParamPositivePrompt.tsx @@ -1,11 +1,11 @@ import { Box, Textarea } from '@invoke-ai/ui-library'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import { ShowDynamicPromptsPreviewButton } from 'features/dynamicPrompts/components/ShowDynamicPromptsPreviewButton'; +import { PromptOverlayButtonWrapper } from 'features/parameters/components/Prompts/PromptOverlayButtonWrapper'; +import { setPositivePrompt } from 'features/parameters/store/generationSlice'; import { AddPromptTriggerButton } from 'features/prompt/AddPromptTriggerButton'; import { PromptPopover } from 'features/prompt/PromptPopover'; import { usePrompt } from 'features/prompt/usePrompt'; -import { PromptOverlayButtonWrapper } from 'features/parameters/components/Prompts/PromptOverlayButtonWrapper'; -import { setPositivePrompt } from 'features/parameters/store/generationSlice'; import { SDXLConcatButton } from 'features/sdxl/components/SDXLPrompts/SDXLConcatButton'; import { memo, useCallback, useRef } from 'react'; import type { HotkeyCallback } from 'react-hotkeys-hook'; diff --git a/invokeai/frontend/web/src/features/prompt/PromptTriggerSelect.tsx b/invokeai/frontend/web/src/features/prompt/PromptTriggerSelect.tsx index f90e3a18e5..15ec8c3184 100644 --- a/invokeai/frontend/web/src/features/prompt/PromptTriggerSelect.tsx +++ b/invokeai/frontend/web/src/features/prompt/PromptTriggerSelect.tsx @@ -5,8 +5,7 @@ import { useAppSelector } from 'app/store/storeHooks'; import type { PromptTriggerSelectProps } from 'features/prompt/types'; import { t } from 'i18next'; import { map } from 'lodash-es'; -import { useMemo } from 'react'; -import { memo, useCallback } from 'react'; +import { memo, useCallback, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { useGetModelMetadataQuery, useGetTextualInversionModelsQuery } from 'services/api/endpoints/models'; @@ -46,7 +45,7 @@ export const PromptTriggerSelect = memo(({ onSelect, onClose }: PromptTriggerSel options: compatibleEmbeddingsArray.map((model) => ({ label: model.name, value: `<${model.name}>` })), }, ]; - }, [data, currentBaseModel]); + }, [data, currentBaseModel, t]); const options = useMemo(() => { if (!metadata || !metadata.trigger_phrases) { @@ -60,7 +59,7 @@ export const PromptTriggerSelect = memo(({ onSelect, onClose }: PromptTriggerSel }, ]; return [...metadataOptions, ...embeddingOptions]; - }, [embeddingOptions, metadata]); + }, [embeddingOptions, metadata, t]); return ( diff --git a/invokeai/frontend/web/src/features/prompt/types.ts b/invokeai/frontend/web/src/features/prompt/types.ts index 17dd0edd84..e0a375ad26 100644 --- a/invokeai/frontend/web/src/features/prompt/types.ts +++ b/invokeai/frontend/web/src/features/prompt/types.ts @@ -9,5 +9,4 @@ export type PromptPopoverProps = PropsWithChildren & PromptTriggerSelectProps & { isOpen: boolean; width?: number | string; - }; diff --git a/invokeai/frontend/web/src/features/prompt/usePrompt.ts b/invokeai/frontend/web/src/features/prompt/usePrompt.ts index 4bd52172af..911afa978c 100644 --- a/invokeai/frontend/web/src/features/prompt/usePrompt.ts +++ b/invokeai/frontend/web/src/features/prompt/usePrompt.ts @@ -54,7 +54,6 @@ export const usePrompt = ({ prompt, textareaRef, onChange: _onChange }: UseInser [textareaRef, _onChange, prompt] ); - const onFocus = useCallback(() => { textareaRef.current?.focus(); }, [textareaRef]); @@ -64,7 +63,6 @@ export const usePrompt = ({ prompt, textareaRef, onChange: _onChange }: UseInser onFocus(); }, [onFocus, onClose]); - const onSelect = useCallback( (v: string) => { insertTrigger(v); @@ -73,7 +71,6 @@ export const usePrompt = ({ prompt, textareaRef, onChange: _onChange }: UseInser [handleClosePopover, insertTrigger] ); - const onKeyDown: KeyboardEventHandler = useCallback( (e) => { if (e.key === '<') { diff --git a/invokeai/frontend/web/src/features/sdxl/components/SDXLPrompts/ParamSDXLNegativeStylePrompt.tsx b/invokeai/frontend/web/src/features/sdxl/components/SDXLPrompts/ParamSDXLNegativeStylePrompt.tsx index 3688f65b8a..e487da7783 100644 --- a/invokeai/frontend/web/src/features/sdxl/components/SDXLPrompts/ParamSDXLNegativeStylePrompt.tsx +++ b/invokeai/frontend/web/src/features/sdxl/components/SDXLPrompts/ParamSDXLNegativeStylePrompt.tsx @@ -1,9 +1,9 @@ import { Box, Textarea } from '@invoke-ai/ui-library'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; +import { PromptOverlayButtonWrapper } from 'features/parameters/components/Prompts/PromptOverlayButtonWrapper'; import { AddPromptTriggerButton } from 'features/prompt/AddPromptTriggerButton'; import { PromptPopover } from 'features/prompt/PromptPopover'; import { usePrompt } from 'features/prompt/usePrompt'; -import { PromptOverlayButtonWrapper } from 'features/parameters/components/Prompts/PromptOverlayButtonWrapper'; import { setNegativeStylePromptSDXL } from 'features/sdxl/store/sdxlSlice'; import { memo, useCallback, useRef } from 'react'; import { useHotkeys } from 'react-hotkeys-hook'; diff --git a/invokeai/frontend/web/src/features/sdxl/components/SDXLPrompts/ParamSDXLPositiveStylePrompt.tsx b/invokeai/frontend/web/src/features/sdxl/components/SDXLPrompts/ParamSDXLPositiveStylePrompt.tsx index 1561088681..2acb45bd64 100644 --- a/invokeai/frontend/web/src/features/sdxl/components/SDXLPrompts/ParamSDXLPositiveStylePrompt.tsx +++ b/invokeai/frontend/web/src/features/sdxl/components/SDXLPrompts/ParamSDXLPositiveStylePrompt.tsx @@ -1,9 +1,9 @@ import { Box, Textarea } from '@invoke-ai/ui-library'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; +import { PromptOverlayButtonWrapper } from 'features/parameters/components/Prompts/PromptOverlayButtonWrapper'; import { AddPromptTriggerButton } from 'features/prompt/AddPromptTriggerButton'; import { PromptPopover } from 'features/prompt/PromptPopover'; import { usePrompt } from 'features/prompt/usePrompt'; -import { PromptOverlayButtonWrapper } from 'features/parameters/components/Prompts/PromptOverlayButtonWrapper'; import { setPositiveStylePromptSDXL } from 'features/sdxl/store/sdxlSlice'; import { memo, useCallback, useRef } from 'react'; import { useTranslation } from 'react-i18next'; diff --git a/invokeai/frontend/web/src/services/api/endpoints/models.ts b/invokeai/frontend/web/src/services/api/endpoints/models.ts index a41ec4e591..dac6594255 100644 --- a/invokeai/frontend/web/src/services/api/endpoints/models.ts +++ b/invokeai/frontend/web/src/services/api/endpoints/models.ts @@ -24,7 +24,7 @@ export type UpdateModelArg = { body: paths['/api/v2/models/i/{key}']['patch']['requestBody']['content']['application/json']; }; -export type UpdateModelMetadataArg = { +type UpdateModelMetadataArg = { key: paths['/api/v2/models/i/{key}/metadata']['patch']['parameters']['path']['key']; body: paths['/api/v2/models/i/{key}/metadata']['patch']['requestBody']['content']['application/json']; }; diff --git a/invokeai/frontend/web/src/services/api/schema.ts b/invokeai/frontend/web/src/services/api/schema.ts index 21c161ed34..34bfbdd190 100644 --- a/invokeai/frontend/web/src/services/api/schema.ts +++ b/invokeai/frontend/web/src/services/api/schema.ts @@ -576,7 +576,7 @@ export type paths = { }; }; -export type webhooks = Record; +type webhooks = Record; export type components = { schemas: { @@ -11391,9 +11391,9 @@ export type components = { pathItems: never; }; -export type $defs = Record; +type $defs = Record; -export type external = Record; +type external = Record; export type operations = { /**