Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ Content sits on the Cool Shell in a grid of panels: Feed White, 8px, hairline-bo
403, 404, 429, 500 (outside debug), and 503 render one standalone `error` page, with no app shell, for guests and signed-in users alike. A broken rail: the wordmark sits on a node in the viewer's lane (Rail Gray for guests) whose segment fades out before reaching a hollow, dangling node. Beside it, a mono git-style line (`fatal: path '/x' does not exist in 'HEAD'`), a Headline sentence saying what happened, one muted sentence saying what to do, and a single primary button ("Back to your log", "Go to the home page", or "Try again" during maintenance). A 419 is not a page: it redirects back with an error toast.

### Profile Header
A 80px avatar with a 2px lane ring offset 4px from the surface, name in Title, mono handle led by the lane dot, metadata with 16px line icons, and mono counts paired with sans labels ("3 commits", "5 following").
A 80px avatar with a 2px lane ring offset 4px from the surface, name in Title, mono handle led by the lane dot, metadata with 16px line icons, and mono counts paired with sans labels ("3 commits", "5 following"). Its actions sit top right and wrap under each other when they do not fit; a QR code button beside Share opens a small dialog with the profile URL as a QR code, always black on a white 6px-rounded panel so any camera reads it in either theme, and the URL in mono under it.

### Commit Activity
Below the profile header, scaled to how long the user has been visibly active (from their first visible commit, or account creation when there is none): the smallest window that holds all of it wins. Within the last 24 hours, a strip of 24 hourly cells labelled every six local hours in mono ("06:00"); within 7 days, a strip of 7 day cells labelled "Thu 15" (the weekday above the date below sm); within 30 days, a strip of 30 day cells labelled on Mondays ("Oct 12"); anything longer, a GitHub-style 53-week grid (Sunday-first columns, Mon/Wed/Fri row labels, month labels on month change). Strips are zoomed-in rows of the grid: equal-width cells, 40px tall (48px from sm), same gaps and rounding. Cells are 2px-rounded with 3px gaps, filled in the profile owner's lane: Muted for empty buckets, then the lane mixed into the surface at 32/56/80/100% for levels 1–4 relative to the busiest bucket. The total is mono, followed by the window ("in the last 24 hours/7 days/30 days/year"); a user with no visible commits reads "No commits yet" over an empty strip. Day cells are UTC days; hourly cells are UTC hours labelled in the viewer's local time. On narrow screens the year grid scrolls horizontally, opening on the most recent week; strips always fit.
Expand Down
3 changes: 3 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"laravel-vite-plugin": "^3.2.1",
"lucide-react": "^1.77.0",
"pusher-js": "^8.6.0",
"qrcode.react": "^4.2.0",
"react": "^19.3.1",
"react-dom": "^19.3.1",
"sonner": "^2.0.8",
Expand Down
86 changes: 86 additions & 0 deletions resources/js/components/profile-qr-button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import { QrCode } from 'lucide-react';
import { QRCodeSVG } from 'qrcode.react';
import { useState } from 'react';
import { Button } from '@/components/ui/button';
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
DialogTrigger,
} from '@/components/ui/dialog';

/**
* Shows the profile's link as a QR code, so someone nearby can open it with a phone camera.
*/
export function ProfileQrButton({
handle,
href,
}: {
handle: string;
href: string;
}) {
const [open, setOpen] = useState(false);
const [url, setUrl] = useState<string | null>(null);

// The absolute URL needs the browser's origin, so it is resolved when the dialog opens
// and kept while it closes, so the code stays put through the exit animation.
const onOpenChange = (next: boolean) => {
if (next) {
setUrl(new URL(href, window.location.origin).href);
}
setOpen(next);
};

return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogTrigger asChild>
<Button
type="button"
variant="outline"
size="icon"
aria-label={`Show a QR code for @${handle}'s profile`}
title="QR code"
data-test="profile-qr-button"
>
<QrCode />
</Button>
</DialogTrigger>
<DialogContent
className="sm:max-w-sm"
data-test="profile-qr-dialog"
>
<DialogHeader className="text-left">
<DialogTitle className="text-base font-semibold">
Scan @{handle}'s profile
</DialogTitle>
<DialogDescription>
Point a phone camera at the code to open the profile.
</DialogDescription>
</DialogHeader>
{url !== null && (
<div className="flex flex-col items-center gap-3">
{/* Always dark on white, even in dark mode, so every camera can read it. */}
<div className="rounded-md bg-white p-3">
<QRCodeSVG
value={url}
size={224}
bgColor="#ffffff"
fgColor="#000000"
title={url}
className="block size-56"
/>
</div>
<p
className="w-full min-w-0 truncate text-center font-mono text-sm text-muted-foreground"
title={url}
>
{url.replace(/^https?:\/\//, '')}
</p>
</div>
)}
</DialogContent>
</Dialog>
);
}
5 changes: 5 additions & 0 deletions resources/js/pages/organization/show.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { GitHubIcon } from '@/components/github-icon';
import { OrganizationAvatar } from '@/components/organization-avatar';
import { OrganizationFollowButton } from '@/components/organization-follow-button';
import { PageTabs } from '@/components/page-tabs';
import { ProfileQrButton } from '@/components/profile-qr-button';
import { ProfileShareButton } from '@/components/profile-share-button';
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
import { Button } from '@/components/ui/button';
Expand Down Expand Up @@ -91,6 +92,10 @@ export default function Show({
handle={organization.handle}
href={show(organization).url}
/>
<ProfileQrButton
handle={organization.handle}
href={show(organization).url}
/>
<OrganizationFollowButton
organization={organization}
isFollowing={isFollowing}
Expand Down
5 changes: 5 additions & 0 deletions resources/js/pages/profile/unclaimed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { show } from '@/actions/App/Http/Controllers/UserController';
import { BioText } from '@/components/bio-text';
import { useFollowHover } from '@/components/follow-button';
import { GitHubIcon } from '@/components/github-icon';
import { ProfileQrButton } from '@/components/profile-qr-button';
import { ProfileShareButton } from '@/components/profile-share-button';
import { Button } from '@/components/ui/button';
import { UserAvatar } from '@/components/user-avatar';
Expand Down Expand Up @@ -72,6 +73,10 @@ export default function UnclaimedProfile({
handle={profile.handle}
href={show(profile.handle).url}
/>
<ProfileQrButton
handle={profile.handle}
href={show(profile.handle).url}
/>
{auth.user === null ? (
<Button asChild>
<a href={login().url}>
Expand Down
7 changes: 6 additions & 1 deletion resources/js/pages/user/show.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { PinCommitButton } from '@/components/pin-commit-button';
import { ProfileGuilds } from '@/components/profile-guilds';
import { ProfileLiveButton } from '@/components/profile-live-button';
import { ProfilePicture } from '@/components/profile-picture';
import { ProfileQrButton } from '@/components/profile-qr-button';
import { ProfileReadme } from '@/components/profile-readme';
import { ProfileShareButton } from '@/components/profile-share-button';
import { Button } from '@/components/ui/button';
Expand Down Expand Up @@ -293,11 +294,15 @@ export default function Show({
className="size-20 shrink-0"
/>

<div className="flex shrink-0 gap-1.5 sm:gap-2">
<div className="flex min-w-0 flex-wrap justify-end gap-1.5 sm:gap-2">
<ProfileShareButton
handle={user.handle}
href={show(user).url}
/>
<ProfileQrButton
handle={user.handle}
href={show(user).url}
/>
{isCurrentUser ? (
<>
<ProfileLiveButton user={user} />
Expand Down
16 changes: 16 additions & 0 deletions tests/Unit/ProfileQrButton.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/// <reference types="node" />

import assert from 'node:assert/strict';
import { renderToString } from 'react-dom/server';
import { test } from 'vite-plus/test';
import { ProfileQrButton } from '../../resources/js/components/profile-qr-button';

test('renders the QR code button with the dialog closed', () => {
const html = renderToString(
<ProfileQrButton handle="octocat" href="/@octocat" />,
);

assert.match(html, /data-test="profile-qr-button"/);
assert.match(html, /aria-label="Show a QR code for @octocat&#x27;s profile"/);
assert.doesNotMatch(html, /data-test="profile-qr-dialog"/);
});