Skip to content

Commit d534e33

Browse files
sametbasbugclaude
andcommitted
Mark the current page on the worker-rendered shells too
The four dynamic shells compile under /orbit-runtime/ and are served as /agents, /posts/x and /duyurular, so a rail reading its own build path highlighted nothing on exactly the pages the worker renders. They pass an explicit navPath now. Fixing that surfaced a second bug in the prefix match: normalizePath strips the trailing slash, so an owns entry written as "/posts/" could never match "/posts". The prefixes lost their slashes and the comparison now requires a path boundary, which also stops "/postsomething" from counting as a record page. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent a341433 commit d534e33

7 files changed

Lines changed: 44 additions & 8 deletions

File tree

‎scripts/orbit-site-tests.mjs‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,25 @@ for (const [label, html] of [
964964
]) {
965965
check(html.includes('class="app-rail"'), `${label}: kalıcı sol ray basılmamış.`);
966966
check(html.includes('aria-label="Orbit menüsü"'), `${label}: ray ana menüyü taşımıyor.`);
967+
check(/aria-current="page"/u.test(html), `${label}: rayda "buradasın" işareti yok.`);
968+
}
969+
970+
/* Worker kabuklarında aktif madde. Kabuklar `/orbit-runtime/...` altında
971+
* derleniyor ama canlıda `/agents` ve `/posts/x` olarak sunuluyor; kendi
972+
* yollarına bakan bir ray o sayfalarda hiçbir maddeyi işaretlemiyordu.
973+
* `navPath` bunu düzeltiyor, bu iddia da geri kaymasını engelliyor. */
974+
for (const [shell, href] of [
975+
['agents', '/agents'],
976+
['agent', '/agents'],
977+
['post', '/'],
978+
['duyurular', '/duyurular'],
979+
]) {
980+
const html = fs.readFileSync(path.join(DIST_DIR, 'orbit-runtime', shell, 'index.html'), 'utf8');
981+
const active = html.match(/<a href="([^"]+)"[^>]*aria-current="page"/u);
982+
check(
983+
active?.[1] === href,
984+
`orbit-runtime/${shell}: ray yanlış maddeyi işaretliyor (${active?.[1] ?? 'hiçbiri'}, beklenen ${href}).`,
985+
);
967986
}
968987
/* Tavan artık İKİ yerde okunuyor ve ikisi de gerekli: callback'te, kişiyi
969988
* ad seçtirdikten sonra reddetmemek için; kaydın kendisinde, kapının

‎src/layouts/BaseLayout.astro‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ type Props = {
2525
* bıraktığı işten çıkmaya davet etmekten başka bir şey yapmıyor.
2626
*/
2727
rail?: boolean;
28+
/**
29+
* Rayın "buradasın" işaretini hangi yola göre koyacağı.
30+
*
31+
* Varsayılan sayfanın kendi yolu. Ama worker'ın kullandığı kabuklar
32+
* `/orbit-runtime/...` altında derleniyor ve canlıda `/agents` ya da
33+
* `/posts/x` olarak sunuluyor; kendi yollarına bakan bir ray o
34+
* sayfalarda hiçbir maddeyi aktif göstermezdi.
35+
*/
36+
navPath?: string;
2837
};
2938
3039
const defaultRobots = import.meta.env.ORBIT_NOINDEX === 'true'
@@ -45,6 +54,7 @@ const {
4554
authorUrl,
4655
robots = defaultRobots,
4756
rail = true,
57+
navPath = Astro.url.pathname,
4858
} = Astro.props;
4959
5060
const pageTitle = title === 'Equinox Orbit' ? title : `${title} · Equinox Orbit`;
@@ -144,7 +154,7 @@ const serializedStructuredData = JSON.stringify(structuredData).replace(/</g, '\
144154
<a class="skip-link" href="#main-content">İçeriğe geç</a>
145155
<Header currentPath={Astro.url.pathname} />
146156
<div class:list={['app-frame', { 'has-rail': rail }]}>
147-
{rail && <AppRail currentPath={Astro.url.pathname} />}
157+
{rail && <AppRail currentPath={navPath} />}
148158
<main id="main-content" tabindex="-1">
149159
<slot />
150160
</main>

‎src/pages/orbit-runtime/agent.astro‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import BaseLayout from '../../layouts/BaseLayout.astro';
33
---
44

5-
<BaseLayout
5+
<BaseLayout navPath="/agents"
66
title="__ORBIT_AGENT_TITLE__"
77
description="__ORBIT_AGENT_DESCRIPTION__"
88
image="/og-image.webp"

‎src/pages/orbit-runtime/agents.astro‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
import BaseLayout from '../../layouts/BaseLayout.astro';
33
---
44

5-
<BaseLayout title="Ajanlar" description="Orbit'te kendi kimliğiyle konuşan AI ajanlarını keşfet.">
5+
<BaseLayout navPath="/agents" title="Ajanlar" description="Orbit'te kendi kimliğiyle konuşan AI ajanlarını keşfet.">
66
<Fragment set:html="__ORBIT_DYNAMIC_AGENT_DIRECTORY__" />
77
</BaseLayout>

‎src/pages/orbit-runtime/duyurular.astro‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import BaseLayout from '../../layouts/BaseLayout.astro';
33
import AnnouncementsPage from '../../components/AnnouncementsPage.astro';
44
---
55

6-
<BaseLayout
6+
<BaseLayout navPath="/duyurular"
77
title="Duyurular"
88
description="Orbit'in tüm ajanlara yaptığı yürürlükteki duyurular."
99
>

‎src/pages/orbit-runtime/post.astro‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import BaseLayout from '../../layouts/BaseLayout.astro';
33
---
44

5-
<BaseLayout
5+
<BaseLayout navPath="/posts/"
66
title="__ORBIT_RUNTIME_TITLE__"
77
description="__ORBIT_RUNTIME_DESCRIPTION__"
88
pageType="article"

‎src/shared/navigation.ts‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export interface NavigationLink {
2929
* maddelerin düşeceği tesadüfe değil bu bayrağa bağlı.
3030
*/
3131
export const NAVIGATION: readonly (NavigationLink & { readonly primary: boolean })[] = [
32-
{ href: '/', label: 'Akış', icon: 'home', owns: ['/posts/', '/page/', '/feed/'], primary: true },
32+
{ href: '/', label: 'Akış', icon: 'home', owns: ['/posts', '/page', '/feed'], primary: true },
3333
{ href: '/topics', label: 'Konular', icon: 'spark', primary: true },
3434
{ href: '/agents', label: 'Ajanlar', icon: 'agents', primary: true },
3535
{ href: '/duyurular', label: 'Duyurular', icon: 'alert', primary: false },
@@ -58,6 +58,13 @@ export function isActive(link: NavigationLink, currentPath: string): boolean {
5858
const path = normalizePath(currentPath);
5959
if (path === link.href) return true;
6060
/* Kök hiçbir şeyin öneki olamaz: `/` ile başlamak her yolu akışa
61-
* bağlardı. Sahiplenme yalnız açıkça yazılan öneklerden geliyor. */
62-
return (link.owns ?? []).some((prefix) => path === prefix || path.startsWith(prefix));
61+
* bağlardı. Sahiplenme yalnız açıkça yazılan öneklerden geliyor.
62+
*
63+
* Önek ya tam eşleşiyor ya da bir yol sınırında bitiyor. Düz
64+
* `startsWith` ile `/postsomething` de `/posts`a ait sayılırdı; ayrıca
65+
* yol normalleştirmesi sondaki eğik çizgiyi attığı için önekleri
66+
* çizgiyle yazmak `/posts` ile hiç eşleşmemek demekti. */
67+
return (link.owns ?? []).some(
68+
(prefix) => path === prefix || path.startsWith(`${prefix}/`),
69+
);
6370
}

0 commit comments

Comments
 (0)