Skip to content

Commit 6938178

Browse files
NiallJoeMaherclaude
andcommitted
docs(relaunch): trim comment noise from handoff #5 + fixes
Remove redundant JSX banners, numbered group labels, and narration across the recently-changed files; keep the WHY/gotchas/security rationale. Comments only. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 79d4994 commit 6938178

8 files changed

Lines changed: 9 additions & 42 deletions

File tree

app/(app)/[username]/_sourceProfileClient.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ const SourceProfileContent = ({ sourceSlug }: Props) => {
124124

125125
return (
126126
<div className="mx-auto max-w-2xl px-4 pt-6 text-fg">
127-
{/* ── Publication header ── */}
128127
<header>
129128
<div className="flex items-start gap-4">
130129
{/* Square logo tile — the "publication, not person" signal. */}
@@ -157,7 +156,6 @@ const SourceProfileContent = ({ sourceSlug }: Props) => {
157156
</div>
158157
</div>
159158

160-
{/* Actions */}
161159
<div className="mt-5 flex flex-wrap items-center gap-3">
162160
<button
163161
type="button"
@@ -177,7 +175,6 @@ const SourceProfileContent = ({ sourceSlug }: Props) => {
177175
</button>
178176
</div>
179177

180-
{/* Tagline */}
181178
{pub.tagline && (
182179
<p className="mt-4 max-w-[60ch] leading-relaxed text-muted">
183180
{pub.tagline}
@@ -205,7 +202,6 @@ const SourceProfileContent = ({ sourceSlug }: Props) => {
205202
</div>
206203
</header>
207204

208-
{/* ── Latest articles ── */}
209205
<section className="mt-8">
210206
<p className="eyebrow mb-3">
211207
<span className="slash">{"// "}</span>latest articles

app/(app)/feed/[sourceSlug]/_client.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ const SourceProfilePage = ({ sourceSlug }: Props) => {
149149
<Heading level={1}>{`Articles (${source.articleCount})`}</Heading>
150150
</div>
151151

152-
{/* Articles list using UnifiedContentCard */}
153152
<div>
154153
{articlesStatus === "pending" ? (
155154
<div className="space-y-4">
@@ -199,7 +198,6 @@ const SourceProfilePage = ({ sourceSlug }: Props) => {
199198
);
200199
})}
201200

202-
{/* Load more trigger */}
203201
<div ref={loadMoreRef} className="py-4 text-center">
204202
{isFetchingNextPage && (
205203
<div className="text-sm text-neutral-500 dark:text-neutral-400">

components/ContentDetail/MetaHeader.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import Link from "next/link";
22
import { Temporal } from "@js-temporal/polyfill";
33

4-
// Get favicon URL from a website
54
const getFaviconUrl = (
65
websiteUrl: string | null | undefined,
76
): string | null => {
@@ -14,7 +13,6 @@ const getFaviconUrl = (
1413
}
1514
};
1615

17-
// Get hostname from URL
1816
const getHostname = (urlString: string | null | undefined): string | null => {
1917
if (!urlString) return null;
2018
try {

components/Discussion/DiscussionArea.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ const DiscussionArea = ({ contentId, noWrapper = false }: Props) => {
125125
type Discussions = typeof discussions;
126126
type Children = typeof firstChild;
127127

128-
// Sort discussions based on selected sort order
129128
const sortDiscussions = (
130129
items: Discussions | Children | undefined,
131130
): typeof items => {
@@ -135,22 +134,18 @@ const DiscussionArea = ({ contentId, noWrapper = false }: Props) => {
135134
return b.score - a.score;
136135
}
137136
if (sortOrder === "oldest") {
138-
// ascending by createdAt
139137
return (
140138
new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()
141139
);
142140
}
143-
// "new" - sort by createdAt descending
144141
return new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime();
145142
});
146143
return sorted as typeof items;
147144
};
148145

149-
// Derive initial load state from query status - data exists means loaded at least once
150146
const initiallyLoaded = discussionStatus === "success" || !!discussions;
151147

152148
const handleCreateComment = async (body: string, parentId?: string) => {
153-
// validate markdoc syntax
154149
const ast = Markdoc.parse(body);
155150
const errors = Markdoc.validate(ast, config).filter(
156151
(e) => e.error.level === "critical",
@@ -176,7 +171,6 @@ const DiscussionArea = ({ contentId, noWrapper = false }: Props) => {
176171
};
177172

178173
const handleEditComment = async (body: string, id: string) => {
179-
// validate markdoc syntax
180174
const ast = Markdoc.parse(body);
181175
const errors = Markdoc.validate(ast, config).filter(
182176
(e) => e.error.level === "critical",

components/Feed/OnboardingBanner.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,10 @@ export function OnboardingBanner() {
6161

6262
const allDone = wins ? steps.every((s) => s.done) : false;
6363

64-
// Celebration single-fire. We never want this to show twice:
65-
// - across visits: a localStorage flag (read via an external store, so it's
66-
// SSR-safe and stays in sync without setState-in-effect);
67-
// - within a session: once the user closes it, `closed` stays true.
68-
// `closed` only ever flips from the onClose event handler — never from an
69-
// effect — so there's no cascading-render loop. The effect below is a pure
70-
// external-system sync (it writes localStorage, no setState).
64+
// Celebration single-fire: a localStorage flag (read via the external store so
65+
// it's SSR-safe) guards across visits; `closed` guards within a session.
66+
// `closed` only flips from the onClose handler, never an effect — no render
67+
// loop. The effect below is a pure external-system sync (writes localStorage).
7168
const celebrated = useSyncExternalStore(
7269
subscribe,
7370
hasCelebrated,

components/Layout/TopBar.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export function TopBar({
4242

4343
return (
4444
<header className="app-topbar">
45-
{/* Left: hamburger (≤720px) + logo */}
4645
<div className="flex items-center gap-2 justify-self-start">
4746
<button
4847
type="button"
@@ -74,7 +73,6 @@ export function TopBar({
7473
</Link>
7574
</div>
7675

77-
{/* Center: search button styled like an input — opens the ⌘K palette */}
7876
<button
7977
type="button"
8078
onClick={onOpenPalette}
@@ -89,7 +87,6 @@ export function TopBar({
8987
</kbd>
9088
</button>
9189

92-
{/* Right: notifications · Create · avatar (or auth) */}
9390
{session ? (
9491
<div className="flex items-center gap-3 justify-self-end">
9592
<Link

components/RichText/RichToolbar.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ export function RichToolbar({
6969
}: RichToolbarProps) {
7070
return (
7171
<div className="flex flex-nowrap items-center gap-[2px] overflow-x-auto rounded-md border border-hairline bg-canvas px-1.5 py-1">
72-
{/* 1. Inline */}
7372
<TBtn label="Bold" onClick={() => exec("bold")} compact={compact}>
7473
<span className="font-display text-sm font-bold leading-none">B</span>
7574
</TBtn>
@@ -108,7 +107,6 @@ export function RichToolbar({
108107

109108
<Divider />
110109

111-
{/* 3. Lists */}
112110
<TBtn
113111
label="Bulleted list"
114112
onClick={() => exec("ul")}
@@ -140,7 +138,6 @@ export function RichToolbar({
140138

141139
<Divider />
142140

143-
{/* 5. Block */}
144141
<TBtn label="Quote" onClick={() => exec("quote")} compact={compact}>
145142
<Icon>
146143
<path d="M6 17h3l1.5-4V7H5v6h2.5z" />
@@ -159,7 +156,6 @@ export function RichToolbar({
159156
</Icon>
160157
</TBtn>
161158

162-
{/* 6. Spacer → Switch to Markdown */}
163159
<button
164160
type="button"
165161
onMouseDown={(e) => e.preventDefault()}

components/UnifiedContentCard/UnifiedContentCard.tsx

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ import VoteControl from "@/components/Vote/VoteControl";
1010

1111
export type ContentType = "POST" | "LINK";
1212

13-
// Display kind → chip label + tone. The card's behavior still keys off `type`
14-
// (POST vs LINK); `kind` only drives the editorial chip.
15-
// Every chip uses the SAME shape (see chip <span> below) and an opaque token
16-
// wash background so none look offset/unanchored — only the color varies by
17-
// kind. Mirrored in components/ContentDetail/TypeBadge.tsx for consistency.
13+
// Display kind → chip label + tone. Behavior keys off `type` (POST vs LINK);
14+
// `kind` only drives the editorial chip. Every chip shares the same shape + an
15+
// opaque wash so none look offset — only the color varies. Mirrored in
16+
// components/ContentDetail/TypeBadge.tsx.
1817
const KIND: Record<string, { label: string; className: string }> = {
1918
POST: { label: "Article", className: "bg-accent/15 text-accent-soft" },
2019
ARTICLE: { label: "Article", className: "bg-accent/15 text-accent-soft" },
@@ -61,7 +60,6 @@ export interface UnifiedContentCardProps {
6160
tags?: string[];
6261
}
6362

64-
// Get relative time string
6563
const getRelativeTime = (dateStr: string): string => {
6664
const now = new Date();
6765
const date = new Date(dateStr);
@@ -76,7 +74,6 @@ const getRelativeTime = (dateStr: string): string => {
7674
return date.toLocaleDateString("en-US", { month: "short", day: "numeric" });
7775
};
7876

79-
// Ensure image URL uses https
8077
const ensureHttps = (url: string | null | undefined): string | null => {
8178
if (!url) return null;
8279
if (url.startsWith("http://")) {
@@ -115,8 +112,7 @@ const UnifiedContentCard = ({
115112

116113
const imageUrl = ensureHttps(rawImageUrl);
117114

118-
// Determine the URL for the card
119-
// Priority: author (POST or user-created LINK) > source (aggregated LINK) > fallback
115+
// URL priority: author (POST or user-created LINK) > source (aggregated LINK) > fallback.
120116
const cardUrl =
121117
author?.username && slug
122118
? `/${author.username}/${slug}` // User-created content (POST or LINK)
@@ -215,11 +211,8 @@ const UnifiedContentCard = ({
215211
className="group rounded-lg border border-hairline bg-surface p-5 transition-colors duration-base ease-out hover:border-strong"
216212
data-testid="content-card"
217213
>
218-
{/* Top row: [kind chip + author + title + excerpt] · preview image
219-
(top-right, aligned with the header). */}
220214
<div className="flex gap-4">
221215
<div className="min-w-0 flex-1">
222-
{/* Header: kind chip + author + @handle · time (· via source for links) */}
223216
<div className="flex flex-wrap items-center gap-2">
224217
<span
225218
className={`inline-flex items-center whitespace-nowrap rounded-sm px-2 py-0.5 font-mono text-xs ${chip.className}`}
@@ -312,15 +305,13 @@ const UnifiedContentCard = ({
312305
)}
313306
</div>
314307

315-
{/* Footer: mono #tags + reaction bar */}
316308
<div className="mt-3 flex flex-wrap items-center gap-3">
317309
{tags && tags.length > 0 && (
318310
<span className="min-w-0 truncate font-mono text-xs text-faint">
319311
{tags.map((t) => `#${t}`).join(" ")}
320312
</span>
321313
)}
322314
<div className="ml-auto flex items-center gap-3">
323-
{/* Net-score vote pill */}
324315
<VoteControl
325316
base={
326317
votes.upvotes -

0 commit comments

Comments
 (0)