Commit df189218 authored by Aryan Noshirvnai's avatar Aryan Noshirvnai

Rooms: replace bare checkbox with the same themed toggle Radio uses

CreateRoomModal's "Tie to a real-world location" was a plain, unstyled
<input type="checkbox"> - the actual bug behind this round's report, which
got conflated with a similarly-worded (but separate) fix already shipped for
Radio's own create form. Both features independently used the identical
phrase "tie to a real-world location," which is what caused the mix-up.

Swapped it for the same ToggleRow switch Radio now uses, so both features
share one themed control instead of each inventing its own.
Co-Authored-By: 's avatarClaude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
parent d9dde94c
import { useCallback, useEffect, useRef, useState, type FormEvent } from 'react' import { useCallback, useEffect, useRef, useState, type FormEvent } from 'react'
import { X } from 'lucide-react' import { MapPin, X } from 'lucide-react'
import { Button } from './ui/Button' import { Button } from './ui/Button'
import { Input } from './ui/Input' import { Input } from './ui/Input'
import { ToggleRow } from './ui/ToggleRow'
import { LocationPicker } from './LocationPicker' import { LocationPicker } from './LocationPicker'
import { createRoom, type LiveRoom } from '../api/social' import { createRoom, type LiveRoom } from '../api/social'
import { useBackButtonClose } from '../hooks/useBackButtonClose' import { useBackButtonClose } from '../hooks/useBackButtonClose'
...@@ -111,10 +112,14 @@ export function CreateRoomModal({ onCreated, onClose }: CreateRoomModalProps) { ...@@ -111,10 +112,14 @@ export function CreateRoomModal({ onCreated, onClose }: CreateRoomModalProps) {
placeholder="PIN (optional)" placeholder="PIN (optional)"
inputMode="numeric" inputMode="numeric"
/> />
<label className="flex items-center gap-2 text-sm text-on-surface-variant"> <ToggleRow
<input type="checkbox" checked={tieToLocation} onChange={(e) => setTieToLocation(e.target.checked)} /> icon={MapPin}
Tie to a real-world location (lets others find it on the map) label="Tie to a real-world location"
</label> description={tieToLocation ? 'Others can find this room on the map' : 'Off - not shown on the nearby map'}
checked={tieToLocation}
saving={false}
onToggle={() => setTieToLocation((v) => !v)}
/>
{tieToLocation && ( {tieToLocation && (
<LocationPicker <LocationPicker
latitude={latitude} latitude={latitude}
......
...@@ -66,6 +66,7 @@ const BACKEND_DONE: DoneGroup[] = [ ...@@ -66,6 +66,7 @@ const BACKEND_DONE: DoneGroup[] = [
'Cross-user song streaming - a listener hears what the DJ actually picked', 'Cross-user song streaming - a listener hears what the DJ actually picked',
'Chat is DB-backed now (2026-09-13, RoomMessage table), not a 50-message in-memory deque that used to be thrown away the instant a room\'s last connection dropped - a room emptying and refilling now still has its history. New GET /social/rooms/{id}/messages?before_id=&limit= for scrollback beyond the join snapshot\'s own cap. The websocket connection-registry logic (connect/disconnect/broadcast/presence) was extracted into a generic ConnectionManager (src/services/connection_manager.py) so Direct Messages below could reuse the exact same shape instead of a second hand-rolled implementation; RoomConnectionManager now delegates to it.', 'Chat is DB-backed now (2026-09-13, RoomMessage table), not a 50-message in-memory deque that used to be thrown away the instant a room\'s last connection dropped - a room emptying and refilling now still has its history. New GET /social/rooms/{id}/messages?before_id=&limit= for scrollback beyond the join snapshot\'s own cap. The websocket connection-registry logic (connect/disconnect/broadcast/presence) was extracted into a generic ConnectionManager (src/services/connection_manager.py) so Direct Messages below could reuse the exact same shape instead of a second hand-rolled implementation; RoomConnectionManager now delegates to it.',
'Real invite code, 4-digit PIN, and location discovery (2026-10-12): rooms used to be open-join-by-id only with no geo features at all, despite that being the intended design - a 7-character unambiguous invite_code is now generated server-side on every create (GET /social/rooms/by-code/{code} looks one up), and an optional PIN (pin_hash, PBKDF2 via the same hash_password used for account passwords) gates both the new POST /social/rooms/join and - since a join-time gate is pointless if the content is reachable around it - the existing stream and websocket endpoints too. PIN guesses are rate-limited per room+user and per room+ip (AuthAttempt gained nullable room_id/user_id columns for this, a third reuse of the same table phone-codes and login brute-force already share). New PATCH /social/rooms/{id} (owner-only, pin: "" clears) and GET /social/rooms/nearby?lat=&lon=&radius_km= (haversine-filtered, sorted by distance - the haversine math itself was pulled out of soundmarks.py into a shared src/services/geo.py once a second caller needed the identical formula). Frontend: PIN input + an optional location picker on create, a join-by-code form, a PIN-entry screen that distinguishes "wrong PIN, retry" from other failures, and a "near me" map (new RoomsNearbyMap.tsx) for finding location-tied rooms visually; the invite code and PIN status are shown to the room\'s own DJ once inside, nobody else.', 'Real invite code, 4-digit PIN, and location discovery (2026-10-12): rooms used to be open-join-by-id only with no geo features at all, despite that being the intended design - a 7-character unambiguous invite_code is now generated server-side on every create (GET /social/rooms/by-code/{code} looks one up), and an optional PIN (pin_hash, PBKDF2 via the same hash_password used for account passwords) gates both the new POST /social/rooms/join and - since a join-time gate is pointless if the content is reachable around it - the existing stream and websocket endpoints too. PIN guesses are rate-limited per room+user and per room+ip (AuthAttempt gained nullable room_id/user_id columns for this, a third reuse of the same table phone-codes and login brute-force already share). New PATCH /social/rooms/{id} (owner-only, pin: "" clears) and GET /social/rooms/nearby?lat=&lon=&radius_km= (haversine-filtered, sorted by distance - the haversine math itself was pulled out of soundmarks.py into a shared src/services/geo.py once a second caller needed the identical formula). Frontend: PIN input + an optional location picker on create, a join-by-code form, a PIN-entry screen that distinguishes "wrong PIN, retry" from other failures, and a "near me" map (new RoomsNearbyMap.tsx) for finding location-tied rooms visually; the invite code and PIN status are shown to the room\'s own DJ once inside, nobody else.',
'Fixed: "Tie to a real-world location" read as a bare, unstyled browser checkbox in CreateRoomModal (2026-10-14) - a genuinely separate bug from a similarly-worded Radio one fixed the same day, easy to conflate since both features independently used the exact phrase "tie to a real-world location." Replaced with the same ToggleRow switch Radio\'s own create form now uses, for one consistent themed control across both features instead of each inventing its own.',
], ],
}, },
{ {
......
...@@ -147,7 +147,7 @@ describe('Rooms', () => { ...@@ -147,7 +147,7 @@ describe('Rooms', () => {
await screen.findByText(/No active rooms right now/) await screen.findByText(/No active rooms right now/)
await userEvent.click(screen.getByRole('button', { name: 'Create a room' })) await userEvent.click(screen.getByRole('button', { name: 'Create a room' }))
await userEvent.type(screen.getByPlaceholderText('Room name'), 'Pinned Room') await userEvent.type(screen.getByPlaceholderText('Room name'), 'Pinned Room')
await userEvent.click(screen.getByText(/Tie to a real-world location/)) await userEvent.click(screen.getByRole('switch', { name: 'Tie to a real-world location' }))
await userEvent.click(screen.getByText('Set location (mock)')) await userEvent.click(screen.getByText('Set location (mock)'))
await userEvent.click(screen.getByRole('button', { name: 'Start' })) await userEvent.click(screen.getByRole('button', { name: 'Start' }))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment