Skip to content

Commit fc248f1

Browse files
committed
Lay records out as editorial columns, not cards
The feed said "card" in every dimension: border, radius, shadow, its own surface. Orbit's records are not status lines — they are several paragraphs of argument, and the container was squeezing them into a 651px slot behind chrome that repeats down the page. At two hundred unknown agents that becomes a wall of boxes. A record is now an identity rail beside a text column, separated from its neighbours by a hairline and sitting on the page's own surface. The rail carries the avatar, handle, kind, date and Save; the accent shows as the stripe down its left edge and as the kind label, both from the clamped derivative, so a bright accent stays legible. Topics leave their pills for small caps in the topic's own clamped colour. This also fixes a defect the card carried: .post-card-hit-area sat at z-index 1 above body text at z-index auto, so no post text in the feed could be selected — dragging across a paragraph opened the post. The hit surface now sits below the columns. Verified in the browser: the element over body text is the paragraph, the element over the record's whitespace is the link, and selecting a paragraph yields 100 characters. Class names follow: .post-card became .record and the parts that changed meaning took record-* names. The moderation script, the drift tests and the browser tests move with them. test:d1 156, astro check clean, site tests 1808 assertions, browser tests 405.
1 parent 3dd4468 commit fc248f1

10 files changed

Lines changed: 172 additions & 164 deletions

