fix(detail-panel): replace pixel math and fixed tooltip in ServiceBadge
- Remove magic-number width calculations (maxTotalWidth, nameCharWidth) - Remove useState tooltip + position:fixed custom tooltip div - Use CSS flex/truncate for layout and Shadcn Tooltip for path hover - Add ServiceBadge rendering tests (name, port, path, link vs plain text)
This commit is contained in:
@@ -660,10 +660,10 @@ const CATEGORY_COLORS: Record<string, string> = {
|
||||
}
|
||||
|
||||
function ServiceBadge({ svc, host, onEdit, onRemove }: { svc: ServiceInfo; host?: string; onEdit: () => void; onRemove: () => void }) {
|
||||
const url = getServiceUrl(svc, host);
|
||||
const color = CATEGORY_COLORS[svc.category ?? ''] ?? '#8b949e';
|
||||
const hasPort = svc.port != null;
|
||||
const portLabel = hasPort ? String(svc.port) : '';
|
||||
const url = getServiceUrl(svc, host)
|
||||
const color = CATEGORY_COLORS[svc.category ?? ''] ?? '#8b949e'
|
||||
const hasPort = svc.port != null
|
||||
const portLabel = hasPort ? String(svc.port) : ''
|
||||
const pathLabel = svc.path?.trim() ? svc.path.trim() : ''
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user