46 lines
9.0 KiB
Markdown
46 lines
9.0 KiB
Markdown
# Channel
|
|
|
|
`/channels/[username]` · `apps/{bull,bear}/src/app/(main)/channels/[username]/page.tsx` · Type: seller · Layout: [layout-main.md](layout-main.md), [layout.md](layout.md)
|
|
|
|
| Field | Value |
|
|
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| Robots | `index; noindex when` the username is invalid, the channel is missing, or it is suspended (`generateMetadata`; `not-found.tsx` `metadata`) |
|
|
| Status | `200`; `308` when the segment isn't the stored spelling (`toChannelUsername`), keeping the query for `?code=` (0059), and from `/@username/…` (`next.config.ts` redirect, 0064); `200` with `not-found.tsx` and `noindex` when invalid or missing, because `loading.tsx` wraps the page (debt); `200` with `noindex` and `ChannelUnavailable` when suspended |
|
|
| loading.tsx | `apps/{bull,bear}/src/app/(main)/channels/[username]/loading.tsx` (debt, Notes) |
|
|
| First flush | `getChannel(username)` through `readOnServer`, which the page entry and `generateMetadata` await (0055) |
|
|
| Canonical | `/channels/username`, from `channelMetadata`; drops `?code=` and every other parameter |
|
|
| H1 | the display name, in `ChannelHeader` |
|
|
| JSON-LD | none (debt, Notes) |
|
|
| Scripts | none |
|
|
|
|
## Sections
|
|
|
|
In bull's document order.
|
|
|
|
| Section | Data | HTML | JS | Index | Notes |
|
|
| -------------------------- | ------------------------------- | ----------- | ----------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
| MobileTopBar (bull) | viewer | skeleton | hydrate | no | `tabOwnerId`: back and title wait for the viewer; the creator on their own channel gets the tab bar |
|
|
| ChannelDeskBack (bear) | viewer | first flush | hydrate | no | «بازگشت»; removed for the owner |
|
|
| ApprovedWelcome | viewer | none | hydrate | no | once, on the creator's first visit after approval; bull: sheet; bear: modal |
|
|
| ChannelHeader, with the H1 | `getChannel(username)` | first flush | none | primary | avatar, name, `@username`, bio, markets, social links; bear: in a card |
|
|
| ↳ ChannelShare | — | first flush | hydrate | no | the owner's share sheet opens on click |
|
|
| ↳ ChannelCounts | `getChannel(username)`, query | first flush | hydrate | no | follower count from the server read as `initialData`, kept live (0045); the owner's «مشترک فعال» is browser-only |
|
|
| ↳ ChannelActions | viewer | skeleton | hydrate | no | guest prompt, follow, subscribe, sale and invite notes; own `PartBoundary` |
|
|
| FollowNotice | viewer | none | hydrate | no | after the first follow |
|
|
| ChannelStats | `getPredictionStats(creatorId)` | streamed | none | secondary | own `<Suspense>` and `PartBoundary`; `CreatorStats`, empty when the record isn't public |
|
|
| ChannelFeed | `getCreatorPosts(creatorId)` | streamed | hydrate | primary | own `<Suspense>` and `PartBoundary`; an `<a href>` per post, the only links to post pages; re-read in the browser for the creator or a subscriber (0021) |
|
|
| ↳ Locked post gate | viewer | skeleton | hydrate | no | guest: login back here; investor: checkout |
|
|
| ↳ Load more | query | none | hydrate | no | a `<button>` that reads the next page |
|
|
| ↳ PostLightbox | — | none | interaction | no | `next/dynamic`, mounted on the first image tap |
|
|
|
|
## Notes
|
|
|
|
- bull: under `MobileTopBar`, a padded column; bear: one 640px column under «بازگشت», header in a card. Both hold the same primary and secondary rows.
|
|
- A channel under review (`verificationPending`) is public and indexable, but `PendingChannelGate` renders the header skeleton for every visitor until the viewer is known, so its server HTML holds no primary content.
|
|
- bear's `@modal/channels/[username]/page.tsx` returns `null`: it empties the `@modal` slot after publishing lands here (0023).
|
|
- Debt: `loading.tsx` wraps an indexable entity page: a missing channel answers 200, and past 12,800 bytes the content follows the skeleton. Delete it; the channel's links are `NavLink`s.
|
|
- Debt: `ChannelFeed` is primary but sits in `<Suspense>` (`ChannelTemplate.tsx`: bull line 110, bear line 113). Await `getCreatorPosts` in the page entry beside `getChannel`.
|
|
- Debt: older posts are reachable only through «Load more» (`ChannelFeedList.tsx:109`). Add `?page=` pagination with `<a href>` links.
|
|
- Debt: `PendingChannelGate` (`ChannelTemplate.tsx`: bull line 134, bear line 133) keeps a public channel's primary content out of the server HTML. Render the public channel on the server and swap only for the owner, or set `noindex` while pending.
|
|
- Debt: no JSON-LD; a seller-type page gets `BreadcrumbList`. The repo has no json-ld lib yet.
|