From 768037429e37e33332c04cc3283112d91c41f9de Mon Sep 17 00:00:00 2001 From: enteresanlikk <23117378+enteresanlikk@users.noreply.github.com> Date: Mon, 10 Aug 2026 23:44:18 +0300 Subject: [PATCH] refactor(ui): render images through one component --- apps/platform/src/components/shared/image.tsx | 17 ++++++++++++++--- .../flow-editor/icons/provider-icons.tsx | 4 ++-- .../src/features/navigation/components/logo.tsx | 1 + .../components/history/output-renderer.tsx | 4 ++-- apps/platform/src/layouts/auth-layout.tsx | 1 + 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/apps/platform/src/components/shared/image.tsx b/apps/platform/src/components/shared/image.tsx index 6d95878..c8bbcb1 100644 --- a/apps/platform/src/components/shared/image.tsx +++ b/apps/platform/src/components/shared/image.tsx @@ -1,13 +1,24 @@ import type { ImgHTMLAttributes } from 'react' -type ImageProps = ImgHTMLAttributes +type ImageProps = ImgHTMLAttributes & { + /** Set on anything visible before the page is scrolled. */ + priority?: boolean +} -const Image = ({ src, ...rest }: ImageProps) => { +const Image = ({ src, priority = false, ...rest }: ImageProps) => { if (!src) { return null } - return + return ( + + ) } Image.displayName = 'Image' diff --git a/apps/platform/src/features/flow-editor/icons/provider-icons.tsx b/apps/platform/src/features/flow-editor/icons/provider-icons.tsx index 05f86f8..6a53261 100644 --- a/apps/platform/src/features/flow-editor/icons/provider-icons.tsx +++ b/apps/platform/src/features/flow-editor/icons/provider-icons.tsx @@ -2,6 +2,7 @@ import { useCallback } from 'react' import type { ReactNode } from 'react' import type { IconSource } from '@/features/flow-editor/types' +import { Image } from '@/components/shared/image' import { cn } from '@/lib/utils' import { useThemeStore } from '@/stores/theme-store' @@ -18,11 +19,10 @@ export type ProviderIconComponent = (props: IconProps) => ReactNode const builtIcons = new Map() const artwork = (source: string, className?: string) => ( - ) diff --git a/apps/platform/src/features/navigation/components/logo.tsx b/apps/platform/src/features/navigation/components/logo.tsx index 69fac2b..36dbe6b 100644 --- a/apps/platform/src/features/navigation/components/logo.tsx +++ b/apps/platform/src/features/navigation/components/logo.tsx @@ -26,6 +26,7 @@ const PlatformLogo = ({ width = 200, height = 40, className = '' }) => { return ( {t('ui.text.platformLogo')} ( const ImageOutput = ({ value }: { value: string }) => (
- {i18next.t('ui.text.dataOutput')}
diff --git a/apps/platform/src/layouts/auth-layout.tsx b/apps/platform/src/layouts/auth-layout.tsx index 3cbae58..3114c4c 100644 --- a/apps/platform/src/layouts/auth-layout.tsx +++ b/apps/platform/src/layouts/auth-layout.tsx @@ -24,6 +24,7 @@ const AuthLayout = () => {