feat: space avatar color with color picker UI
Add avatarColor field to spaces, matching the user avatar color system. Spaces get a random color on creation and owners can change it in space settings. The color controls the fallback gradient when no icon is uploaded, replacing the old deterministic hash-based gradient. Includes full federation support, explore page, mutual spaces, and color picker in both create and settings modals.
This commit is contained in:
@@ -146,6 +146,7 @@ function buildFullSpace(spaceId: string, forUserId: string): SpaceWithChannelsAn
|
||||
name: space.name,
|
||||
icon: space.icon,
|
||||
banner: space.banner ?? null,
|
||||
avatarColor: (space.avatarColor as SpaceWithChannelsAndMembers['avatarColor']) ?? null,
|
||||
ownerId: space.ownerId,
|
||||
inviteCode: space.inviteCode,
|
||||
visibility: (space.visibility ?? 'private') as SpaceWithChannelsAndMembers['visibility'],
|
||||
@@ -203,7 +204,7 @@ export async function exploreRoutes(app: FastifyInstance): Promise<void> {
|
||||
|
||||
let countSql = `SELECT COUNT(DISTINCT s.id) as total FROM spaces s WHERE s.visibility IN ('public', 'request')`;
|
||||
let querySql = `
|
||||
SELECT s.id, s.name, s.icon, s.banner, s.description, s.visibility, s.created_at,
|
||||
SELECT s.id, s.name, s.icon, s.banner, s.avatar_color, s.description, s.visibility, s.created_at,
|
||||
COUNT(sm.user_id) as member_count
|
||||
FROM spaces s
|
||||
LEFT JOIN space_members sm ON sm.space_id = s.id
|
||||
@@ -227,6 +228,7 @@ export async function exploreRoutes(app: FastifyInstance): Promise<void> {
|
||||
name: string;
|
||||
icon: string | null;
|
||||
banner: string | null;
|
||||
avatar_color: string | null;
|
||||
description: string | null;
|
||||
visibility: string;
|
||||
created_at: number;
|
||||
@@ -238,6 +240,7 @@ export async function exploreRoutes(app: FastifyInstance): Promise<void> {
|
||||
name: r.name,
|
||||
icon: r.icon,
|
||||
banner: r.banner,
|
||||
avatarColor: (r.avatar_color as ExploreSpace['avatarColor']) ?? null,
|
||||
description: r.description,
|
||||
visibility: r.visibility as ExploreSpace['visibility'],
|
||||
memberCount: r.member_count,
|
||||
|
||||
Reference in New Issue
Block a user