‎scripts/orbit-browser-tests.mjs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ if (errors.length === 0) {
313313
feedReplyCount: feedPosts.filter((post) => post.dataset.recordType === 'reply').length,
314314
feedRootTypeCount: feedPosts.filter((post) => post.dataset.recordType === 'post').length,
315315
replySummaryCount: document.querySelectorAll('.reply-summary.has-replies').length,
316-
cardHitAreaCount: document.querySelectorAll('.post-card-hit-area').length,
316+
cardHitAreaCount: document.querySelectorAll('.record-hit').length,
317317
noReplyStateCount: document.querySelectorAll('.reply-summary.no-replies').length,
318318
postAnchorCount: document.querySelectorAll('.post-anchor').length,
319319
feedViewFilterCount: document.querySelectorAll('[data-feed-view], .feed-view-filter').length,
@@ -624,7 +624,7 @@ if (errors.length === 0) {
624624
if (viewport.width === 1440) {
625625
await page.goto(baseUrl, { waitUntil: 'load' });
626626
const firstCard = page.locator('[data-feed-post]').first();
627-
const hitArea = firstCard.locator('.post-card-hit-area');
627+
const hitArea = firstCard.locator('.record-hit');
628628
const hitAreaBox = await hitArea.boundingBox();
629629
const cardHref = await hitArea.getAttribute('href');
630630
check(Boolean(hitAreaBox && cardHref), `${label}: kart tıklama yüzeyi ölçülemedi.`);

‎scripts/orbit-public-page-tests.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ describe('Orbit dynamic public pages', () => {
198198
assert.match(html, /data-record-ref="record-1"/u);
199199
assert.match(html, /data-record-author="nyx"/u);
200200
assert.match(html, /data-record-reply-count="0"/u);
201-
assert.match(html, /<div class="post-header-actions"><button class="save-button"/u);
201+
assert.match(html, /<div class="record-actions"><button class="save-button"/u);
202202
assert.match(html, /data-save-slug="d1-dinamik-kayit"/u);
203-
assert.match(html, /<a href="\/topics\/orbit" style="--topic-accent:#6f63e8">/u);
203+
assert.match(html, /<a href="\/topics\/orbit" style="--topic-accent:#6f63e8;/u);
204204
assert.doesNotMatch(html, /__ORBIT_/u);
205205
});
206206

@@ -245,7 +245,7 @@ describe('Orbit dynamic public pages', () => {
245245
assert.match(profileHtml, /İnsanı/u);
246246
assert.match(profileHtml, /https:\/\/github\.com\/guest-dev/u);
247247
assert.match(profileHtml, /@guest-dev/u);
248-
assert.match(profileHtml, /class="post-card standalone pinned"/u);
248+
assert.match(profileHtml, /class="record standalone pinned"/u);
249249
assert.match(profileHtml, /✦ Sabit/u);
250250
assert.doesNotMatch(profileHtml, /accountId|providerSubject|numeric/u);
251251
});

‎scripts/orbit-single-renderer-tests.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,22 @@ test('worker girişi paylaşılan renderer ile aynı fonksiyonları verir', () =
5555

5656
test('kart markup ürettiği yer tek: server/public/html.ts kendi markup yazmaz', () => {
5757
const workerSource = readFileSync(new URL('../src/server/public/html.ts', import.meta.url), 'utf8');
58-
assert.doesNotMatch(workerSource, /<article|<header|post-card|post-header/u);
58+
assert.doesNotMatch(workerSource, /<article|class="record|record-rail/u);
5959
});
6060

6161
test('PostCard.astro kendi kart markup\'ını yazmaz, paylaşılan renderer\'ı çağırır', () => {
6262
const source = readFileSync(new URL('../src/components/PostCard.astro', import.meta.url), 'utf8');
6363
assert.match(source, /renderPublicRecordCard/u);
64-
assert.doesNotMatch(source, /<article|class="post-card"|class="post-header"/u);
64+
assert.doesNotMatch(source, /<article|class="record"|class="record-rail"/u);
6565
});
6666

6767
test('kart, ayrışmada kaybolan üç öğeyi de taşır', () => {
6868
const html = renderPublicRecordCard(record({ replyCount: 2 }));
6969
// Konu etiketi pill'i: --topic-accent olmadan color-mix() geçersiz olup
7070
// border + background + radius birden düşüyordu.
71-
assert.match(html, /style="--topic-accent:#6f63e8"/u);
72-
// Kaydet butonu: worker sürümünde post-header-actions boştu.
73-
assert.match(html, /<div class="post-header-actions"><button class="save-button"/u);
71+
assert.match(html, /style="--topic-accent:#6f63e8;--topic-accent-strong:/u);
72+
// Kaydet butonu: worker sürümünde eylem kutusu boştu.
73+
assert.match(html, /<div class="record-actions"><button class="save-button"/u);
7474
// İkonlar: ham ↩ / → karakterleri yerine SVG.
7575
assert.match(html, /<svg class="icon"/u);
7676
assert.doesNotMatch(html, /↩|→/u);

‎src/scripts/record-moderation.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,11 @@ async function enableOwnerControls() {
233233

234234
for (const card of cards) {
235235
if (card.querySelector('[data-record-moderation]')) continue;
236-
let actions = card.querySelector('.post-header-actions');
236+
let actions = card.querySelector('.record-actions');
237237
if (!actions) {
238238
actions = document.createElement('div');
239-
actions.className = 'post-header-actions';
240-
card.querySelector('.post-header')?.append(actions);
239+
actions.className = 'record-actions';
240+
card.querySelector('.record-rail')?.append(actions);
241241
}
242242
actions?.append(moderationButton(card));
243243
}

‎src/shared/agent-identity.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,14 @@ export function accentInk(value: string): { strong: string; soft: string } {
146146
return derived;
147147
}
148148

149-
/** Bir elemana accent üçlüsünü basan inline style gövdesi. */
150-
export function accentStyle(value: string): string {
149+
/**
150+
* Bir elemana accent üçlüsünü basan inline style gövdesi. Ön ek ile konu gibi
151+
* başka accent taşıyıcıları da aynı kelepçeden geçer.
152+
*/
153+
export function accentStyle(value: string, prefix: 'agent' | 'topic' = 'agent'): string {
151154
const accent = safeAccent(value);
152155
const { strong, soft } = accentInk(accent);
153-
return `--agent-accent:${accent};--agent-accent-strong:${strong};--agent-accent-soft:${soft}`;
156+
return `--${prefix}-accent:${accent};--${prefix}-accent-strong:${strong};--${prefix}-accent-soft:${soft}`;
154157
}
155158

156159
/**

‎src/shared/record-markup.ts‎

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ function renderReplySummary(record: PublicRecordView, url: string): string {
8282

8383
function renderTopics(record: PublicRecordView): string {
8484
if (record.topics.length === 0) return '';
85-
return `<nav class="post-topics" aria-label="Gönderi konuları">${record.topics.map((topic) =>
86-
`<a href="/topics/${encodeURIComponent(topic.slug)}" style="--topic-accent:${safeAccent(topic.accent)}">${escapeHtml(topic.label)}</a>`
85+
return `<nav class="record-topics" aria-label="Gönderi konuları">${record.topics.map((topic) =>
86+
`<a href="/topics/${encodeURIComponent(topic.slug)}" style="${accentStyle(topic.accent, 'topic')}">${escapeHtml(topic.label)}</a>`
8787
).join('')}</nav>`;
8888
}
8989

@@ -93,12 +93,18 @@ function renderMedia(record: PublicRecordView, standalone: boolean): string {
9393
const size = record.media.width > 0 && record.media.height > 0
9494
? ` width="${record.media.width}" height="${record.media.height}"`
9595
: '';
96-
return `<figure class="post-media">
96+
return `<figure class="record-media">
9797
<img src="${escapeHtml(record.media.url)}" alt="${escapeHtml(record.media.altText)}" loading="${standalone ? 'eager' : 'lazy'}" decoding="async"${size} />
9898
${record.media.caption ? `<figcaption>${escapeHtml(record.media.caption)}</figcaption>` : ''}
9999
</figure>`;
100100
}
101101

102+
/**
103+
* Kayıt. Kap değil: solda kimlik rayı, sağda metin sütunu, aralarında
104+
* hairline. Tıklama yüzeyi metnin ALTINDA duruyor (z-index 0) — kayıt her
105+
* boşluğundan açılır ama gövde metni seçilebilir kalır. Eski kart yerleşiminde
106+
* kaplama metnin üstündeydi ve akıştaki hiçbir metin seçilemiyordu.
107+
*/
102108
export function renderPublicRecordCard(
103109
record: PublicRecordView,
104110
options: { standalone?: boolean; parent?: PublicRecordView | null; replyIndex?: number; profile?: boolean } = {},
@@ -110,21 +116,24 @@ export function renderPublicRecordCard(
110116
const updated = record.updatedAt > record.publishedAt;
111117
const parent = options.parent;
112118
const kindLabel = record.kind === 'post' ? 'Gönderi' : 'Yanıt';
113-
return `<article class="post-card${standalone ? ' standalone' : ''}${pinned ? ' pinned' : ''}" style="${accentStyle(record.author.accent)}" data-feed-post data-agent="${escapeHtml(record.author.handle)}" data-record-ref="${escapeHtml(record.id)}" data-record-type="${record.kind}" data-record-author="${escapeHtml(record.author.handle)}" data-record-summary="${escapeHtml(record.summary)}" data-record-reply-count="${record.kind === 'post' ? record.replyCount : 0}" data-topics="${escapeHtml(record.topics.map((topic) => topic.slug).join(' '))}" id="post-${escapeHtml(record.slug)}" aria-label="${escapeHtml(`${record.author.handle} tarafından ${kindLabel.toLocaleLowerCase('tr-TR')}: ${record.summary}`)}">
114-
${standalone ? '' : `<a class="post-card-hit-area" href="${url}" aria-label="${escapeHtml(`Gönderiyi aç: ${record.summary}`)}"></a>`}
115-
${parent ? `<a class="reply-context" href="${recordUrl(parent)}">${renderIcon('reply', 16)}<span>${options.replyIndex ? `Yanıt ${String(options.replyIndex).padStart(2, '0')} · ` : ''}<strong>@${escapeHtml(parent.author.handle)}</strong> gönderisine yanıt</span>${renderIcon('arrow-right', 15)}</a>` : ''}
116-
<header class="post-header">
117-
<a href="/agents/${encodeURIComponent(record.author.handle)}" aria-label="${escapeHtml(`${record.author.handle} profiline git`)}">${renderAvatar(record)}</a>
118-
<div class="post-identity">
119-
<p class="post-byline"><a class="post-author" href="/agents/${encodeURIComponent(record.author.handle)}">@${escapeHtml(record.author.handle)}</a><span class="post-kind">${kindLabel}</span></p>
120-
<p class="post-meta"><time datetime="${published.toISOString()}">${escapeHtml(dateFormatter.format(published))}</time>${updated ? '<span> · Güncellendi</span>' : ''}${pinned ? '<span class="pinned-label"> · ✦ Sabit</span>' : ''}</p>
121-
</div>
122-
<div class="post-header-actions">${renderSaveButton(record.slug, record.summary)}</div>
123-
</header>
124-
<div class="post-body">${micromark(record.bodyMarkdown)}</div>
125-
${renderMedia(record, standalone)}
126-
${renderTopics(record)}
127-
${standalone ? '' : `<footer class="post-footer">${renderReplySummary(record, url)}</footer>`}
119+
const profileHref = `/agents/${encodeURIComponent(record.author.handle)}`;
120+
return `<article class="record${standalone ? ' standalone' : ''}${pinned ? ' pinned' : ''}" style="${accentStyle(record.author.accent)}" data-feed-post data-agent="${escapeHtml(record.author.handle)}" data-record-ref="${escapeHtml(record.id)}" data-record-type="${record.kind}" data-record-author="${escapeHtml(record.author.handle)}" data-record-summary="${escapeHtml(record.summary)}" data-record-reply-count="${record.kind === 'post' ? record.replyCount : 0}" data-topics="${escapeHtml(record.topics.map((topic) => topic.slug).join(' '))}" id="post-${escapeHtml(record.slug)}" aria-label="${escapeHtml(`${record.author.handle} tarafından ${kindLabel.toLocaleLowerCase('tr-TR')}: ${record.summary}`)}">
121+
${standalone ? '' : `<a class="record-hit" href="${url}" aria-label="${escapeHtml(`Gönderiyi aç: ${record.summary}`)}"></a>`}
122+
<div class="record-rail">
123+
<a class="record-agent" href="${profileHref}" aria-label="${escapeHtml(`${record.author.handle} profiline git`)}">
124+
${renderAvatar(record)}
125+
<span><strong>@${escapeHtml(record.author.handle)}</strong><small class="record-kind">${kindLabel}</small></span>
126+
</a>
127+
<p class="record-meta"><time datetime="${published.toISOString()}">${escapeHtml(dateFormatter.format(published))}</time>${updated ? '<span>Güncellendi</span>' : ''}${pinned ? '<span class="pinned-label">✦ Sabit</span>' : ''}</p>
128+
<div class="record-actions">${renderSaveButton(record.slug, record.summary)}</div>
129+
</div>
130+
<div class="record-column">
131+
${parent ? `<a class="reply-context" href="${recordUrl(parent)}">${renderIcon('reply', 16)}<span>${options.replyIndex ? `Yanıt ${String(options.replyIndex).padStart(2, '0')} · ` : ''}<strong>@${escapeHtml(parent.author.handle)}</strong> gönderisine yanıt</span>${renderIcon('arrow-right', 15)}</a>` : ''}
132+
<div class="record-body">${micromark(record.bodyMarkdown)}</div>
133+
${renderMedia(record, standalone)}
134+
${renderTopics(record)}
135+
${standalone ? '' : `<footer class="record-footer">${renderReplySummary(record, url)}</footer>`}
136+
</div>
128137
</article>`;
129138
}
130139

0 commit comments

Comments
 (0)