Skip to content

Commit 00d0ec8

Browse files
authored
feat: add support for new skin logo in space settings (#498)
* fix: improve skin update code * feat: add suppprt for logo in space skins * test: fix tests * fix: fix column order * fix: allow skinParams only for turbo spaces * fix: rename params to skinSettings to follow hub convention * fix: save hex code when saving skin color * fix: fix wrong invalid column update
1 parent 84721fb commit 00d0ec8

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

src/helpers/actions.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,17 @@ export async function addOrUpdateSkin(id: string, skinSettings: Record<string, s
6666
SET ?
6767
ON DUPLICATE KEY UPDATE
6868
${COLORS.map(color => `${color} = ?`).join(',')},
69-
theme = COALESCE(VALUES(theme), theme)
69+
theme = COALESCE(VALUES(theme), ?),
70+
logo = ?
7071
`,
7172
[
7273
{
7374
id,
7475
...skinSettings
7576
},
7677
...COLORS.map(color => skinSettings[color]),
77-
skinSettings.theme
78+
skinSettings.theme,
79+
skinSettings.logo
7880
]
7981
);
8082
}

test/integration/helpers/actions.test.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,8 @@ describe('helpers/actions', () => {
200200
heading_color: '#ffffff',
201201
primary_color: '#ffffff',
202202
header_color: null,
203-
theme: 'light'
203+
theme: 'light',
204+
logo: null
204205
});
205206
});
206207

@@ -236,7 +237,8 @@ describe('helpers/actions', () => {
236237
heading_color: null,
237238
primary_color: null,
238239
header_color: null,
239-
theme: 'light'
240+
theme: 'light',
241+
logo: null
240242
});
241243

242244
await addOrUpdateSkin(testId, { theme: 'dark' });
@@ -251,7 +253,8 @@ describe('helpers/actions', () => {
251253
heading_color: null,
252254
primary_color: null,
253255
header_color: null,
254-
theme: 'dark'
256+
theme: 'dark',
257+
logo: null
255258
});
256259
});
257260
});

test/schema.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ CREATE TABLE skins (
204204
primary_color VARCHAR(7) DEFAULT NULL,
205205
header_color VARCHAR(7) DEFAULT NULL,
206206
theme VARCHAR(5) NOT NULL DEFAULT 'light',
207+
logo VARCHAR(256) DEFAULT NULL,
207208
PRIMARY KEY (id)
208209
);
209210

0 commit comments

Comments
 (0)