Skip to content

Commit 985c910

Browse files
committed
refactor: remove primaryColor from whitelabeling settings and related components for cleaner configuration
1 parent 2e03cf3 commit 985c910

File tree

10 files changed

+10
-90
lines changed

10 files changed

+10
-90
lines changed

apps/dokploy/__test__/traefik/server/update-server-config.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ const baseSettings: WebServerSettings = {
5353
appDescription: null,
5454
logoUrl: null,
5555
faviconUrl: null,
56-
primaryColor: null,
5756
customCss: null,
5857
loginLogoUrl: null,
5958
supportUrl: null,

apps/dokploy/components/proprietary/whitelabeling/whitelabeling-preview.tsx

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@ interface WhitelabelingPreviewProps {
1212
config: {
1313
appName?: string;
1414
logoUrl?: string;
15-
primaryColor?: string;
1615
footerText?: string;
1716
};
1817
}
1918

2019
export function WhitelabelingPreview({ config }: WhitelabelingPreviewProps) {
2120
const appName = config.appName || "Dokploy";
22-
const primaryColor = config.primaryColor || "hsl(var(--primary))";
2321

2422
return (
2523
<Card className="bg-transparent">
@@ -40,10 +38,7 @@ export function WhitelabelingPreview({ config }: WhitelabelingPreviewProps) {
4038
className="size-8 rounded-sm object-contain"
4139
/>
4240
) : (
43-
<div
44-
className="size-8 rounded-sm flex items-center justify-center text-white font-bold text-sm"
45-
style={{ backgroundColor: primaryColor }}
46-
>
41+
<div className="size-8 rounded-sm flex items-center justify-center bg-primary text-primary-foreground font-bold text-sm">
4742
{appName.charAt(0).toUpperCase()}
4843
</div>
4944
)}
@@ -53,17 +48,11 @@ export function WhitelabelingPreview({ config }: WhitelabelingPreviewProps) {
5348
{/* Simulated content area */}
5449
<div className="p-4 bg-background">
5550
<div className="flex items-center gap-2 mb-3">
56-
<div
57-
className="h-2 w-16 rounded-full"
58-
style={{ backgroundColor: primaryColor }}
59-
/>
51+
<div className="h-2 w-16 rounded-full bg-primary" />
6052
<div className="h-2 w-24 rounded-full bg-muted" />
6153
</div>
6254
<div className="flex gap-2">
63-
<div
64-
className="px-3 py-1.5 rounded-md text-xs text-white font-medium"
65-
style={{ backgroundColor: primaryColor }}
66-
>
55+
<div className="px-3 py-1.5 rounded-md text-xs bg-primary text-primary-foreground font-medium">
6756
Button
6857
</div>
6958
<div className="px-3 py-1.5 rounded-md text-xs border font-medium">

apps/dokploy/components/proprietary/whitelabeling/whitelabeling-provider.tsx

Lines changed: 2 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -18,76 +18,14 @@ export function WhitelabelingProvider() {
1818
{config.faviconUrl && <link rel="icon" href={config.faviconUrl} />}
1919
</Head>
2020

21-
{(config.customCss || config.primaryColor) && (
21+
{config.customCss && (
2222
<style
2323
id="whitelabeling-styles"
2424
dangerouslySetInnerHTML={{
25-
__html: [
26-
config.primaryColor
27-
? `:root { --primary: ${hexToHSL(config.primaryColor)}; }`
28-
: "",
29-
config.customCss || "",
30-
]
31-
.filter(Boolean)
32-
.join("\n"),
25+
__html: config.customCss,
3326
}}
3427
/>
3528
)}
3629
</>
3730
);
3831
}
39-
40-
/**
41-
* Converts a hex color string to HSL values (without the hsl() wrapper)
42-
* matching the format used by shadcn/ui CSS variables (e.g., "262 83% 58%")
43-
*/
44-
function hexToHSL(hex: string): string {
45-
// Remove # prefix if present
46-
const cleanHex = hex.replace(/^#/, "");
47-
48-
if (
49-
!/^[0-9a-fA-F]{6}$/.test(cleanHex) &&
50-
!/^[0-9a-fA-F]{3}$/.test(cleanHex)
51-
) {
52-
return hex; // Return as-is if not a valid hex color (might be HSL already)
53-
}
54-
55-
let r: number;
56-
let g: number;
57-
let b: number;
58-
59-
if (cleanHex.length === 3) {
60-
r = Number.parseInt(cleanHex[0]! + cleanHex[0], 16);
61-
g = Number.parseInt(cleanHex[1]! + cleanHex[1], 16);
62-
b = Number.parseInt(cleanHex[2]! + cleanHex[2], 16);
63-
} else {
64-
r = Number.parseInt(cleanHex.slice(0, 2), 16);
65-
g = Number.parseInt(cleanHex.slice(2, 4), 16);
66-
b = Number.parseInt(cleanHex.slice(4, 6), 16);
67-
}
68-
69-
r /= 255;
70-
g /= 255;
71-
b /= 255;
72-
73-
const max = Math.max(r, g, b);
74-
const min = Math.min(r, g, b);
75-
const l = (max + min) / 2;
76-
let h = 0;
77-
let s = 0;
78-
79-
if (max !== min) {
80-
const d = max - min;
81-
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
82-
83-
if (max === r) {
84-
h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
85-
} else if (max === g) {
86-
h = ((b - r) / d + 2) / 6;
87-
} else {
88-
h = ((r - g) / d + 4) / 6;
89-
}
90-
}
91-
92-
return `${Math.round(h * 360)} ${Math.round(s * 100)}% ${Math.round(l * 100)}%`;
93-
}

apps/dokploy/components/proprietary/whitelabeling/whitelabeling-settings.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ export function WhitelabelingSettings() {
228228
appDescription: values.appDescription || null,
229229
logoUrl: values.logoUrl || null,
230230
faviconUrl: values.faviconUrl || null,
231-
primaryColor: null,
232231
customCss: values.customCss || null,
233232
loginLogoUrl: values.loginLogoUrl || null,
234233
supportUrl: values.supportUrl || null,

apps/dokploy/drizzle/0148_cold_kitty_pryde.sql

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE "webServerSettings" ADD COLUMN "whitelabelingConfig" jsonb DEFAULT '{"appName":null,"appDescription":null,"logoUrl":null,"faviconUrl":null,"customCss":null,"loginLogoUrl":null,"supportUrl":null,"docsUrl":null,"errorPageTitle":null,"errorPageDescription":null,"metaTitle":null,"footerText":null}'::jsonb;

apps/dokploy/drizzle/meta/0148_snapshot.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"id": "cec2dc6b-f0db-4064-bc17-7f79ed1b8638",
2+
"id": "a293a443-ceaf-418e-8e34-ff46e183995f",
33
"prevId": "2e0aba0b-93fc-4bfe-a975-1c5d45354753",
44
"version": "7",
55
"dialect": "postgresql",
@@ -7179,7 +7179,7 @@
71797179
"type": "jsonb",
71807180
"primaryKey": false,
71817181
"notNull": false,
7182-
"default": "'{\"appName\":null,\"appDescription\":null,\"logoUrl\":null,\"faviconUrl\":null,\"primaryColor\":null,\"customCss\":null,\"loginLogoUrl\":null,\"supportUrl\":null,\"docsUrl\":null,\"errorPageTitle\":null,\"errorPageDescription\":null,\"metaTitle\":null,\"footerText\":null}'::jsonb"
7182+
"default": "'{\"appName\":null,\"appDescription\":null,\"logoUrl\":null,\"faviconUrl\":null,\"customCss\":null,\"loginLogoUrl\":null,\"supportUrl\":null,\"docsUrl\":null,\"errorPageTitle\":null,\"errorPageDescription\":null,\"metaTitle\":null,\"footerText\":null}'::jsonb"
71837183
},
71847184
"cleanupCacheApplications": {
71857185
"name": "cleanupCacheApplications",

apps/dokploy/drizzle/meta/_journal.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,8 +1041,8 @@
10411041
{
10421042
"idx": 148,
10431043
"version": "7",
1044-
"when": 1773124119746,
1045-
"tag": "0148_cold_kitty_pryde",
1044+
"when": 1773129798212,
1045+
"tag": "0148_futuristic_bullseye",
10461046
"breakpoints": true
10471047
}
10481048
]

apps/dokploy/server/api/routers/proprietary/whitelabeling.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ export const whitelabelingRouter = createTRPCRouter({
6666
appDescription: null,
6767
logoUrl: null,
6868
faviconUrl: null,
69-
primaryColor: null,
7069
customCss: null,
7170
loginLogoUrl: null,
7271
supportUrl: null,
@@ -97,7 +96,6 @@ export const whitelabelingRouter = createTRPCRouter({
9796
logoUrl: config.logoUrl,
9897
loginLogoUrl: config.loginLogoUrl,
9998
faviconUrl: config.faviconUrl,
100-
primaryColor: config.primaryColor,
10199
customCss: config.customCss,
102100
metaTitle: config.metaTitle,
103101
errorPageTitle: config.errorPageTitle,

packages/server/src/db/schema/web-server-settings.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ export const webServerSettings = pgTable("webServerSettings", {
7373
appDescription: string | null;
7474
logoUrl: string | null;
7575
faviconUrl: string | null;
76-
primaryColor: string | null;
7776
customCss: string | null;
7877
loginLogoUrl: string | null;
7978
supportUrl: string | null;
@@ -88,7 +87,6 @@ export const webServerSettings = pgTable("webServerSettings", {
8887
appDescription: null,
8988
logoUrl: null,
9089
faviconUrl: null,
91-
primaryColor: null,
9290
customCss: null,
9391
loginLogoUrl: null,
9492
supportUrl: null,
@@ -199,7 +197,6 @@ export const whitelabelingConfigSchema = z.object({
199197
appDescription: z.string().nullable(),
200198
logoUrl: safeUrl,
201199
faviconUrl: safeUrl,
202-
primaryColor: z.string().nullable(),
203200
customCss: z.string().nullable(),
204201
loginLogoUrl: safeUrl,
205202
supportUrl: safeUrl,

0 commit comments

Comments
 (0)