From 86f4cf7857d02f33e24097798fd5989f20957c97 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu, 17 Jul 2025 14:09:48 +1000 Subject: [PATCH] feat(ui): related embedding styling/tidy --- .../features/prompt/PromptTriggerSelect.tsx | 39 +++++++++---------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/invokeai/frontend/web/src/features/prompt/PromptTriggerSelect.tsx b/invokeai/frontend/web/src/features/prompt/PromptTriggerSelect.tsx index 0633a4beb3..fe857f13c2 100644 --- a/invokeai/frontend/web/src/features/prompt/PromptTriggerSelect.tsx +++ b/invokeai/frontend/web/src/features/prompt/PromptTriggerSelect.tsx @@ -1,5 +1,5 @@ import type { ChakraProps, ComboboxOnChange, ComboboxOption } from '@invoke-ai/ui-library'; -import { Combobox, FormControl, Icon } from '@invoke-ai/ui-library'; +import { Combobox, Flex, FormControl, Icon } from '@invoke-ai/ui-library'; import { skipToken } from '@reduxjs/toolkit/query'; import { useAppSelector } from 'app/store/storeHooks'; import type { GroupBase } from 'chakra-react-select'; @@ -18,7 +18,7 @@ import { isNonRefinerMainModelConfig } from 'services/api/types'; const noOptionsMessage = () => t('prompt.noMatchingTriggers'); -type RelatedEmbedding = ComboboxOption & { starred?: boolean }; +type ComboboxOptionWithStarred = ComboboxOption & { starred?: boolean }; export const PromptTriggerSelect = memo(({ onSelect, onClose }: PromptTriggerSelectProps) => { const { t } = useTranslation(); @@ -65,7 +65,7 @@ export const PromptTriggerSelect = memo(({ onSelect, onClose }: PromptTriggerSel ); const options = useMemo(() => { - const _options: GroupBase[] = []; + const _options: GroupBase[] = []; if (loraModels) { const triggerPhraseOptions = loraModels @@ -88,7 +88,7 @@ export const PromptTriggerSelect = memo(({ onSelect, onClose }: PromptTriggerSel if (tiModels) { // Create embedding options with starred property for related models - const embeddingOptions: RelatedEmbedding[] = tiModels + const embeddingOptions: ComboboxOptionWithStarred[] = tiModels .filter((ti) => ti.base === mainModelConfig?.base) .map((model) => ({ label: model.name, @@ -128,27 +128,26 @@ export const PromptTriggerSelect = memo(({ onSelect, onClose }: PromptTriggerSel return _options; }, [tiModels, loraModels, mainModelConfig, t, addedLoRAs, relatedModelKeys]); - const formatOptionLabel = useCallback((option: ComboboxOption) => { - const embeddingOption = option as RelatedEmbedding; - if (embeddingOption.starred) { - return ( -
- - {option.label} -
- ); - } - return option.label; + const formatOptionLabel = useCallback((option: ComboboxOptionWithStarred) => { + return ( + + {option.starred && } + {option.label} + + ); }, []); + const placeholder = useMemo(() => { + if (isLoadingLoRAs || isLoadingTIs || isLoadingMainModelConfig) { + return t('common.loading'); + } + return t('prompt.addPromptTrigger'); + }, [t, isLoadingLoRAs, isLoadingTIs, isLoadingMainModelConfig]); + return (