5 Commits

Author SHA1 Message Date
twosugar ebc9ed3628 feat(migrate): align shell/docs with legacy, add mobile responsive & login redirect
Header is now position:fixed (like legacy) so it stays pinned during overscroll; #main-content reserves its 60px. Rebuild the mobile top nav (icon hamburger, accordion Features, overlay panel) and the docs local-nav (reveal-on-scroll bar + On this page TOC). Fixed-header/mobile fixes: 60px logo→menu gap, mobile tail alignment, footer 2-col + centered bottom bar, breadcrumb/doc-footer alignment, symmetric mobile padding. MCP page excluded from the docs sidebar (sidebar:false). Migrate the login redirect logic from the legacy AppNav: createLoginRedirectPath (/login?redirect_to=<sso?redirect_to=current>&logout=1&with-us=1), login state via window.longportInternal, and the logged-in Dashboard + avatar dropdown; UserAvatar now renders the full login block.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-28 13:40:03 +08:00
twosugar 7a3daba71c feat(migrate): sync upstream main into Astro and align footer with legacy
Content (from origin/main, 3 locales):
- add grid trading, multi-leg, CLI ai/serve, and style-guide pages (58 files)
- rename Longbridge AI -> LongbridgeAI; add multi-leg fields, remove
  contract_size, add US paper-account notes (39 files)
- sync grid trading endpoints into openapi.yaml

Components:
- footer: add AI Integrations column (MCP / ChatGPT App / Claude Connector);
  restore legacy tagline, status pill, padding, grid, heading + link styles;
  hug footer to content (drop mt-16)
- sdk-links: support grid module (GridContext, hideGo)
- raw markdown: serve EN source prefixless at /docs/<path>.md (legacy parity)

Polish:
- CliCommand terminal card with per-command doc deep-links
- resolve relative-slug URLs in sidebar / prev-next / breadcrumb
- hydrate pricing billing toggle + eyebrow badge; thin scrollbars
- global body base + site-wide antialiasing

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-27 15:56:05 +08:00
twosugar b90cbb4eb4 feat(docs): align doc detail page with legacy (footer, callout, meta, anchors, TOC, sidebar)
- Docs pages render a slim link-row footer (DocFooter) instead of the big
  marketing footer; BaseLayout gains a hideFooter prop
- Callout blocks restyled to the legacy TipContainer look (1px border, radius,
  per-type icon, accent-coloured title + body)
- Doc meta row (Markdown / Edit / Last Updated) via DocMeta; real per-page
  dates from origin/main git history (src/lib/last-updated.ts)
- Body copy: antialiased smoothing + faint rgba(0,0,0,.06) underline colour to
  match legacy .vp-doc
- Heading anchors moved to the left gutter; scroll-margin-top offsets the 61px
  sticky header on TOC/anchor jumps
- TOC pinned at its at-rest offset so it no longer jumps up on scroll
- Breadcrumb: bold current-page crumb
- Sidebar: childless category folders (e.g. cli/ipo) render as clickable bold
  headers instead of dead muted leaves

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-25 19:45:38 +08:00
twosugar fd6b5a6996 fix(migrate): restore root "Overview" sidebar entry (docs/{locale}/index.mdx)
Follow-up to the sidebar refactor. The legacy sidebar shows a top-level
"Overview" (/docs) as the first, active item — it's docs/{locale}/docs/
index.mdx (title Overview / 平台介绍 / 平台介紹, sidebar_position -999,
book_open icon). buildItems() skipped EVERY index.mdx, so that page never
appeared in the tree and /docs had no active sidebar item.

buildItems() gains an `includeIndex` param (default false). buildSidebar's
root call passes true so the root index.mdx is emitted as a top-level leaf
(link /docs, /zh-CN/docs, /zh-HK/docs via urlFromAbsPath; -999 sorts it
first). Nested index.mdx files still skip — they're absorbed as directory
links via _category_.json, unchanged.

Applies to both scopes: docs/{locale}/docs/index.mdx and the cli sidebar's
docs/{locale}/docs/cli/index.mdx (both exist in all three locales).

Verified: /docs now shows "Overview" with book-open icon + teal active
pill at the top of the first group, matching the legacy reference.
navigation.test.ts 3/3 pass (non-empty, zh-CN count == en count, position
ascending all still hold — the new node's -999 sorts first).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-24 11:14:51 +08:00
twosugar 0e2dcb4c81 refactor(migrate): extract @longbridge/openapi-utils workspace package
Sprint 2 §S5: move src/lib/{slug,region,navigation,i18n}.ts + tests
into a new bun workspace `packages/utils` published as
`@longbridge/openapi-utils`. Consumers import from the package name
instead of relative paths or `@lib/*` aliases.

Files moved (git mv preserves history):
- src/lib/slug{,.test}.ts       → packages/utils/src/
- src/lib/region{,.test}.ts     → packages/utils/src/
- src/lib/navigation{,.test}.ts → packages/utils/src/
- src/lib/i18n.ts               → packages/utils/src/

New package skeleton:
- packages/utils/package.json (private workspace, "@longbridge/openapi-utils")
- packages/utils/tsconfig.json (extends root, includes .astro types
  so `astro:content` resolves in isolated TS server)
- packages/utils/src/index.ts (barrel re-exports)

Consumer updates (22 files): shell components, layouts, [...slug]
routes on all 3 locales, llms.txt endpoints, md endpoint — all import
from `@longbridge/openapi-utils` now.

tsconfig.json — removed `@lib/*` alias (dead after the move); other
aliases (`@/*`, `@components/*`, `@styles/*`, `@data/*`) intact.

Two slug.test.ts expectations updated to reflect the T3 semantics
locked in during Sprint 1.5:
- absolute slug in `en/docs/**` → `/docs/{slug}` (was `/{slug}`)
- absolute slug in `zh-CN/docs/**` → `/zh-CN/docs/{slug}` (was `/zh-CN/{slug}`)
- new coverage: absolute slug for `en/{marketing}.mdx` still site-absolute
The test file was carrying pre-T3 expectations; §S5 is when
they had to move regardless, so the correction lands here.

Verified:
- astro check: 0 errors (81 files)
- vitest: 23/23 pass
- 8 canonical URLs: all 200
- zero residual `../lib/*` / `@lib/*` import paths anywhere in
  src/ or packages/

Known deferred:
- `packages/utils/src/i18n.ts` still reads locale data via
  `../../../src/data/locale.*` (cross-boundary). Acceptable for §S5
  scope; §S10 may relocate locale data into the utils package.

Closes Sprint 2 §S5.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-18 22:13:43 +08:00