⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.
TypeScript agenticagileai-agentsbug-reportingbug-trackerganttissue-trackerjirajira-alternativekanbanlinearlinear-alternativeopen-sourceproduct-managementproject-managementroadmapself-hostedsprint-planningteam-collaborationtrello-alternative
fix(web): replace raw img tags with next/image and memoize tool catalog (#28)
Croff21a4fc2248f3
diff --git a/apps/web/next.config.ts b/apps/web/next.config.tsindex 46a30ca7..c6cf5c42 100644--- a/apps/web/next.config.ts+++ b/apps/web/next.config.ts@@ -10,6 +10,12 @@ const nextConfig: NextConfig = {// files (default-stylesheet.css) by a path relative to its module. Bundling it// breaks that path, so it is required from node_modules at runtime instead.serverExternalPackages: ['isomorphic-dompurify'],+ // Avatars and attachments are served by the api on its own origin, and the+ // image optimizer only fetches from allowed origins. NEXT_PUBLIC_API_URL is+ // the value the client uses too (src/lib/api.ts) and is set at build time.+ images: {+ remotePatterns: [new URL('/**', process.env.NEXT_PUBLIC_API_URL)],+ },};export default nextConfig;diff --git a/apps/web/src/components/common/Avatar.tsx b/apps/web/src/components/common/Avatar.tsxindex 9157606c..a329791a 100644--- a/apps/web/src/components/common/Avatar.tsx+++ b/apps/web/src/components/common/Avatar.tsx@@ -1,6 +1,7 @@'use client';import { forwardRef, useState, type ComponentProps } from 'react';+import Image from 'next/image';import { avatarColor, initials } from '@/utils/avatar';import { resolveApiUrl } from '@/lib/api';import { cn } from '@/lib/utils';@@ -26,7 +27,7 @@ const Avatar = forwardRef<<spanref={ref}className={cn(- 'inline-flex size-5 shrink-0 items-center justify-center overflow-hidden rounded-full text-[9px] font-semibold text-white',+ 'relative inline-flex size-5 shrink-0 items-center justify-center overflow-hidden rounded-full text-[9px] font-semibold text-white',className,)}{...props}@@ -36,11 +37,15 @@ const Avatar = forwardRef<}}>{showImage ? (- <img+ <Imagesrc={resolveApiUrl(image!)}alt={name}+ fill+ // The largest avatar in the app is size-16 (64px); everything else is+ // smaller, so one candidate width covers them all.+ sizes="64px"draggable={false}- className="size-full object-cover"+ className="object-cover"onError={() => setFailedSrc(image!)}/>) : (diff --git a/apps/web/src/features/issue/components/detail/IssueAttachmentsPanel.tsx b/apps/web/src/features/issue/components/detail/IssueAttachmentsPanel.tsxindex 8e54c47c..cb455ece 100644--- a/apps/web/src/features/issue/components/detail/IssueAttachmentsPanel.tsx+++ b/apps/web/src/features/issue/components/detail/IssueAttachmentsPanel.tsx@@ -1,4 +1,5 @@import { useRef, useState, type DragEvent } from 'react';+import Image from 'next/image';import {Download,FileIcon,@@ -38,7 +39,18 @@ function formatSize(bytes: number): string {// The card's leading thumbnail: images and videos preview themselves, every// other type falls back to a generic file glyph.function AttachmentThumb({ a }: { a: Attachment }) {- if (isImage(a)) return <img src={a.url} alt={a.filename} draggable={false} />;+ if (isImage(a))+ return (+ <Image+ src={a.url}+ alt={a.filename}+ fill+ // The thumbnail is w-10 (40px) in every card size used here.+ sizes="40px"+ draggable={false}+ className="object-cover"+ />+ );if (isVideo(a))return <video src={a.url} className="size-full object-cover" muted draggable={false} />;return <FileIcon className="text-muted-foreground" />;diff --git a/apps/web/src/features/settings/components/agent-tools/SettingsAgentTools.tsx b/apps/web/src/features/settings/components/agent-tools/SettingsAgentTools.tsxindex 848b4c47..4dccd761 100644--- a/apps/web/src/features/settings/components/agent-tools/SettingsAgentTools.tsx+++ b/apps/web/src/features/settings/components/agent-tools/SettingsAgentTools.tsx@@ -17,7 +17,7 @@ export default function SettingsAgentTools({ project }: { project: ProjectDetailconst toolsQuery = useConfiguredToolsQuery(projectKey);const tools = toolsQuery.data ?? [];const catalogQuery = useIntegrationCatalogQuery(projectKey);- const catalog = catalogQuery.data ?? [];+ const catalog = useMemo(() => catalogQuery.data ?? [], [catalogQuery.data]);const deleteTool = useDeleteConfiguredTool(projectKey);const can = useSettingsCan();