Private
Public Access
Add adjustable text size and emoji size preferences (#71)
Text was too small on high-DPI screens with no in-app fix beyond browser zoom. Adds a text-size setting (scales the whole app via a root font-size percentage), auto-large rendering for emoji-only messages, and an independent emoji-size preference that also scales reaction pills without affecting the emoji picker's fixed-size grid. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,17 @@ class User(Base):
|
||||
is_active: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||||
display_name: Mapped[str | None] = mapped_column(String(50))
|
||||
theme: Mapped[str | None] = mapped_column(String(20))
|
||||
# #71: null means "normal" (the pre-existing default before this
|
||||
# setting existed) -- a preset name, not a raw scale factor, so it's
|
||||
# validated/enumerable the same way `theme` already is rather than
|
||||
# accepting an arbitrary float.
|
||||
text_scale: Mapped[str | None] = mapped_column(String(20))
|
||||
# #71: independent of text_scale above -- scales emoji rendered in
|
||||
# message text specifically, not the whole UI (see
|
||||
# frontend/src/components/MessageContent.tsx's --emoji-scale, scoped
|
||||
# to message content only so it can't also inflate the emoji picker's
|
||||
# grid or reaction pills).
|
||||
emoji_scale: Mapped[str | None] = mapped_column(String(20))
|
||||
# Only meaningful when theme == "custom" -- which of this user's saved
|
||||
# CustomTheme rows (app/models/custom_theme.py) is currently active.
|
||||
# Cleared explicitly (not via a DB-level ON DELETE) whenever that theme
|
||||
|
||||
@@ -100,6 +100,10 @@ async def update_profile(
|
||||
current_user.display_name = display_name or None
|
||||
if "theme" in updates:
|
||||
current_user.theme = updates["theme"]
|
||||
if "text_scale" in updates:
|
||||
current_user.text_scale = updates["text_scale"]
|
||||
if "emoji_scale" in updates:
|
||||
current_user.emoji_scale = updates["emoji_scale"]
|
||||
if "appear_offline" in updates:
|
||||
current_user.appear_offline = updates["appear_offline"]
|
||||
await db.commit()
|
||||
|
||||
@@ -23,6 +23,8 @@ class UserRead(BaseModel):
|
||||
is_site_admin: bool
|
||||
display_name: str | None
|
||||
theme: str | None
|
||||
text_scale: str | None
|
||||
emoji_scale: str | None
|
||||
# Resolved, not just an id -- the frontend needs the actual palette to
|
||||
# paint on load without a second round trip (see lib/theme.ts).
|
||||
active_custom_theme: CustomThemeRead | None
|
||||
@@ -57,6 +59,10 @@ class ProfileUpdate(BaseModel):
|
||||
# ownership check; that's POST /api/custom-themes/{id}/activate, not a
|
||||
# bare theme name with nothing to point it at.
|
||||
theme: Literal["dark", "light", "midnight", "sunset"] | None = Field(default=None)
|
||||
# #71: kept in sync with frontend/src/lib/theme.ts's TEXT_SCALE_PERCENT map.
|
||||
text_scale: Literal["small", "normal", "large", "xlarge"] | None = Field(default=None)
|
||||
# #71: kept in sync with MessageContent.tsx's EMOJI_SCALE_MULTIPLIER map.
|
||||
emoji_scale: Literal["small", "normal", "large", "xlarge"] | None = Field(default=None)
|
||||
appear_offline: bool | None = Field(default=None)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user