docs: rework React theming — capture harness + tutorial example#3133
Merged
docs: rework React theming — capture harness + tutorial example#3133
Conversation
- Share one retina context across captures (viewport 1280x1200 @1x) so localStorage and auth tokens persist and the message list has time to populate before each screenshot. Previous per-capture contexts raced an empty channel list on themed variants. - scrollToLatest() before every screenshot so both users' latest bubbles land in the viewport. - Explicitly create the target channel with both members + a friendly name before seeding, and truncate it so reruns don't stack duplicate messages. - waitForChatUI() now also waits for at least one rendered .str-chat__li. - Headless by default (HEADED=1 to override). - Extract the CSS override blocks to theming-variants.mjs so the harness and the doc (01-themingv2.md) stay in lockstep. - Fix ASSETS_DIR to the real docs-content tree (../../../../docs/data/docs/chat-sdk/react/v14-latest/_assets) — previous path resolved to a non-existent directory. - Drop obsolete capture flows (link-attachment text color, layout-only CSS) — neither applies to v14. - Rewrite the seed conversation: two-user dialogue with emojis, markdown (**bold**, *italic*, `code`), GitHub URL preview, images, and richer reaction variety. - Add @playwright/test as a devDep of examples/vite.
|
Size Change: 0 B Total Size: 624 kB ℹ️ View Unchanged
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3133 +/- ##
=======================================
Coverage 82.33% 82.33%
=======================================
Files 419 419
Lines 12270 12270
Branches 3951 3951
=======================================
Hits 10102 10102
Misses 2168 2168 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Align the step-by-step tutorial example with the React chat tutorial that now ships in docs-content and getstream.io-tutorials: - layout.css (steps 3-7, previously byte-identical): replace dead --brand-* palette + --radius-full with the semantic tokens v14 actually consumes (--accent-primary, --chat-bg-*, --text-link, --background-core-*, --border-utility-focused, --radius-max, --button-radius-full). - App.tsx (steps 3/4/5): rename theme='str-chat__theme-custom' → theme='custom-theme'. The str-chat__ prefix is reserved for SDK-owned classes and the SDK does no wildcard matching on str-chat__theme-*, so the prefix added nothing. Both changes mirror the companion doc-content PR (GetStream/docs-content#1213).
Mirror the pattern used by examples/vite: credentials.ts now exports apiKey, userId, userName, and a tokenProvider function that mints a fresh JWT from pronto for whichever user_id is active. The app stays runnable without pasting a token that expires, and users can switch identities at runtime via ?user_id=... / ?user_name=... URL params. - credentials.ts: drop the static userToken export; add a tokenProvider() that hits VITE_TOKEN_ENDPOINT (default https://pronto.getstream.io/api/auth/create-token) with VITE_TOKEN_ENVIRONMENT (default "demo") and the active user_id. userId/userName now derive from URL params first, then env, then sensible defaults. - All 7 step App.tsx files: rename the userToken import and tokenOrProvider arg to tokenProvider. - .env.example: drop VITE_USER_TOKEN; document the new optional VITE_TOKEN_ENDPOINT / VITE_TOKEN_ENVIRONMENT overrides and the URL-param fallbacks.
|
🎉 This PR is included in version 14.0.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two sets of changes that together bring the React SDK's theming story up to date with v14:
docs-content: chat-sdk/react/v14-latest/02-ui-components/02-theming/01-themingv2.md).examples/tutorialso its per-steplayout.css+App.tsxmatch the revised tutorial published in getstream.io-tutorials.Companion doc-content PR: GetStream/docs-content#1213 — rewrites the theming doc with working v14 tokens and regenerates every screenshot using the harness in this PR.
1. Capture-harness rework (
examples/vite/docs-playwright/)Pipeline reliability
scrollToLatest()before every screenshot so both users' latest bubbles are in frame.waitForChatUI()now also waits for at least one rendered.str-chat__libefore the capture fires.HEADED=1to override.ASSETS_DIR— previous path (../../docs/...) resolved to a non-existent directory.Content
docs-playwright/theming-variants.mjsso the harness and the doc stay in lockstep.**bold**,*italic*,`code`), GitHub URL preview, images, richer reaction variety.Deps
@playwright/test@^1.59.1as a devDep ofexamples/vite.2.
examples/tutorialsyncThe per-step tutorial example was still using tokens that have zero consumers in v14's built CSS (
--brand-50..900,--radius-full) and scoped the custom theme to.str-chat__theme-custom, which colonizes the SDK'sstr-chat__namespace for a user-defined class.layout.cssfor steps 3–7 (byte-identical before this change): replaced the dead overrides with the semantic-token block used in the published tutorial.App.tsxfor steps 3/4/5: renamedtheme='str-chat__theme-custom'→theme='custom-theme'.Test plan
Capture harness:
Output lands in
../../../../docs/data/docs/chat-sdk/react/v14-latest/_assets/. UseHEADED=1 node ...to watch the browser.Tutorial example: