From 013c929cd10653314468c0085457afaea57fb1f2 Mon Sep 17 00:00:00 2001 From: Francis Cao Date: Thu, 12 Mar 2026 11:28:19 -0700 Subject: [PATCH] Test favicon, fix remove/add overlap bug, fix badge overlapping component bug --- src/app/(main)/boards/BoardEntityBadge.tsx | 30 +++++++++- .../boards/[boardId]/BoardEditColumn.tsx | 57 +++++++++---------- .../boards/[boardId]/BoardViewColumn.tsx | 18 ++++-- .../(main)/boards/useBoardEntityBadgeProps.ts | 2 +- 4 files changed, 68 insertions(+), 39 deletions(-) diff --git a/src/app/(main)/boards/BoardEntityBadge.tsx b/src/app/(main)/boards/BoardEntityBadge.tsx index 70fc3604e..c5b476ff9 100644 --- a/src/app/(main)/boards/BoardEntityBadge.tsx +++ b/src/app/(main)/boards/BoardEntityBadge.tsx @@ -1,12 +1,38 @@ import { Icon, Row, Text } from '@umami/react-zen'; +import { useState } from 'react'; +import { Favicon } from '@/components/common/Favicon'; import { Globe, Grid2x2, Link } from '@/components/icons'; import type { BoardEntityType } from '@/lib/boards'; -export function BoardEntityBadge({ type, name }: { type: BoardEntityType; name: string }) { +function WebsiteIcon({ domain }: { domain?: string }) { + const [failed, setFailed] = useState(false); + + if (domain && !failed) { + return setFailed(true)} />; + } + + return ; +} + +export function BoardEntityBadge({ + type, + name, + domain, +}: { + type: BoardEntityType; + name: string; + domain?: string; +}) { return ( - {type === 'pixel' ? : type === 'link' ? : } + {type === 'pixel' ? ( + + ) : type === 'link' ? ( + + ) : ( + + )} {name} diff --git a/src/app/(main)/boards/[boardId]/BoardEditColumn.tsx b/src/app/(main)/boards/[boardId]/BoardEditColumn.tsx index e0d3395da..32cfc7c26 100644 --- a/src/app/(main)/boards/[boardId]/BoardEditColumn.tsx +++ b/src/app/(main)/boards/[boardId]/BoardEditColumn.tsx @@ -1,3 +1,8 @@ +import { Panel } from '@/components/common/Panel'; +import { useBoard, useMessages, useNavigation } from '@/components/hooks'; +import { Pencil, Plus, X } from '@/components/icons'; +import { getBoardEntity, getBoardType, getResolvedComponentEntity } from '@/lib/boards'; +import type { BoardComponentConfig } from '@/lib/types'; import { Box, Button, @@ -10,11 +15,6 @@ import { TooltipTrigger, } from '@umami/react-zen'; import { useMemo, useState } from 'react'; -import { Panel } from '@/components/common/Panel'; -import { useBoard, useMessages, useNavigation } from '@/components/hooks'; -import { Pencil, Plus, X } from '@/components/icons'; -import { getBoardEntity, getBoardType, getResolvedComponentEntity } from '@/lib/boards'; -import type { BoardComponentConfig } from '@/lib/types'; import { getComponentDefinition } from '../boardComponentRegistry'; import { BoardComponentRenderer } from './BoardComponentRenderer'; import { BoardComponentSelect } from './BoardComponentSelect'; @@ -79,7 +79,7 @@ export function BoardEditColumn({ onMouseEnter={() => setShowActions(true)} onMouseLeave={() => setShowActions(false)} > - {canEdit && canRemoveAction && showActions && ( + {canEdit && (showActions || !hasComponent) && ( - - {hasComponent && ( - - - {t(labels.edit)} - - )} + - - {t(labels.remove)} + {t(hasComponent ? labels.edit : labels.selectComponent)} + {canRemoveAction && ( + + + {t(labels.remove)} + + )} )} - {renderedComponent ? ( + {renderedComponent && ( {renderedComponent} - ) : ( - canEdit && ( - - - - ) )} - {showEntityBadge && isOpenBoardType(boardType) && entityBadge && ( - - - + {showBadge && ( + title ? ( + + + + ) : ( + + + + ) )} diff --git a/src/app/(main)/boards/useBoardEntityBadgeProps.ts b/src/app/(main)/boards/useBoardEntityBadgeProps.ts index cbb55025f..42958352e 100644 --- a/src/app/(main)/boards/useBoardEntityBadgeProps.ts +++ b/src/app/(main)/boards/useBoardEntityBadgeProps.ts @@ -13,7 +13,7 @@ export function useBoardEntityBadgeProps( const { data: link } = useLinkQuery(enabled && entityType === 'link' ? entityId : undefined); if (entityType === 'website' && website?.name) { - return { type: entityType, name: website.name }; + return { type: entityType, name: website.name, domain: website.domain ?? undefined }; } if (entityType === 'pixel' && pixel?.name) {