mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): display created_by
using valueOrNull
This commit is contained in:
parent
e706afe8a6
commit
7a3e19227f
@ -1,6 +1,8 @@
|
|||||||
import { ExternalLink, Flex, Tab, TabList, TabPanel, TabPanels, Tabs, Text } from '@invoke-ai/ui-library';
|
import { ExternalLink, Flex, Tab, TabList, TabPanel, TabPanels, Tabs, Text } from '@invoke-ai/ui-library';
|
||||||
import { IAINoContentFallback } from 'common/components/IAIImageFallback';
|
import { IAINoContentFallback } from 'common/components/IAIImageFallback';
|
||||||
import ScrollableContent from 'common/components/OverlayScrollbars/ScrollableContent';
|
import ScrollableContent from 'common/components/OverlayScrollbars/ScrollableContent';
|
||||||
|
import { useMetadataItem } from 'features/metadata/hooks/useMetadataItem';
|
||||||
|
import { handlers } from 'features/metadata/util/handlers';
|
||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useDebouncedMetadata } from 'services/api/hooks/useDebouncedMetadata';
|
import { useDebouncedMetadata } from 'services/api/hooks/useDebouncedMetadata';
|
||||||
@ -23,6 +25,7 @@ const ImageMetadataViewer = ({ image }: ImageMetadataViewerProps) => {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const { metadata } = useDebouncedMetadata(image.image_name);
|
const { metadata } = useDebouncedMetadata(image.image_name);
|
||||||
|
const createdBy = useMetadataItem(metadata, handlers.createdBy);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
@ -37,12 +40,10 @@ const ImageMetadataViewer = ({ image }: ImageMetadataViewerProps) => {
|
|||||||
overflow="hidden"
|
overflow="hidden"
|
||||||
>
|
>
|
||||||
<ExternalLink href={image.image_url} label={image.image_name} />
|
<ExternalLink href={image.image_url} label={image.image_name} />
|
||||||
{metadata && metadata['created_by'] && typeof metadata['created_by'] === 'string' ? (
|
{createdBy.valueOrNull && (
|
||||||
<Text>
|
<Text>
|
||||||
{t('metadata.createdBy')}: {metadata['created_by']}
|
{t('metadata.createdBy')}: {createdBy.valueOrNull}
|
||||||
</Text>
|
</Text>
|
||||||
) : (
|
|
||||||
<></>
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Tabs variant="line" isLazy={true} display="flex" flexDir="column" w="full" h="full">
|
<Tabs variant="line" isLazy={true} display="flex" flexDir="column" w="full" h="full">
|
||||||
|
Loading…
Reference in New Issue
Block a user