Skip to main content

HomeRoom

Location: src/components/HomeRoom.jsx

Overview

HomeRoom is the personal space for each user, accessible at /room/:username. It replaces the traditional profile page with a modular, customizable room. The room owner can add, remove, and reorder modules (about, photos, links, featured posts, MeBook, guestbook, posts, friends, Spotify, custom), and apply room-level styling (colors, fonts, backgrounds).

Visitors who are blocked see a ProfileBlockedState. The owner sees editing controls. Non-owners see a read-only view with friend, message, and report actions.

Relevant Invariants

  • Invariant #10: "Expressive Freedom Is Spatially Contained" -- Deep customization is confined to the user own HomeRoom.
  • Invariant #7: "Human-Scale Social Contexts" -- The friends module and guestbook keep interactions personal.
  • Invariant #14: "Privacy Is Infrastructure" -- Block state is checked before any content renders.

Props

PropTypeRequiredDefaultDescription
sessionobjectYes--Supabase auth session

URL Parameters

ParameterDescription
:usernameThe username of the room owner, resolved from the profiles table

Module Types

ModuleComponentDescription
aboutAboutModuleBio and personal info
photosPhotosModulePhoto gallery
linksLinksModuleExternal links collection
featured_postsFeaturedPostsModulePinned/featured posts
mebookMeBookModulePersonal Q&A / journal
guestbookGuestbookModuleVisitor messages
postsPostsModuleUser recent posts
friendsFriendsModuleFriends list display
spotifySpotifyModuleSpotify embed
customCustomModuleUser-defined custom content

Token-Based Styling

When the room owner has a homeroom_style saved on their profile, HomeRoom applies token-based visual styling via useStyleFor(roomOwner.homeroom_style). This includes:

  • Container: Background color, pattern SVG, font family
  • Avatar: Custom shape (hexagon, diamond, star, etc.) via StyledAvatar
  • Module cards: Per-module style via useModuleStyle with inheritance, or room-level fallback
  • Headings: Weight, transform, letter-spacing, glow, ornament prefix
  • Dividers: Token-based divider style between header and content via StyledDivider

Rooms without homeroom_style render with the existing CSS-variable system (from room_styles table) unchanged.

Per-Module Styling

Each module can have its own style_tokens and inherit_style (stored in home_room_modules). The HomeRoomModule component uses useModuleStyle to compute the effective merged tokens, then useStyleFor to derive visual values:

  1. Module has effective style (own tokens + inheritance merge) — renders with per-module computed style
  2. No module style but room has tokenStyle — falls back to room-level computed style
  3. Neither — renders with default CSS classes

Module cards use the clip-path border wrapper technique for non-rounded corners, with glass/backdrop-blur support when tokens.glass is enabled.

Owner Controls

The room owner sees two buttons:

  • Paintbrush icon — navigates to /room/style (token-based customizer)
  • Settings icon — navigates to /room/customize (layout, modules, visibility)

Styled Components Used

ComponentLocationPurpose
StyledAvatarsrc/components/homeroom-styled/StyledAvatar.jsxAvatar with clip-path shape, border, glow
StyledDividersrc/components/homeroom-styled/StyledDivider.jsxDivider with gradient, glow, ornament, dashed styles
HookPurpose
useModuleStylePer-module style tokens with Homeroom inheritance
useStyleForComputes visual values from tokens (via StyleContext)

Last updated: 2026-02-08