Repository navigation
feat(storybook): promote the approved Gate C UI foundation #567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
913161b
3da0684
b274d9c
ba99909
20907c5
23e4f41
c58d0e3
d98b9a4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,26 @@ | ||
| import type { StorybookConfig } from '@storybook/nextjs-vite'; | ||
|
|
||
| const config: StorybookConfig = { | ||
| "stories": [ | ||
| "../src/**/*.mdx", | ||
| "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)" | ||
| stories: [ | ||
| '../src/**/*.mdx', | ||
| '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)', | ||
| ], | ||
| "addons": [ | ||
| "@chromatic-com/storybook", | ||
| "@storybook/addon-vitest", | ||
| "@storybook/addon-a11y", | ||
| "@storybook/addon-docs", | ||
| "@storybook/addon-onboarding" | ||
| addons: [ | ||
| '@storybook/addon-a11y', | ||
| '@storybook/addon-docs', | ||
| '@storybook/addon-vitest', | ||
| '@chromatic-com/storybook', | ||
| ], | ||
| "framework": "@storybook/nextjs-vite", | ||
| "staticDirs": [ | ||
| "..\\public" | ||
| ] | ||
| framework: { | ||
| name: '@storybook/nextjs-vite', | ||
| options: {}, | ||
| }, | ||
|
Comment on lines
+14
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
# Check whether the installed typings for StorybookConfig mention these options.
rg -n "autodocs|experimentalRSC" .storybook src --glob '!node_modules' || true
fd -t d -d 3 'nextjs-vite' node_modules/@storybook 2>/dev/null | head
rg -n "experimentalRSC|autodocs" node_modules/@storybook/nextjs-vite node_modules/storybook/dist 2>/dev/null | head -20Repository: DigiNodes/truthbounty-frontend Length of output: 1254 🏁 Script executed: #!/bin/bash
printf '%s\n' '--- PR diff ---'
git diff --no-ext-diff --unified=40 b390a37a5179bf27e01ae2efa16abc08535882e6 d98b9a40e773a7ab288859844ca2271e0c10bd9a -- .storybook/main.ts package.json
printf '%s\n' '--- Storybook references in manifests and lockfiles ---'
rg -n -i 'storybook|@storybook/nextjs-vite' package.json pnpm-lock.yaml yarn.lock package-lock.json bun.lockb bun.lock 2>/dev/null || test "$?" -eq 1
printf '%s\n' '--- relevant config ---'
nl -ba .storybook/main.tsRepository: DigiNodes/truthbounty-frontend Length of output: 14360 🌐 Web query:
💡 Result: 🏁 Script executed: python3 - <<'PY'
import json
import urllib.request
base = "https://api.github.com/repos/storybookjs/storybook"
headers = {"Accept": "application/vnd.github+json", "User-Agent": "read-only-review"}
def get(url):
req = urllib.request.Request(url, headers=headers)
with urllib.request.urlopen(req, timeout=20) as response:
return response.read()
tree = json.loads(get(base + "/git/trees/v10.6.0?recursive=1"))
paths = [item["path"] for item in tree.get("tree", []) if item["type"] == "blob"]
candidates = [
path for path in paths
if path.endswith((".ts", ".tsx"))
and (
("code/core/src/types/" in path and any(term in path.lower() for term in ("main", "docs", "feature")))
or ("code/frameworks/nextjs-vite/" in path and "type" in path.lower())
)
]
print("Exact tag:", tree.get("sha"))
print("Candidate type sources:", candidates)
for path in candidates:
try:
text = get("https://raw.githubusercontent.com/storybookjs/storybook/v10.6.0/" + path).decode("utf-8", "replace")
except Exception as error:
print(f"UNAVAILABLE {path}: {error}")
continue
lines = text.splitlines()
hits = [i for i, line in enumerate(lines) if "autodocs" in line or "experimentalRSC" in line]
if hits:
print(f"\n--- {path} ---")
for i in hits:
start, end = max(0, i - 5), min(len(lines), i + 7)
print("\n".join(f"{j+1}: {lines[j]}" for j in range(start, end)))
PYRepository: DigiNodes/truthbounty-frontend Length of output: 1077 🏁 Script executed: python3 - <<'PY'
import json
import urllib.request
base = "https://api.github.com/repos/storybookjs/storybook"
headers = {"Accept": "application/vnd.github+json", "User-Agent": "read-only-review"}
def get(url):
req = urllib.request.Request(url, headers=headers)
with urllib.request.urlopen(req, timeout=20) as response:
return response.read()
tree = json.loads(get(base + "/git/trees/v10.6.0?recursive=1"))
paths = [item["path"] for item in tree.get("tree", []) if item["type"] == "blob"]
print("--- core type paths ---")
type_paths = [p for p in paths if p.startswith("code/core/src/types/") and p.endswith((".ts", ".tsx"))]
print("\n".join(type_paths))
selected = set(type_paths)
selected.update(
p for p in paths
if p.startswith("code/core/src/") and p.endswith((".ts", ".tsx"))
and any(term in p.lower() for term in ("config", "preset", "main"))
)
for path in sorted(selected):
try:
text = get("https://raw.githubusercontent.com/storybookjs/storybook/v10.6.0/" + path).decode("utf-8", "replace")
except Exception as error:
print(f"UNAVAILABLE {path}: {error}")
continue
lines = text.splitlines()
hits = [i for i, line in enumerate(lines) if "autodocs" in line or "experimentalRSC" in line or "StorybookConfig" in line]
if hits:
print(f"\n--- {path} ---")
for i in hits:
start, end = max(0, i - 6), min(len(lines), i + 9)
print("\n".join(f"{j+1}: {lines[j]}" for j in range(start, end)))
PYRepository: DigiNodes/truthbounty-frontend Length of output: 42182 🏁 Script executed: python3 - <<'PY'
import json
import urllib.request
base = "https://api.github.com/repos/storybookjs/storybook"
headers = {"Accept": "application/vnd.github+json", "User-Agent": "read-only-review"}
def get(url):
req = urllib.request.Request(url, headers=headers)
with urllib.request.urlopen(req, timeout=20) as response:
return response.read()
tree = json.loads(get(base + "/git/trees/v10.6.0?recursive=1"))
paths = [item["path"] for item in tree.get("tree", []) if item["type"] == "blob" and item["path"].endswith((".ts", ".tsx"))]
selected = {
"code/core/src/types/modules/core-common.ts",
"code/core/src/types/modules/features.ts",
}
selected.update(
p for p in paths
if p.startswith("code/addons/docs/src/")
and any(term in p.lower() for term in ("type", "config", "preset", "autodoc"))
)
selected.update(
p for p in paths
if p.startswith("code/frameworks/nextjs-vite/src/")
and any(term in p.lower() for term in ("type", "preset", "config", "rsc"))
)
for path in sorted(selected):
try:
text = get("https://raw.githubusercontent.com/storybookjs/storybook/v10.6.0/" + path).decode("utf-8", "replace")
except Exception as error:
print(f"UNAVAILABLE {path}: {error}")
continue
lines = text.splitlines()
hits = [i for i, line in enumerate(lines) if "autodocs" in line or "experimentalRSC" in line or ("docs:" in line and path.endswith("core-common.ts"))]
if hits:
print(f"\n--- {path} ---")
shown = set()
for i in hits:
for j in range(max(0, i - 8), min(len(lines), i + 13)):
if j not in shown:
print(f"{j+1}: {lines[j]}")
shown.add(j)
print()
PYRepository: DigiNodes/truthbounty-frontend Length of output: 5154 🏁 Script executed: python3 - <<'PY'
import json
import urllib.request
base = "https://api.github.com/repos/storybookjs/storybook"
headers = {"Accept": "application/vnd.github+json", "User-Agent": "read-only-review"}
def get(url):
req = urllib.request.Request(url, headers=headers)
with urllib.request.urlopen(req, timeout=20) as response:
return response.read()
tree = json.loads(get(base + "/git/trees/v10.6.0?recursive=1"))
paths = [item["path"] for item in tree.get("tree", []) if item["type"] == "blob" and item["path"].endswith((".ts", ".tsx"))]
targets = [
"code/core/src/types/modules/core-common.ts",
"code/addons/docs/src/types.ts",
]
for path in targets:
text = get("https://raw.githubusercontent.com/storybookjs/storybook/v10.6.0/" + path).decode("utf-8", "replace")
lines = text.splitlines()
print(f"\n--- {path}: import/type/declaration context ---")
for i, line in enumerate(lines):
if any(term in line for term in ("StorybookConfigRaw", "DocsOptions", "docs?:", "autodocs", "interface Docs")):
start, end = max(0, i - 5), min(len(lines), i + 9)
print("\n".join(f"{j+1}: {lines[j]}" for j in range(start, end)))
print()
print("\n--- candidate v10.6.0 source files for autodocs consumers ---")
# List only likely indexing/config files so the next read can stay focused.
for p in paths:
low = p.lower()
if (p.startswith(("code/core/src/", "code/addons/docs/src/"))
and any(term in low for term in ("index", "preset", "autodoc", "config"))
and p.endswith((".ts", ".tsx"))):
print(p)
PYRepository: DigiNodes/truthbounty-frontend Length of output: 37949 🏁 Script executed: python3 - <<'PY'
import urllib.request
root = "https://raw.githubusercontent.com/storybookjs/storybook/v10.6.0/"
headers = {"User-Agent": "read-only-review"}
def read(path):
req = urllib.request.Request(root + path, headers=headers)
with urllib.request.urlopen(req, timeout=20) as response:
return response.read().decode("utf-8", "replace").splitlines()
def show(path, ranges=None, needles=()):
lines = read(path)
print(f"\n--- {path} ---")
if ranges:
for first, last in ranges:
print(f"[{first}-{last}]")
for i in range(first - 1, min(last, len(lines))):
print(f"{i+1}: {lines[i]}")
if needles:
for i, line in enumerate(lines):
if any(term in line for term in needles):
first, last = max(0, i - 4), min(len(lines), i + 7)
print(f"[match near {i+1}]")
for j in range(first, last):
print(f"{j+1}: {lines[j]}")
show("code/frameworks/nextjs-vite/src/types.ts", ranges=[(1, 120)])
show("code/frameworks/nextjs-vite/package.json", needles=('"exports"', '"types"', '"main"', '"source"'))
show("code/core/src/types/modules/core-common.ts", ranges=[(377, 388), (685, 760), (792, 846)])
PYRepository: DigiNodes/truthbounty-frontend Length of output: 12594 🏁 Script executed: python3 - <<'PY'
import urllib.request
root = "https://raw.githubusercontent.com/storybookjs/storybook/v10.6.0/"
headers = {"User-Agent": "read-only-review"}
for path in (
"code/frameworks/react-vite/src/types.ts",
"code/frameworks/react-vite/src/index.ts",
"code/core/src/types/modules/index.ts",
):
req = urllib.request.Request(root + path, headers=headers)
try:
with urllib.request.urlopen(req, timeout=20) as response:
lines = response.read().decode("utf-8", "replace").splitlines()
except Exception as error:
print(f"\nUNAVAILABLE {path}: {error}")
continue
print(f"\n--- {path} ---")
for i, line in enumerate(lines):
if any(term in line for term in ("StorybookConfig", "StorybookConfigBase", "CoreCommon_StorybookConfig", "DocsOptions", "export *")):
start, end = max(0, i - 3), min(len(lines), i + 7)
for j in range(start, end):
print(f"{j+1}: {lines[j]}")
print()
print("\n--- local project scripts and TypeScript config ---")
for path in ("package.json", "tsconfig.json"):
try:
lines = open(path, encoding="utf-8").read().splitlines()
except OSError as error:
print(f"UNAVAILABLE {path}: {error}")
continue
print(f"\n--- {path} ---")
if path == "package.json":
for i, line in enumerate(lines):
if '"scripts"' in line or '"typecheck"' in line or '"build"' in line or '"build-storybook"' in line or '"storybook"' in line:
for j in range(max(0, i-1), min(len(lines), i+15)):
print(f"{j+1}: {lines[j]}")
else:
for i, line in enumerate(lines):
if '"include"' in line or '"exclude"' in line or '"files"' in line:
for j in range(i, min(len(lines), i+15)):
print(f"{j+1}: {lines[j]}")
PYRepository: DigiNodes/truthbounty-frontend Length of output: 8154 🏁 Script executed: nl -ba tsconfig.jsonRepository: DigiNodes/truthbounty-frontend Length of output: 1631 Remove the unsupported Storybook 10.6.0 does not include 🐛 Suggested fix- docs: {
- autodocs: 'tag',
- },
features: {
experimentalRSC: true,
},🤖 Prompt for AI Agents |
||
| docs: { | ||
| autodocs: 'tag', | ||
| }, | ||
| features: { | ||
| experimentalRSC: true, | ||
| }, | ||
| }; | ||
| export default config; | ||
|
|
||
| export default config; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import { addons } from 'storybook/manager-api'; | ||
| import { themes } from 'storybook/theming'; | ||
|
|
||
| addons.setConfig({ | ||
| theme: { | ||
| ...themes.light, | ||
| brandTitle: 'TruthBounty · Gate C UI', | ||
| brandUrl: 'https://github.com/DigiNodes/truthbounty-protocol/tree/main/docs/ux-authority', | ||
| }, | ||
| }); |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,64 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { createElement } from 'react'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import type { Preview } from '@storybook/nextjs-vite'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import '../src/app/globals.css'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const preview: Preview = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| globalTypes: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| theme: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| description: 'Gate C colour scheme', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| defaultValue: 'light', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| toolbar: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| icon: 'mirror', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| items: [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { value: 'light', title: 'Light' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { value: 'dark', title: 'Dark' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+7
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: git diff --no-ext-diff --unified=80 b390a37a5179bf27e01ae2efa16abc08535882e6 d98b9a40e773a7ab288859844ca2271e0c10bd9a -- .storybook/preview.ts .storybook
printf '\n--- preview at reviewed head ---\n'
git show d98b9a40e773a7ab288859844ca2271e0c10bd9a:.storybook/preview.ts
printf '\n--- Storybook dependencies at reviewed head ---\n'
git grep -n -E '"(@storybook/[^"]+|storybook)"[[:space:]]*:' d98b9a40e773a7ab288859844ca2271e0c10bd9a -- package.json '*lock*' pnpm-workspace.yaml
printf '\n--- preview and decorator references ---\n'
git grep -n -E 'globals\.theme|context\.globals|globalTypes|initialGlobals|dynamicTitle' d98b9a40e773a7ab288859844ca2271e0c10bd9a -- .storybook src app || trueRepository: DigiNodes/truthbounty-frontend Length of output: 6128 🌐 Web query:
💡 Result: 🌐 Web query:
💡 Result: 🌐 Web query:
💡 Result: Initialize the theme global with Storybook no longer uses Suggested fix const preview: Preview = {
+ initialGlobals: { theme: 'light' },
globalTypes: {
theme: {
description: 'Gate C colour scheme',
- defaultValue: 'light',
toolbar: {
icon: 'mirror',
+ dynamicTitle: true,
items: [📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| decorators: [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (Story, context) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const theme = context.globals.theme === 'dark' ? 'dark' : 'light'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return createElement( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'div', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { className: theme, 'data-theme': theme, style: { minHeight: '100vh' } }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| createElement( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'div', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { className: 'bg-canvas text-ink min-h-screen p-6' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| createElement(Story), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| parameters: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| layout: 'padded', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| controls: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| matchers: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color: /(background|color)$/i, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| date: /Date$/i, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| a11y: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test: 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| viewport: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| options: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mobile: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: 'Mobile · 390 × 844', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| styles: { width: '390px', height: '844px' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tablet: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: 'Tablet · 768 × 1024', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| styles: { width: '768px', height: '1024px' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| desktop: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: 'Desktop · 1440 × 900', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| styles: { width: '1440px', height: '900px' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+45
to
+60
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff Add a The viewport options define the 390, 768 and 1440 widths. No story renders at a defined size by default. Reviewers must select a size by hand. The README says stories are "checked" at all three sizes. Nothing enforces this. Document the manual step in the README, or add viewport coverage in the Storybook test configuration. 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export default preview; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
Confirm the removal of
@storybook/addon-onboardingis intentional.The addon is still declared in
package.jsonat 10.6.0. After the removal it is an unused dependency. Remove it frompackage.jsonand the lockfile, or keep it registered.The lockfile is currently under repair in this PR. Resolve this in the same lockfile regeneration.
🤖 Prompt for AI Agents