Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
7771af0
Ease structural motion and collapse it under reduced motion
ZeroElemental Oct 4, 2026
317d896
Scale the root size and add fluid gutter and section utilities
ZeroElemental Oct 4, 2026
ce28c13
Give the site header and footer fluid gutters
ZeroElemental Oct 4, 2026
f284eec
Use fluid gutters, section spacing and hero type on the site pages
ZeroElemental Oct 4, 2026
a868a44
Let the site column widen with the viewport up to 80rem
ZeroElemental Oct 4, 2026
00aafb0
Cap the message column and composer width on wide screens
ZeroElemental Oct 4, 2026
7bd2c64
Remember a clamped conversation rail width per browser
ZeroElemental Oct 4, 2026
5c2e991
Add a keyboard-accessible drag handle for the conversation rail
ZeroElemental Oct 4, 2026
23afeff
Let the conversation rail be dragged wider or narrower
ZeroElemental Oct 4, 2026
69b947f
Draw under the notch and let the keyboard resize the layout
ZeroElemental Oct 4, 2026
e7bb777
Keep site gutters, header and footer clear of the notch and home bar
ZeroElemental Oct 4, 2026
bc6e095
Pad the chat headers and composer for the notch and home bar
ZeroElemental Oct 4, 2026
f2cfa86
Slide between the conversation list and the thread on phones
ZeroElemental Oct 4, 2026
09b3e59
Start a fresh thread per conversation so drafts don't follow you
ZeroElemental Oct 4, 2026
2943d8f
Keep your place on load older and only follow new messages at the bottom
ZeroElemental Oct 4, 2026
03a830c
Ease newly arrived messages into the thread
ZeroElemental Oct 4, 2026
b47da5d
Lift conversation rows onto the pixel shadow on hover
ZeroElemental Oct 4, 2026
ca9ed32
Ease dialogs, their overlay and popovers on the shared curve
ZeroElemental Oct 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/(site)/about/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const metadata = { title: 'About · PixelChat' }
// route stays for direct links, bookmarks and anyone arriving from outside.
export default function AboutPage() {
return (
<article className="mx-auto w-full max-w-2xl space-y-6 px-4 py-16">
<article className="mx-auto w-full max-w-2xl space-y-6 gutter section-y">
<h1 className="font-display text-2xl md:text-3xl">About us</h1>
<AboutContent />
</article>
Expand Down
2 changes: 1 addition & 1 deletion src/app/(site)/download/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default async function DownloadPage() {
const signedIn = Boolean(data?.claims)

return (
<section className="flex flex-1 items-center justify-center px-4 py-16">
<section className="flex flex-1 items-center justify-center gutter section-y">
<div className="max-w-md space-y-6 text-center">
<span className="pixel-typing" aria-hidden="true">
<span />
Expand Down
2 changes: 1 addition & 1 deletion src/app/(site)/faq/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const metadata = { title: 'FAQ · PixelChat' }

export default function FaqPage() {
return (
<section className="mx-auto w-full max-w-2xl space-y-6 px-4 py-16">
<section className="mx-auto w-full max-w-2xl space-y-6 gutter section-y">
<h1 className="font-display text-2xl md:text-3xl">FAQ</h1>
<FaqContent />
</section>
Expand Down
18 changes: 9 additions & 9 deletions src/app/(site)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ export default async function Home() {

return (
<>
{/* Same section > centred max-w-5xl nesting as the two below, so every
{/* Same section > site-container nesting as the two below, so every
left edge on the page lines up. */}
<section className="px-4 py-16 md:py-24">
<div className="mx-auto grid max-w-5xl items-center gap-10 md:grid-cols-2">
<section className="gutter section-y">
<div className="site-container grid items-center gap-10 md:grid-cols-2">
<div className="space-y-6">
<h1 className="font-display text-3xl tracking-tight md:text-5xl">PixelChat</h1>
<h1 className="font-display text-[clamp(1.875rem,1rem+4vw,3rem)] tracking-tight">PixelChat</h1>
<p className="text-xl">Two people, one green screen.</p>
<p className="max-w-md text-muted-foreground">
Direct messages between friends. No threads, no channels, no bots.
Expand All @@ -53,9 +53,9 @@ export default async function Home() {

{/* The header's Features link points here, so the id has to live on this
section. scroll-mt clears the sticky header on the jump. */}
<section id="features" className="scroll-mt-20 border-t-2 px-4 py-16">
{/* max-w-5xl, like the hero, so every section shares one left edge. */}
<div className="mx-auto max-w-5xl">
<section id="features" className="scroll-mt-20 border-t-2 gutter section-y">
{/* site-container, like the hero, so every section shares one left edge. */}
<div className="site-container">
<h2 className="mb-8 font-display text-xl">Specifications</h2>
<dl>
{SPEC.map(([term, detail]) => (
Expand All @@ -70,8 +70,8 @@ export default async function Home() {
</div>
</section>

<section className="border-t-2 px-4 py-16">
<div className="mx-auto max-w-5xl space-y-6">
<section className="border-t-2 gutter section-y">
<div className="site-container space-y-6">
<h2 className="font-display text-xl">What it isn&apos;t</h2>
<ul className="space-y-3">
{LIMITS.map((limit) => (
Expand Down
2 changes: 1 addition & 1 deletion src/app/(site)/privacy/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const metadata = { title: 'Privacy · PixelChat' }

export default function PrivacyPage() {
return (
<article className="mx-auto w-full max-w-2xl space-y-6 px-4 py-16">
<article className="mx-auto w-full max-w-2xl space-y-6 gutter section-y">
<h1 className="font-display text-2xl md:text-3xl">Privacy</h1>
<p className="text-sm text-muted-foreground">
A plain-English summary of what PixelChat stores and why. It is not legal
Expand Down
2 changes: 1 addition & 1 deletion src/app/(site)/terms/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const metadata = { title: 'Terms · PixelChat' }

export default function TermsPage() {
return (
<article className="mx-auto w-full max-w-2xl space-y-6 px-4 py-16">
<article className="mx-auto w-full max-w-2xl space-y-6 gutter section-y">
<h1 className="font-display text-2xl md:text-3xl">Terms</h1>
<p className="text-sm text-muted-foreground">
A plain-English summary of the deal. It is not legal advice and it is not a
Expand Down
50 changes: 50 additions & 0 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
--shadow-pixel: 4px 4px 0 0 var(--border);
--shadow-pixel-lg: 6px 6px 0 0 var(--border);

/* Structural motion -- panes, dialogs, hovers, arriving messages -- eases.
Decorative motion (caret, typing blocks, burst) stays stepped below. These
two become the default for every transition-* utility. */
--ease-pixel: cubic-bezier(0.2, 0.8, 0.2, 1);
--default-transition-duration: 180ms;
--default-transition-timing-function: var(--ease-pixel);

--color-background: var(--background);
--color-foreground: var(--foreground);
--color-card: var(--card);
Expand Down Expand Up @@ -104,7 +111,31 @@
--dust: oklch(0.812 0.171 165 / 42%);
}

/* Fluid gutters and section rhythm: scale with the viewport instead of
jumping at breakpoints. The gutter never shrinks inside a landscape notch. */
@utility gutter {
padding-left: max(clamp(1rem, 4vw, 2.5rem), env(safe-area-inset-left));
padding-right: max(clamp(1rem, 4vw, 2.5rem), env(safe-area-inset-right));
}

/* The shared site column: 64rem until the viewport is wide enough to give it
more, capped at 80rem so lines stay readable on an ultrawide. */
@utility site-container {
margin-inline: auto;
width: 100%;
max-width: clamp(64rem, 80vw, 80rem);
}

@utility section-y {
padding-block: clamp(3rem, 8vw, 6rem);
}

@layer base {
/* 16px on phones easing to 17px by ~1050px. Expressed in rem, so a larger
browser default still scales everything. */
html {
font-size: clamp(1rem, 0.9rem + 0.25vw, 1.0625rem);
}
* {
@apply border-border outline-ring/50;
}
Expand Down Expand Up @@ -298,3 +329,22 @@
.reduce-motion .pixel-caret {
animation: none;
}

/* Transitions and enter/exit animations collapse to near-instant rather than
none: Radix waits on animationend before unmounting a closed dialog, and a
0.01ms animation still fires it. */
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
transition-duration: 0.01ms !important;
animation-duration: 0.01ms !important;
}
}

.reduce-motion *,
.reduce-motion *::before,
.reduce-motion *::after {
transition-duration: 0.01ms !important;
animation-duration: 0.01ms !important;
}
10 changes: 9 additions & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Metadata } from 'next'
import type { Metadata, Viewport } from 'next'
import { IBM_Plex_Mono, IBM_Plex_Sans, Silkscreen } from 'next/font/google'
import { ThemeProvider } from 'next-themes'
import { Toaster } from '@/components/ui/sonner'
Expand Down Expand Up @@ -32,6 +32,14 @@ export const metadata: Metadata = {
description: 'Fast, simple, real-time chat.',
}

// cover: draw under the notch and home bar, then pad back in with
// env(safe-area-inset-*). resizes-content: on Android the keyboard shrinks the
// layout viewport, so an h-dvh chat keeps its composer above the keyboard.
export const viewport: Viewport = {
viewportFit: 'cover',
interactiveWidget: 'resizes-content',
}

export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html
Expand Down
40 changes: 32 additions & 8 deletions src/components/chat/chat-shell.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
'use client'

import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react'
import { toast } from 'sonner'
import { createClient } from '@/lib/supabase/client'
import { MessageThread } from './message-thread'
import { AddFriendDialog, FriendRequests } from './friends'
import { ProfileDialog } from './profile-dialog'
import { AppMenu } from './app-menu'
import { ConversationList } from './conversation-list'
import { RailResizer } from './rail-resizer'
import { useConversationChannels, useFriendNotifications } from './use-realtime'
import { beep } from '@/lib/prefs'
import { beep, RAIL_DEFAULT, railWidth, setRailWidth } from '@/lib/prefs'
import { fetchPendingRequests } from '@/lib/queries'
import { previewOf, type Conversation, type FriendRequest, type Message } from '@/lib/types'
import { formatLatLng, usernameSchema } from '@/lib/validation'

const PAGE_SIZE = 50

// Storage is only written by this tab's own drags, so there is nothing to watch.
const noSubscribe = () => () => {}

type Props = {
me: string
username: string
Expand All @@ -40,10 +44,18 @@ export function ChatShell({

const [conversations, setConversations] = useState(initialConversations)
const [activeId, setActiveId] = useState<string | null>(null)
// Only a return from a thread slides the list in -- not the first paint.
const [cameBack, setCameBack] = useState(false)
const [messages, setMessages] = useState<Message[]>([])
const [hasMore, setHasMore] = useState(false)
const [requests, setRequests] = useState<FriendRequest[]>(initialRequests)

// Hydrates at the default so server and client markup match, then picks up
// the stored width. A drag overrides it for the rest of the session.
const storedRail = useSyncExternalStore(noSubscribe, railWidth, () => RAIL_DEFAULT)
const [draggedRail, setRail] = useState<number | null>(null)
const rail = draggedRail ?? storedRail

// Read by realtime callbacks, which would otherwise close over a stale value.
const activeIdRef = useRef<string | null>(null)
useEffect(() => {
Expand Down Expand Up @@ -296,16 +308,20 @@ export function ChatShell({
// --- render ---------------------------------------------------------------

return (
<div className="flex h-dvh bg-background text-foreground">
<div className="flex h-dvh overflow-hidden bg-background pl-[env(safe-area-inset-left)] pr-[env(safe-area-inset-right)] text-foreground">
{/* One pane at a time below md: the list, or the open thread. Side by side
from md up. A fixed 288px rail leaves no room for messages on a phone. */}
from md up, where the rail's width is the viewer's to drag. Below md
the panes slide like a native stack; overflow-hidden on the root keeps
the off-screen half from adding a horizontal scrollbar. */}
<aside
style={{ '--rail': `${rail}px` } as React.CSSProperties}
className={[
active ? 'hidden md:flex' : 'flex',
'w-full shrink-0 flex-col border-r-2 md:w-72',
].join(' ')}
cameBack && 'max-md:animate-in max-md:slide-in-from-left-1/3 max-md:fade-in-0 max-md:duration-200 ease-pixel',
'w-full shrink-0 flex-col border-r-2 md:w-(--rail)',
].filter(Boolean).join(' ')}
>
<header className="flex items-center justify-between border-b-2 px-3 py-3">
<header className="flex items-center justify-between border-b-2 px-3 pb-3 pt-[max(0.75rem,env(safe-area-inset-top))]">
<ProfileDialog
me={me}
username={profile.username}
Expand Down Expand Up @@ -338,8 +354,13 @@ export function ChatShell({
/>
</aside>

<RailResizer width={rail} onChange={setRail} onCommit={setRailWidth} />

{active ? (
<MessageThread
// A fresh thread per conversation: the draft, open dialogs and scroll
// bookkeeping belong to one chat and must not follow you to the next.
key={active.conversation_id}
me={me}
conversation={active}
messages={messages}
Expand All @@ -351,7 +372,10 @@ export function ChatShell({
onSendLocation={(lat, lng) => send(formatLatLng(lat, lng), 'location')}
onTyping={handleTyping}
onLoadOlder={loadOlder}
onBack={() => setActiveId(null)}
onBack={() => {
setActiveId(null)
setCameBack(true)
}}
/>
) : (
<section className="hidden flex-1 items-center justify-center md:flex">
Expand Down
7 changes: 4 additions & 3 deletions src/components/chat/conversation-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ export function ConversationList({
onClick={() => onSelect(conversation.conversation_id)}
aria-current={conversation.conversation_id === activeId}
className={[
'flex w-full items-center gap-3 border-2 p-2 text-left transition-colors',
// Rows lift onto the pixel shadow on hover, like the buttons do.
'flex w-full items-center gap-3 border-2 p-2 text-left transition-[color,background-color,border-color,box-shadow,translate]',
conversation.conversation_id === activeId
? 'border-border bg-muted'
: 'border-transparent hover:border-border hover:bg-muted/50',
? 'border-border bg-muted shadow-pixel-sm'
: 'border-transparent hover:-translate-y-px hover:border-border hover:bg-muted/50 hover:shadow-pixel-sm motion-reduce:hover:translate-y-0',
].join(' ')}
>
<span className="relative shrink-0">
Expand Down
Loading
Loading