dorfteich/packages/shared/src/links.ts
Claude Opus 4.8 6c38abc20c
All checks were successful
CD / Build and push images (push) Successful in 3m3s
CI / Lint, typecheck, test (push) Successful in 2m15s
CI / Auth e2e pack (push) Successful in 2m49s
CI / Build container images (push) Has been skipped
CD / Deploy to Test (push) Successful in 8s
CD / Smoke tests against Test (push) Successful in 1m12s
CD / Promote to Int (push) Successful in 11s
Add backlinks panel and phantom-pages view (#48)
Make wikilink relations visible: what links here, and which linked pages
do not exist yet.

- shared: `BacklinkView` gains a plain-text `snippet` for context.
- api: `LinksService` includes a short snippet (from the content cache) with
  each backlink and phantom referrer.
- web:
  - `BacklinksPanel` below a page in read mode: a collapsible "Linked from"
    list (title + snippet, links to the source), hidden when empty. Appears
    on load from the #47 index.
  - `PhantomPagesView` in pond settings: wikilink targets that do not exist
    yet, each with its referrers and a create shortcut that makes the page
    under the phantom slug — resolving those links (#47) and navigating to it.
  - i18n `links` namespace (de + en); backlinks + missing-pages styles.
- e2e `backlinks.spec.ts` (new CI pack): a link created in the editor appears
  as a backlink on the target; the missing-pages view lists a phantom slug and
  creating it navigates to the new page.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PGdhRiwU1WRL4XxJfZYipY
2026-07-09 13:05:32 +02:00

21 lines
640 B
TypeScript

/**
* Wikilink index views shared between api and web (issue #47/#48). The index
* (`page_links`) is maintained on every content change; these are the read
* shapes for the backlinks panel and the pond's missing-pages view.
*/
/** A page that links to the page being viewed (its backlink). */
export interface BacklinkView {
pageId: string;
title: string;
slug: string;
/** A short plain-text preview of the linking page, for context (#48). */
snippet: string;
}
/** A referenced-but-missing target and the pages that link to it. */
export interface PhantomLinkView {
targetSlug: string;
referencedBy: BacklinkView[];
}