From 602aaeb641c0696d4405e698bd3b1371af3d76bf Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Sun, 22 Feb 2026 23:15:47 +0000 Subject: [PATCH] wip --- .../integration-link-view.tsx | 49 ++++++++++++------- .../core/integration/unfurl/unfurl.service.ts | 6 +-- apps/server/src/ee | 2 +- 3 files changed, 35 insertions(+), 22 deletions(-) diff --git a/apps/client/src/features/editor/components/integration-link/integration-link-view.tsx b/apps/client/src/features/editor/components/integration-link/integration-link-view.tsx index 65a502d00..8ae501086 100644 --- a/apps/client/src/features/editor/components/integration-link/integration-link-view.tsx +++ b/apps/client/src/features/editor/components/integration-link/integration-link-view.tsx @@ -13,6 +13,28 @@ import { useEffect, useCallback, memo } from "react"; import { unfurlUrl } from "@/features/integration/services/integration-service"; import classes from "./integration-link-view.module.css"; +function toBadgeColor(raw?: string): string { + if (!raw) return "gray"; + const hex = raw.toLowerCase().replace("#", ""); + if (/^[0-9a-f]{6}$/.test(hex)) { + const r = parseInt(hex.slice(0, 2), 16); + const g = parseInt(hex.slice(2, 4), 16); + const b = parseInt(hex.slice(4, 6), 16); + const max = Math.max(r, g, b); + const min = Math.min(r, g, b); + const l = (max + min) / 2 / 255; + if (max - min < 30) return l > 0.6 ? "gray" : "dark"; + if (r > g && r > b) return g > 160 ? "orange" : "red"; + if (g > r && g > b) return r > 160 ? "lime" : "green"; + if (b > r && b > g) return r > 100 ? "violet" : "blue"; + if (r > 200 && g > 200) return "yellow"; + if (r > 200 && b > 200) return "pink"; + if (g > 200 && b > 200) return "cyan"; + return "gray"; + } + return raw; +} + const providerIcons: Record = { github: "https://github.githubassets.com/favicons/favicon-dark.svg", gitlab: "https://gitlab.com/assets/favicon-72a2cad5025aa931d6ea56c3201d1f18e68a8571da3c2571592f63571e0c5571.png", @@ -109,7 +131,7 @@ function IntegrationLinkView(props: any) { {unfurlData.status} @@ -118,24 +140,15 @@ function IntegrationLinkView(props: any) { {unfurlData.description && ( - - {unfurlData.description} - - )} - - - {iconUrl && ( - - )} - - {unfurlData.provider} - - {unfurlData.author && ( - - ยท {unfurlData.author} + + {iconUrl && ( + + )} + + {unfurlData.description} - )} - + + )} diff --git a/apps/server/src/core/integration/unfurl/unfurl.service.ts b/apps/server/src/core/integration/unfurl/unfurl.service.ts index cd5cca159..54bad96de 100644 --- a/apps/server/src/core/integration/unfurl/unfurl.service.ts +++ b/apps/server/src/core/integration/unfurl/unfurl.service.ts @@ -34,7 +34,7 @@ export class UnfurlService { userId: string, workspaceId: string, ): Promise { - const cacheKey = this.buildCacheKey(workspaceId, url); + const cacheKey = this.buildCacheKey(workspaceId, userId, url); const cached = await this.redis.get(cacheKey); if (cached) { return JSON.parse(cached); @@ -127,12 +127,12 @@ export class UnfurlService { return null; } - private buildCacheKey(workspaceId: string, url: string): string { + private buildCacheKey(workspaceId: string, userId: string, url: string): string { const hash = crypto .createHash('sha256') .update(url) .digest('hex') .slice(0, 16); - return `${UNFURL_CACHE_PREFIX}${workspaceId}:${hash}`; + return `${UNFURL_CACHE_PREFIX}${workspaceId}:${userId}:${hash}`; } } diff --git a/apps/server/src/ee b/apps/server/src/ee index 010a833e1..73f6bad79 160000 --- a/apps/server/src/ee +++ b/apps/server/src/ee @@ -1 +1 @@ -Subproject commit 010a833e1a978faf02d4038baa9f9775ce2916e2 +Subproject commit 73f6bad794ef848dc094fe503784b02d0b9cfdb7