29 lines
5.0 KiB
Markdown
29 lines
5.0 KiB
Markdown
# Layout: main
|
|
|
|
`apps/{bull,bear}/src/app/(main)/layout.tsx` · wraps every page in `(main)` · it reads nothing on the server, so it holds no page's first byte; `force-dynamic` (0026) · inside [layout.md](layout.md)
|
|
|
|
| Section | Data | HTML | JS | Index | Notes |
|
|
| ------------------------------------ | ------ | ----------- | ----------- | ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
| DesktopHeader (bear) | config | first flush | hydrate | no | sticky; holds the NetworkBar under it in the same sticky box |
|
|
| ↳ Brand link (bear) | viewer | first flush | hydrate | no | `useHomeHref`: `/feed` while the viewer is unknown (so in the server HTML), `/` for a guest, `homeRoute` for a member |
|
|
| ↳ Nav: خانه or کانال, داشبورد (bear) | viewer | none | hydrate | no | members only; `HeaderNavLink` is `next/link` |
|
|
| ↳ SearchField (bear) | viewer | none | hydrate | no | investors only, not on `/search`; Enter calls `router.push('/search?q=…')` |
|
|
| ↳ PublishMenu (bear) | viewer | none | hydrate | no | creators only; «پست جدید» and «پیشبینی جدید» open the `@modal` intercepts (0023) |
|
|
| ↳ SupportEntry (bear) | config | first flush | hydrate | no | the icon trigger; its `SupportDialog` popover renders only while open |
|
|
| ↳ NotificationBell (bear) | viewer | none | hydrate | no | members only; the unread count is a browser `useQuery` |
|
|
| ↳ NotificationPanel (bear) | query | none | interaction | no | the bell's side panel: `next/dynamic` with `ssr: false`, mounted on the bell's first click |
|
|
| ↳ Login button or AccountMenu (bear) | viewer | skeleton | hydrate | no | while the viewer is unknown, an invisible «ورود/ثبتنام» holds the place; a guest gets the login link, a member the account menu |
|
|
| `@modal` slot (bear) | — | none | interaction | no | `@modal/default.tsx` renders null; the `(.)compose/*` intercepts load with a soft navigation to `/compose/*`; `@modal/feed` and `@modal/channels/[username]` are null pages that empty the slot |
|
|
| BottomNav (bull) | viewer | none | hydrate | no | members only, not in a creator's preview; nothing renders until the viewer is known, and the bar is fixed, so nothing moves; a creator's middle tab is PublishMenu |
|
|
|
|
Scripts: none.
|
|
|
|
## Notes
|
|
|
|
- Each page brings its own top bar: bull's `MobileTopBar`, bear's `DeskBack`, `DesktopPageTitle` or `PageHeader`. They are rows of the page docs.
|
|
- bull and bear build separately, so a client component that one app renders never ships to the other.
|
|
- `apps/bear/src/app/(main)/default.tsx` is the `children` default: when a soft navigation lands on a `@modal` intercept with no main page under it, it reloads the URL so the full `/compose/*` page renders.
|
|
- A failed page shows `(main)/error.tsx`: `PageError` with the page's own bar (0049); bull keeps the BottomNav under it.
|
|
- Debt: the server HTML links the brand to `/feed`, a `noindex` page behind `AuthGuard`, on every main page (`platforms/market/src/app/navigation/hooks/use-home-href.ts:18`). Low priority since 0070 made every `(main)` page `noindex`. Link `/` while the viewer is unknown; `LandingRedirect` sends a member on (0027).
|
|
- Debt: the header search is not a `GET` form to `/search`, so it does nothing before hydration (`platforms/market/src/app/navigation/components/desktop-header/DesktopHeader.tsx:46`). It is member-only, so the cost is low.
|