wealth/docs/pages/market/channels-username.md

45 lines
8.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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 | `noindex` (`generateMetadata`, from the URL's params only: title `@username`, description `channel:meta.description`; no read, 0070) |
| Status | `200`; another spelling of the username redirects in the stream (meta refresh) to the stored one, keeping `?code=` (0059), because `loading.tsx` wraps the page; `/@username/…` answers a real 308 from `next.config.ts` (0064); a username that can't be one renders `not-found.tsx` (`ChannelMissing`), 200; an unknown channel renders `ChannelMissing` in the browser, 200 |
| loading.tsx | `apps/{bull,bear}/src/app/(main)/channels/[username]/loading.tsx`: bull: `MobileTopBar` and `ChannelSkeleton delayed`; bear: `DeskBack` and `ChannelSkeleton delayed`. The page shows the same `ChannelSkeleton` (not delayed) until its read arrives |
| First flush | none: the server reads nothing (0070); `channelPageQuery(username)` runs in the browser |
| Canonical | none |
| H1 | the display name, in `ChannelHeader`, rendered in the browser |
| JSON-LD | none |
| Scripts | none |
## Sections
In bull's document order.
| Section | Data | HTML | JS | Index | Notes |
| -------------------------- | --------------------------------- | -------- | ----------- | ----- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| MobileTopBar (bull) | viewer | skeleton | hydrate | no | `tabOwnerId` once the channel is known: the creator on their own channel gets the tab bar |
| ChannelDeskBack (bear) | viewer | streamed | hydrate | no | «بازگشت», drawn while the channel loads; 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 | `channelPageQuery(username)` | skeleton | hydrate | no | avatar, name, `@username`, bio, markets, social links; bear: in a card |
| ↳ ChannelShare | — | skeleton | hydrate | no | the owner's share sheet opens on click |
| ↳ ChannelCounts | `channelPageQuery`, query | skeleton | hydrate | no | the follower count read with the channel, kept live in `channelKeys.followerCount`; the owner's «مشترک فعال» |
| ↳ 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 | `predictionKeys.stats(creatorId)` | skeleton | hydrate | no | `useCreatorStatsPart`, a suspense query in its own `<Suspense>` and `PartBoundary`; empty when the record isn't public |
| ChannelFeed | `postKeys.channelFeed(creatorId)` | skeleton | hydrate | no | `useChannelFeedPart`, a suspense infinite query sent with the session, in its own `<Suspense>` and `PartBoundary`; an `<a href>` per post |
| ↳ 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 |
| ChannelMissing | `channelPageQuery(username)` | none | hydrate | no | an unknown channel; its creator before approval sees their own tab (C6 ۱.۲) |
| ChannelUnavailable | `channelPageQuery(username)` | none | hydrate | no | replaces everything when the channel is suspended |
## Notes
- 0070 supersedes 0021 and 0045: the feed, the stats and the follower count are browser reads, with no server `initialData`. Mutations update them in the query cache (`replaceCachedPost`, `removeCachedPost`, `applyClosedPrediction`).
- bull: under `MobileTopBar`, a padded column; bear: one 640px column under «بازگشت», the header in a card.
- A channel under review (`verificationPending`) renders behind `PendingChannelGate`, which decides for its owner in the browser.
- bear's `@modal/channels/[username]/page.tsx` returns `null`: it empties the `@modal` slot after publishing lands here (0023).
- 0070's accepted cost: search engines get no channel content, and a shared link shows the site card with the `@username` title and description. The back end needs its own cache for these public reads before a traffic spike.