@vocdoni/skills 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +22 -2
- package/CHANGELOG.md +22 -0
- package/README.md +25 -0
- package/package.json +1 -1
- package/plugins/agentic-dev/.claude-plugin/plugin.json +1 -1
- package/plugins/agentic-dev/skills/subagent-driven-development/SKILL.md +10 -5
- package/plugins/agentic-dev/skills/subagent-driven-development/references/dispatch.md +20 -0
- package/plugins/agentic-dev/skills/subagent-driven-development/references/ledger.md +1 -0
- package/plugins/agentic-dev/skills/subagent-driven-development/scripts/task-brief.sh +2 -0
- package/plugins/agentic-dev/skills/subagent-driven-development/templates/plan.md +4 -0
- package/plugins/claude-pi-subagent/.claude-plugin/marketplace.json +1 -1
- package/plugins/claude-pi-subagent/plugins/pi-subagent/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-pi-subagent/plugins/pi-subagent/dist/server.mjs +18072 -3144
- package/plugins/claude-pi-subagent/plugins/pi-subagent/package-lock.json +171 -184
- package/plugins/claude-pi-subagent/plugins/pi-subagent/package.json +4 -4
- package/plugins/claude-pi-subagent/plugins/pi-subagent/src/schemas.ts +4 -0
- package/plugins/claude-pi-subagent/plugins/pi-subagent/src/server.ts +1 -1
- package/plugins/claude-pi-subagent/plugins/pi-subagent/test/schemas.test.ts +30 -0
- package/plugins/vocdoni-comments/.claude-plugin/plugin.json +21 -0
- package/plugins/vocdoni-comments/skills/comments/SKILL.md +59 -0
- package/plugins/vocdoni-comments/skills/comments/trim.md +78 -0
- package/plugins/vocdoni-ui-style/.claude-plugin/plugin.json +25 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/SKILL.md +99 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/assets/components/chakra/product.tsx +263 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/assets/components/shadcn/brand.tsx +195 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/assets/components/shadcn/button.tsx +67 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/assets/components/shadcn/status-badge.tsx +93 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/assets/logo/vocdoni-logo-ink.svg +15 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/assets/logo/vocdoni-logo-white.svg +15 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/assets/logo/vocdoni-logo.svg +15 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/assets/logo/vocdoni-mark-ink.svg +7 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/assets/logo/vocdoni-mark-white.svg +7 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/assets/logo/vocdoni-mark.svg +7 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/assets/reference/editorial-footer.webp +0 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/assets/reference/editorial-home-hero.webp +0 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/assets/reference/editorial-mobile.webp +0 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/assets/reference/editorial-stats-and-panels.webp +0 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/assets/reference/editorial-vertical-hero.webp +0 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/assets/reference/editorial-washes-and-comparison.webp +0 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/assets/reference/product-process-results.webp +0 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/assets/reference/product-signin.webp +0 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/assets/tokens/editorial.chakra.ts +285 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/assets/tokens/editorial.css +847 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/assets/tokens/editorial.tailwind.css +352 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/assets/tokens/product.chakra.ts +410 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/assets/tokens/product.css +1116 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/assets/tokens/product.tailwind.css +289 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/examples/editorial-landing.html +358 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/examples/email-vote-invitation.html +58 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/examples/product-auth.html +81 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/examples/product-builder.html +147 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/examples/product-dashboard.html +185 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/examples/product-voting.html +326 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/references/brand-core.md +166 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/references/editorial.md +198 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/references/product.md +173 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/references/recipes.md +264 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/references/stacks.md +196 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/references/ux-flows.md +110 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/scripts/check-style-fixtures/bad-editorial.tsx +15 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/scripts/check-style-fixtures/bad-product.tsx +9 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/scripts/check-style-fixtures/doc.md +10 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/scripts/check-style-fixtures/escaped.json +1 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/scripts/check-style-fixtures/good-editorial.tsx +16 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/scripts/check-style-fixtures/good-product.css +6 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/scripts/check-style-fixtures/locale.json +1 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/scripts/check-style-fixtures/multiline-attr.tsx +8 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/scripts/check-style-fixtures/multiline-copy.tsx +10 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/scripts/check-style-fixtures/regex-literal.tsx +5 -0
- package/plugins/vocdoni-ui-style/skills/vocdoni-ui-style/scripts/check-style.mjs +436 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-subagent-mcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "MCP server that lets Claude Code delegate bounded coding tasks to Pi (pi --mode rpc), with git worktree isolation and compact diff/summary results.",
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
"test:watch": "vitest"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
22
|
-
"zod": "^
|
|
21
|
+
"@modelcontextprotocol/sdk": "^1.32.0",
|
|
22
|
+
"zod": "^4.6.7"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/node": "^22.10.0",
|
|
26
26
|
"tsup": "^8.5.0",
|
|
27
27
|
"typescript": "^5.7.0",
|
|
28
|
-
"vitest": "^5.0.
|
|
28
|
+
"vitest": "^5.0.5"
|
|
29
29
|
},
|
|
30
30
|
"overrides": {
|
|
31
31
|
"esbuild": "^0.28.1"
|
|
@@ -26,13 +26,17 @@ const thinkingField = z
|
|
|
26
26
|
|
|
27
27
|
const toolsField = z
|
|
28
28
|
.array(z.enum(BUILTIN_TOOLS))
|
|
29
|
+
.max(BUILTIN_TOOLS.length)
|
|
29
30
|
.describe(
|
|
30
31
|
"Override the tool allowlist. Allowed: read, bash, edit, write, grep, find, ls. " +
|
|
31
32
|
"Omit to use the safe default for the chosen mode.",
|
|
32
33
|
);
|
|
33
34
|
|
|
35
|
+
export const MAX_FILES = 1000;
|
|
36
|
+
|
|
34
37
|
const filesField = z
|
|
35
38
|
.array(z.string())
|
|
39
|
+
.max(MAX_FILES)
|
|
36
40
|
.describe("Files Claude wants Pi to focus on (project-relative). Passed to Pi as context.");
|
|
37
41
|
|
|
38
42
|
const providerField = z.string().describe("Pi provider override (e.g. anthropic, openai, google).");
|
|
@@ -47,7 +47,7 @@ function errorResult(err: unknown): CallToolResult {
|
|
|
47
47
|
function main(): Promise<void> {
|
|
48
48
|
const config = loadConfig();
|
|
49
49
|
const manager = new PiTaskManager(config);
|
|
50
|
-
const server = new McpServer({ name: "pi-subagent", version: "0.2.
|
|
50
|
+
const server = new McpServer({ name: "pi-subagent", version: "0.2.2" });
|
|
51
51
|
|
|
52
52
|
server.registerTool(
|
|
53
53
|
"pi_list_agents",
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { MAX_FILES, startTaskShape } from "../src/schemas";
|
|
4
|
+
|
|
5
|
+
const startTask = z.object(startTaskShape);
|
|
6
|
+
|
|
7
|
+
describe("startTaskShape", () => {
|
|
8
|
+
it("accepts a small valid input", () => {
|
|
9
|
+
const result = startTask.safeParse({ task: "review", files: ["a.ts"], tools: ["read"] });
|
|
10
|
+
expect(result.success).toBe(true);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("rejects an oversized tools array with a field-level issue", () => {
|
|
14
|
+
const result = startTask.safeParse({ task: "review", tools: Array(200_000).fill("nope") });
|
|
15
|
+
expect(result.success).toBe(false);
|
|
16
|
+
expect(result.error?.issues.some((issue) => issue.path[0] === "tools")).toBe(true);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("rejects an oversized files array with a field-level issue", () => {
|
|
20
|
+
const result = startTask.safeParse({ task: "review", files: Array(200_000).fill(1) });
|
|
21
|
+
expect(result.success).toBe(false);
|
|
22
|
+
expect(result.error?.issues.some((issue) => issue.path[0] === "files")).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("accepts exactly MAX_FILES files and rejects one more", () => {
|
|
26
|
+
const atLimit = Array.from({ length: MAX_FILES }, (_, i) => `f${i}.ts`);
|
|
27
|
+
expect(startTask.safeParse({ task: "review", files: atLimit }).success).toBe(true);
|
|
28
|
+
expect(startTask.safeParse({ task: "review", files: [...atLimit, "extra.ts"] }).success).toBe(false);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vocdoni-comments",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Vocdoni's code comment rules: comments of 1-3 lines that carry the why or a constraint the code can't show, never restated code, history or measurements. Includes a trim procedure, for a branch's added comments or a whole project or folder, that shortens long blocks without losing anything only the comment said, and reports where each dropped piece still lives.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Vocdoni",
|
|
7
|
+
"url": "https://vocdoni.io"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/vocdoni/skills",
|
|
10
|
+
"repository": "https://github.com/vocdoni/skills",
|
|
11
|
+
"license": "AGPL-3.0-or-later",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"claude-code",
|
|
14
|
+
"skills",
|
|
15
|
+
"vocdoni",
|
|
16
|
+
"comments",
|
|
17
|
+
"code-comments",
|
|
18
|
+
"code-quality",
|
|
19
|
+
"code-review"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: comments
|
|
3
|
+
description: Use whenever writing, adding, editing or reviewing code comments (doc comments, inline comments, JSDoc), and when asked to trim, shorten or clean up comments, on a branch or across a whole project, package or folder. Keeps comments to 1-3 lines that carry the why, and trims existing ones without losing anything only they said.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code comments
|
|
7
|
+
|
|
8
|
+
- **Trimming comments** (`/comments trim` for a branch, `/comments trim project [path]` for the whole project or a folder, a request to trim or clean them up, or your own change adds blocks over 3 lines): follow [trim.md](trim.md).
|
|
9
|
+
- **Reviewing** someone else's comments (a PR, a diff you didn't write) is read-only: report what [trim.md](trim.md) would change, with the same report, minus the parts about edits, and edit nothing. A change you delegated counts as your own, not someone else's.
|
|
10
|
+
- **Anything else:** the rules below apply every time you write or change a comment.
|
|
11
|
+
|
|
12
|
+
## Writing comments
|
|
13
|
+
|
|
14
|
+
- **Length:** 1-3 lines per block, most of them 1-2. This includes doc comments on exported identifiers. Package overviews (Go `doc.go`, module docstrings) work as docs and aren't held to 3 lines. Usage examples belong in runnable examples (Go `Example` functions, doctests), not in the doc comment. For comment length this skill takes precedence over the longer-godoc advice in [[go-best-practices]] (its "Documentation is for users" proverb).
|
|
15
|
+
- **Content:** say the why, or a constraint the code can't show:
|
|
16
|
+
- an external API's quirk,
|
|
17
|
+
- a rate limit,
|
|
18
|
+
- an ordering requirement,
|
|
19
|
+
- an edge case handled silently,
|
|
20
|
+
- why the obvious approach doesn't work.
|
|
21
|
+
- **Don't:**
|
|
22
|
+
- restate what the code does,
|
|
23
|
+
- narrate history ("used to", "now", "before this change", the PR or issue story),
|
|
24
|
+
- record measurements,
|
|
25
|
+
- list examples where one does.
|
|
26
|
+
- **Don't repeat documented flows.** If a flow is already explained in the repo's docs (README, AGENTS.md/CLAUDE.md, skills, `docs/`) or in another comment of the same package, point to it in a few words instead of repeating it.
|
|
27
|
+
- **Claims must match the code.** A comment must not say less or more than the code does.
|
|
28
|
+
- **Style:**
|
|
29
|
+
- follow the language's doc-comment convention (Go: start with the identifier's name),
|
|
30
|
+
- match the surrounding comments' punctuation and line width,
|
|
31
|
+
- keep sentences grammatical. Don't telegraph.
|
|
32
|
+
- **Before committing:** check the diff for comment blocks over 3 lines that the change added or grew, and trim any with [trim.md](trim.md).
|
|
33
|
+
|
|
34
|
+
Example, a Go doc comment that narrates history and restates the code, trimmed to its purpose and the constraints only it states.
|
|
35
|
+
|
|
36
|
+
Before:
|
|
37
|
+
|
|
38
|
+
```go
|
|
39
|
+
// ParseBallot parses the JSON form of a ballot.
|
|
40
|
+
// It used to return nil on error. It now returns a wrapped error, so
|
|
41
|
+
// callers can match it with errors.Is.
|
|
42
|
+
// The function is pure: it reads no election state and takes no locks.
|
|
43
|
+
// The vote handler calls it while holding the election lock, so it must
|
|
44
|
+
// not block.
|
|
45
|
+
// Choice values are checked against MaxChoices later, by validateChoices
|
|
46
|
+
// in validate.go.
|
|
47
|
+
func ParseBallot(data []byte) (Ballot, error) {
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
After:
|
|
51
|
+
|
|
52
|
+
```go
|
|
53
|
+
// ParseBallot parses a ballot's JSON form. Errors are wrapped for errors.Is;
|
|
54
|
+
// choices are checked later, by validateChoices in validate.go. The vote
|
|
55
|
+
// handler calls it under the election lock, so it must not block.
|
|
56
|
+
func ParseBallot(data []byte) (Ballot, error) {
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Related:** [[go-best-practices]], [[go-code-quality]].
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Trimming comments
|
|
2
|
+
|
|
3
|
+
Comments only: never change code. What a good comment says is in [SKILL.md](SKILL.md).
|
|
4
|
+
|
|
5
|
+
## 1. Scope
|
|
6
|
+
|
|
7
|
+
Two modes:
|
|
8
|
+
- **Branch** (the default, `/comments trim`): only the comments a branch added.
|
|
9
|
+
- **Project** (`/comments trim project [path]`, or a request to trim the whole project, a package or a folder): every comment in the tracked files under `path`, or the whole repo.
|
|
10
|
+
|
|
11
|
+
A **block** is a run of consecutive comment lines.
|
|
12
|
+
|
|
13
|
+
### Branch mode
|
|
14
|
+
|
|
15
|
+
1. **Base:** the fork point, `git merge-base <ref> HEAD`, where `<ref>` is the ref you were given, or else the remote default branch (`git fetch`, then `origin/HEAD`, else `origin/main` or `origin/master`). Read `git diff <base>...HEAD`, plus uncommitted changes if the tree is dirty.
|
|
16
|
+
2. **In scope** means one of:
|
|
17
|
+
- the branch created the block, or
|
|
18
|
+
- the block existed on the base and the branch made it longer. Compare with `git show <base>:<file>`.
|
|
19
|
+
3. **Out of scope:** everything else stays exactly as it is, however long. That includes blocks the branch only edited, shortened or left at the same length.
|
|
20
|
+
|
|
21
|
+
### Project mode
|
|
22
|
+
|
|
23
|
+
1. **Files:** `git ls-files` under the path, so ignored and untracked files stay out.
|
|
24
|
+
2. **In scope:** every block over 3 lines.
|
|
25
|
+
3. **Clean tree first:** if the tree is dirty, stop and ask. The result has to be reviewable as its own diff.
|
|
26
|
+
|
|
27
|
+
### Both modes skip
|
|
28
|
+
|
|
29
|
+
- generated files: bindings, `*.pb.go`, lockfiles, vendored code,
|
|
30
|
+
- docs: README, AGENTS.md/CLAUDE.md, skills, `docs/`,
|
|
31
|
+
- comments that aren't prose: licence and copyright headers, and directives (`//go:build`, `//nolint`, `// eslint-disable`, `# type: ignore`, shebangs), which tools or the licence read verbatim.
|
|
32
|
+
|
|
33
|
+
## 2. Trim each in-scope block over 3 lines
|
|
34
|
+
|
|
35
|
+
For every piece of information you'd drop, classify it:
|
|
36
|
+
- **(a) The code says it:** names, logic or types make it obvious. Drop it.
|
|
37
|
+
- **(b) It's documented elsewhere:** in the repo's docs or another comment in the same package. Search for it and note the file and line for the report. Drop it, or leave a short pointer.
|
|
38
|
+
- The other place must survive this run: docs, or a comment you're keeping. If two in-scope comments say the same thing, don't drop it from both; keep it at the spot it concerns most.
|
|
39
|
+
- Dropping a duplicate must not lose a detail only it had. That detail is (c) at its own spot: keep it there in its 1-3 lines, rather than merging it into the surviving comment, which would only make that one long.
|
|
40
|
+
- A pointer names the file and identifier ("see `vote.go` `castBallot`"), never a line number, which goes stale.
|
|
41
|
+
- **(c) It's only here:** if it's a real constraint, a non-obvious why or a gotcha, it **must stay**.
|
|
42
|
+
- Rework the comment so it fits in 3 lines and still carries it,
|
|
43
|
+
- or move it to the line or field it concerns, still within 3 lines.
|
|
44
|
+
|
|
45
|
+
Then:
|
|
46
|
+
- **Always drop:** restated code, history and narration, measurements.
|
|
47
|
+
- **History that carries a why** ("this used to deadlock when…, so we lock first") is (c): keep the why in present tense ("locking first avoids a deadlock when…") and drop the story.
|
|
48
|
+
- **Keep the core message:** the comment still answers what a reader would ask at that spot.
|
|
49
|
+
- **Check each claim against the code:** a trimmed comment must not be narrower or broader than what the code does. For example, "an unknown X is an error" is wrong when the code also lets a no-X case through.
|
|
50
|
+
- **Package overviews** (Go `doc.go`, module docstrings) work as docs, so the 3-line limit doesn't fit them. Trim them anyway: drop restated code, history, measurements and whatever the README already says, and keep the overview a reader needs to start in that package.
|
|
51
|
+
- **Look again:** check for in-scope blocks you missed that are still over 3 lines.
|
|
52
|
+
|
|
53
|
+
## 3. Who does it
|
|
54
|
+
|
|
55
|
+
- **Use judgement:** this needs judgement on every block, so do it yourself, or delegate to a subagent on the strongest model available. This overrides any rule that sends code changes to a small worker model.
|
|
56
|
+
- **Never a small model:** don't hand it to a small, fast model. It drops constraints that were only stated in the comment.
|
|
57
|
+
- **Small worker models** never trim, with or without a commit: list the blocks over 3 lines in your report, so the agent that delegated the change trims them.
|
|
58
|
+
- **Large diffs or project mode:** split the work by package or module across several such subagents, each with its own list of files.
|
|
59
|
+
|
|
60
|
+
## 4. Verify
|
|
61
|
+
|
|
62
|
+
- **Comments only:** the diff contains no code changes beyond what the formatter does.
|
|
63
|
+
- **Formatter:** gofmt, prettier or the project's equivalent is clean on the touched files.
|
|
64
|
+
- **Checks:** build, vet or lint, and tests pass for the touched modules.
|
|
65
|
+
- **Commit:** when the trim is the task itself, don't commit and leave the result for review. When it runs as SKILL.md's pre-commit check, go on with the commit you were making. When you trim a delegated change the worker already committed, commit the trim on that branch before merging it.
|
|
66
|
+
|
|
67
|
+
## 5. Report
|
|
68
|
+
|
|
69
|
+
- **One entry per in-scope block**, a table when there are more than a few. In project mode, group the table by package:
|
|
70
|
+
- file:identifier,
|
|
71
|
+
- in scope (created, grown from N to M lines, or N lines in project mode),
|
|
72
|
+
- what was dropped,
|
|
73
|
+
- where that lives: code / file:line / doc section, or "only here: kept".
|
|
74
|
+
- **Out of scope:** blocks the branch touched but didn't add or grow, and skipped files, go in a short list with the reason, not a row each.
|
|
75
|
+
- **Restored or reworked:** the blocks restored to their original text or reworked to keep a constraint.
|
|
76
|
+
- **Leftovers:** any in-scope block still over 3 lines. There should be none; if there is one, say why.
|
|
77
|
+
- **Stale docs:** docs that pointed at a shortened comment and now read wrong. List them; don't fix docs unasked.
|
|
78
|
+
- **Verification results.**
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vocdoni-ui-style",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Build UIs with Vocdoni's look and feel and UX flows, in its two visual modes: editorial (vocdoni.io: cream surfaces, warm ink, Fraunces serif headings, green accent, yellow eyebrow dot) and product (vocdoni-app: white, Inter at light weights, monochrome or white-label accent). Ships design tokens for Tailwind v4 + shadcn/ui, Chakra UI v3 and plain CSS, React components, logo files, reference screenshots, runnable HTML examples (landing page, voting flow, dashboard, sign-in, vote builder, transactional email), worked React recipes, step-by-step UX flows for voting, vote building, onboarding and member management, specs for docs sites and result PDFs, copy rules and a brand style checker.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Vocdoni",
|
|
7
|
+
"url": "https://vocdoni.io"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/vocdoni/skills",
|
|
10
|
+
"repository": "https://github.com/vocdoni/skills",
|
|
11
|
+
"license": "AGPL-3.0-or-later",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"claude-code",
|
|
14
|
+
"skills",
|
|
15
|
+
"vocdoni",
|
|
16
|
+
"design-system",
|
|
17
|
+
"ui",
|
|
18
|
+
"ux",
|
|
19
|
+
"brand",
|
|
20
|
+
"tailwind",
|
|
21
|
+
"shadcn",
|
|
22
|
+
"chakra-ui",
|
|
23
|
+
"voting"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vocdoni-ui-style
|
|
3
|
+
description: Guides building UIs that look and behave like Vocdoni's own products, in its two visual modes - editorial (vocdoni.io marketing look - warm cream, one warm ink, Fraunces serif headings, deep green accent, yellow eyebrow dot) and product (vocdoni-app look - white, Inter at light weights, monochrome or white-label accent). Ships tokens for Tailwind v4 + shadcn/ui, Chakra UI v3 and plain CSS, React components, logos, reference screenshots, runnable HTML examples, copy rules, a style checker, and UX flows for voting (voter identification, ballot, confirmation, receipt, results), vote builders, dashboards, sign-up, member management, emails and result PDFs. Use it whenever a page, app, component, landing page, dashboard, email or document should match the Vocdoni brand, look and feel or UX, or for any voting or governance UI built by or for Vocdoni, even if the user only says "make it look like vocdoni.io", "our style" or "Vocdoni-like". Not for SDK or API usage questions (see vocdoni-sdk, davinci-sdk).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Vocdoni UI style
|
|
7
|
+
|
|
8
|
+
Vocdoni has **two visual modes on one brand**. Decide the mode before writing any markup: they share a logo, copy rules, icons and status colors, and nothing else. Mixing them (a Fraunces heading in a dashboard, a zinc card on the landing page) breaks the brand.
|
|
9
|
+
|
|
10
|
+
| Build this | Mode | Looks like |
|
|
11
|
+
| --- | --- | --- |
|
|
12
|
+
| Marketing site, landing or vertical page, launch microsite, docs portal (`editorial.md`, Docs), blog, case study, pitch page, social/OG image | **Editorial** | vocdoni.io: `assets/reference/editorial-*.webp` |
|
|
13
|
+
| Dashboard, vote builder, voting page, voter auth, results, member management, settings, pricing and checkout (they live in the app at `/plans`), admin or internal tool, embedded widget | **Product** | app.vocdoni.io: `assets/reference/product-*.webp` |
|
|
14
|
+
| Email | Product for transactional (invitations, codes, receipts), editorial for marketing | `examples/email-vote-invitation.html` |
|
|
15
|
+
| PDF / certificate / results report | Document style of the product (`product.md`, Documents) | |
|
|
16
|
+
|
|
17
|
+
When the request is ambiguous ("a page for our new feature"), ask whether it is public-persuasive (editorial) or something people operate (product).
|
|
18
|
+
|
|
19
|
+
## Editorial mode in ten rules
|
|
20
|
+
|
|
21
|
+
Full spec: `references/editorial.md`.
|
|
22
|
+
|
|
23
|
+
1. Cream surfaces `oklch(0.988 0.011 97)`; never white or gray. Alternate plain and `bg-muted` bands.
|
|
24
|
+
2. All text is one warm ink at alpha tiers: 100% headings, 64% ledes/body, 68% uppercase labels only, 10% hairlines, 7% hover fills.
|
|
25
|
+
3. Headings are Fraunces, weight 400, `font-variation-settings: 'SOFT' 100, 'WONK' 0`, tracking -0.03em, leading 1.02. Load `@fontsource-variable/fraunces/full.css` (the SOFT axis is not in `wght.css`).
|
|
26
|
+
4. Body and UI in Hanken Grotesk; card titles in the sans, 18px semibold.
|
|
27
|
+
5. Every section opens with eyebrow (10px yellow dot + uppercase label) then serif heading then muted lede capped at `max-w-2xl`. The yellow appears nowhere else.
|
|
28
|
+
6. One dark ink CTA per view (navbar "Sign in", hero "Start for free"); green (`--primary` #296948) for in-page CTAs, links and icons.
|
|
29
|
+
7. Cards and panels: 20px radius, 1px ink-10% border, `shadow-sm` only when raised on a tinted band.
|
|
30
|
+
8. Section padding 32/64/96px, container `max-w-7xl`, generous whitespace; hero headline sized by container query to land on three lines.
|
|
31
|
+
9. Show real product states (eligibility chips, participation bars, verified results), not decorative illustration; code in dark terminal blocks.
|
|
32
|
+
10. Motion is soft and scoped: in-view fade/slide, press to 0.96, card lift 4px, never `transition-all`, all off under reduced motion.
|
|
33
|
+
|
|
34
|
+
## Product mode in ten rules
|
|
35
|
+
|
|
36
|
+
Full spec: `references/product.md`.
|
|
37
|
+
|
|
38
|
+
1. White page, zinc neutrals (`#09090b` text, `#52525b` muted, `#e4e4e7` borders, `#f5f5f5` muted fills); dark mode near-black `#0a0a0a`.
|
|
39
|
+
2. Inter only. Headings and buttons weight 400, labels 300; 600 only for ballot question/choice labels and dialog titles. Hierarchy by size.
|
|
40
|
+
3. Monochrome accent `#18181b` on Vocdoni's own surfaces; an organization's color replaces it everywhere via one value (`createVocdoniProductSystem(color)` or `data-brand` + `--brand`). Surfaces are never tinted.
|
|
41
|
+
4. Controls 40px tall, 6px radius; cards, boxes and dialogs 8px radius, flat with a 1px border.
|
|
42
|
+
5. Status is a subtle badge with text: upcoming yellow, ongoing green, paused orange, ended gray, results available teal, canceled red; results disclosure beside it: live blue, hidden until the end purple, awaiting orange.
|
|
43
|
+
6. Dashboard: 255px sidebar (`#fbfbfb`) with "+ New vote" first, grouped nav, account card at the bottom; page = 24px heading + muted subtitle + gray pill tab rail + bordered boxes.
|
|
44
|
+
7. Tables become cards below 768px; sidebars become drawers.
|
|
45
|
+
8. Dialogs for decisions (ghost Cancel left, confirm right, red when destructive), end drawers for entity forms, bottom-center toasts for acknowledgments.
|
|
46
|
+
9. Auth: split card, form left, dark testimonial showcase right (hidden on mobile), customer logo tiles below.
|
|
47
|
+
10. Inputs are 16px on mobile (iOS zoom), 14px from `md`; every icon button has an `aria-label`.
|
|
48
|
+
|
|
49
|
+
## Always, in both modes
|
|
50
|
+
|
|
51
|
+
- **Sentence case** for every heading, button, tab, menu item and dialog title. Proper nouns, acronyms and "Vocdoni" keep capitals.
|
|
52
|
+
- **No em or en dashes** in copy. Use " - ", a colon, or two sentences.
|
|
53
|
+
- Plain, calm, concrete voice. Explain consequences before irreversible actions; reassure with facts ("Nobody, not even the organization, can see who voted what."), never hype. Details and the domain glossary: `references/brand-core.md`.
|
|
54
|
+
- Lucide icons (16px inline, 20px in feature tiles), `currentColor`.
|
|
55
|
+
- All copy through i18n with English defaults; layouts tolerate 40% longer strings.
|
|
56
|
+
- Visible 2px focus ring, AA contrast, reduced motion respected, ballots and member data marked `ph-no-capture`.
|
|
57
|
+
- Logo from `assets/logo/` (inline SVG, `currentColor`): ink on cream, black/white in product; never recolored or redrawn.
|
|
58
|
+
|
|
59
|
+
## UX flows
|
|
60
|
+
|
|
61
|
+
Voting, onboarding, building and running a vote, census and member import, plan gating: `references/ux-flows.md`. The non-negotiables:
|
|
62
|
+
|
|
63
|
+
- Voters never create accounts: open link, **Identify** (census fields, optional 6-digit code), choose, **Vote**, confirm the summary, wait on a blocking "processing" dialog, receive a verifiable receipt.
|
|
64
|
+
- The election builder is one document-style page with a settings side panel, not a wizard; drafts auto-save and leaving asks.
|
|
65
|
+
- Disabled controls always say why; destructive actions name the object and the consequence.
|
|
66
|
+
|
|
67
|
+
## Workflow
|
|
68
|
+
|
|
69
|
+
1. Pick the mode (table above) and read its reference plus `references/brand-core.md`.
|
|
70
|
+
2. Wire the stack with `references/stacks.md`: copy the token file and components for Tailwind v4 + shadcn, Chakra UI v3, or plain CSS. Load the right fonts.
|
|
71
|
+
3. In React, follow `references/recipes.md` (a Chakra admin page and a Tailwind/shadcn vertical page, both compiling and passing the checker). Otherwise start from the closest HTML example and adapt it rather than composing from scratch:
|
|
72
|
+
- `examples/editorial-landing.html`: navbar, hero, trust band, panels, product washes, comparison, FAQ, footer
|
|
73
|
+
- `examples/product-voting.html`: full voter flow, interactive (`?brand=%231a73e8` for white-label, moon button for dark)
|
|
74
|
+
- `examples/product-dashboard.html`: sidebar shell, tab rail, process table, mobile cards, destructive confirm
|
|
75
|
+
- `examples/product-auth.html`: split sign-in with showcase and trust bar
|
|
76
|
+
- `examples/product-builder.html`: document-style vote builder with every form control in the settings panel
|
|
77
|
+
- `examples/email-vote-invitation.html`: transactional email (table layout, inline styles)
|
|
78
|
+
4. Write copy last, against the rules above.
|
|
79
|
+
5. Verify: render at 1440px and 390px and compare with `assets/reference/`; run `node scripts/check-style.mjs --mode <editorial|product> <paths>` (add `--ignore '<glob>'`, relative to the working directory, for vendored code) and fix errors; warnings are prompts to look.
|
|
80
|
+
|
|
81
|
+
## Files
|
|
82
|
+
|
|
83
|
+
| Path | What |
|
|
84
|
+
| --- | --- |
|
|
85
|
+
| `references/brand-core.md` | Logo, voice, microcopy, vocabulary, status mapping, icons, a11y, i18n, imagery |
|
|
86
|
+
| `references/editorial.md` | Editorial tokens, type scale, layout, every component and page pattern |
|
|
87
|
+
| `references/product.md` | Product tokens, white-label math, type, layouts, components |
|
|
88
|
+
| `references/ux-flows.md` | Step-by-step flows and cross-cutting interaction rules |
|
|
89
|
+
| `references/recipes.md` | Worked compositions per mode in React (Chakra v3, Tailwind + shadcn), class translation table, common first-draft fixes |
|
|
90
|
+
| `references/stacks.md` | Setup for Tailwind/shadcn, Next.js fonts, Chakra, plain CSS (with class inventory), mixed codebases, email, favicon, OG images, print |
|
|
91
|
+
| `assets/tokens/editorial.{tailwind.css,css,chakra.ts}` | Editorial tokens per stack |
|
|
92
|
+
| `assets/tokens/product.{tailwind.css,css,chakra.ts}` | Product tokens per stack (Chakra file includes the palette generator) |
|
|
93
|
+
| `assets/components/shadcn/` | `button.tsx`, `brand.tsx` (Section, Container, Eyebrow, SectionHeader, Panel, IconTile, Badge, VocdoniLogo), `status-badge.tsx` (StatusBadge, ResultsTag, Tag) |
|
|
94
|
+
| `assets/components/chakra/product.tsx` | PageHeader, DashboardBox, DashboardSection, NavItem, DataListCard, StatusBadge, ResultsTag, ResultBar, SecurityLevel, ConfirmDialog (no custom variants, so no typegen needed) |
|
|
95
|
+
| `assets/logo/` | Full lockup and mark, `currentColor` / ink / white |
|
|
96
|
+
| `assets/reference/` | Screenshots of vocdoni.io and app.vocdoni.io |
|
|
97
|
+
| `scripts/check-style.mjs` | Brand linter (copy, tokens, weights, fonts); `--self-test` runs its fixtures |
|
|
98
|
+
|
|
99
|
+
Related skills: [[vocdoni-integrator-sdk]] (the React voting components and API behind product UIs), [[vocdoni-sdk]], [[davinci-sdk]].
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Product-mode building blocks for Chakra UI v3, distilled from vocdoni-app.
|
|
3
|
+
* Use with createVocdoniProductSystem() from assets/tokens/product.chakra.ts.
|
|
4
|
+
*
|
|
5
|
+
* <PageHeader title='Voting processes' subtitle='All the votes of your organization'
|
|
6
|
+
* actions={<Button size='sm'><LuPlus /> New vote</Button>} />
|
|
7
|
+
* <DashboardBox>...</DashboardBox>
|
|
8
|
+
* <StatusBadge status='ongoing' /> <ResultsTag state='secret' />
|
|
9
|
+
* <NavItem icon={LuVote} href='/admin/processes' current>Voting processes</NavItem>
|
|
10
|
+
* <DataListCard title={<Link href='#'>General assembly</Link>} menu={<Kebab />}>...</DataListCard>
|
|
11
|
+
* <ResultBar label='Option A' votes={425} percent={59.8} />
|
|
12
|
+
* <SecurityLevel level='strong' />
|
|
13
|
+
* <ConfirmDialog open={open} onOpenChange={setOpen} title='End vote'
|
|
14
|
+
* description='Ending "General assembly 2026" is irreversible. Voters will no longer be able to vote.'
|
|
15
|
+
* confirmLabel='End vote' destructive onConfirm={endVote} />
|
|
16
|
+
*/
|
|
17
|
+
import {
|
|
18
|
+
Badge,
|
|
19
|
+
Box,
|
|
20
|
+
type BoxProps,
|
|
21
|
+
Button,
|
|
22
|
+
Card,
|
|
23
|
+
Dialog,
|
|
24
|
+
Flex,
|
|
25
|
+
Heading,
|
|
26
|
+
Icon,
|
|
27
|
+
Portal,
|
|
28
|
+
Progress,
|
|
29
|
+
SimpleGrid,
|
|
30
|
+
Stack,
|
|
31
|
+
Text,
|
|
32
|
+
useRecipe,
|
|
33
|
+
} from '@chakra-ui/react'
|
|
34
|
+
import type { ElementType, ReactNode } from 'react'
|
|
35
|
+
|
|
36
|
+
/* Everything here avoids custom variant names, so it typechecks without
|
|
37
|
+
running Chakra typegen. */
|
|
38
|
+
|
|
39
|
+
/* ---------- Page header ---------- */
|
|
40
|
+
|
|
41
|
+
export function PageHeader({ title, subtitle, actions }: { title: ReactNode; subtitle?: ReactNode; actions?: ReactNode }) {
|
|
42
|
+
return (
|
|
43
|
+
<Flex align='flex-start' justify='space-between' gap={4} wrap='wrap' mb={6}>
|
|
44
|
+
<Box>
|
|
45
|
+
<Heading as='h1' size='2xl' display='flex' alignItems='center' gap={2}>
|
|
46
|
+
{title}
|
|
47
|
+
</Heading>
|
|
48
|
+
{subtitle && (
|
|
49
|
+
<Text fontSize='md' color='fg.muted' mt={1}>
|
|
50
|
+
{subtitle}
|
|
51
|
+
</Text>
|
|
52
|
+
)}
|
|
53
|
+
</Box>
|
|
54
|
+
{actions && (
|
|
55
|
+
<Flex gap={2} align='center'>
|
|
56
|
+
{actions}
|
|
57
|
+
</Flex>
|
|
58
|
+
)}
|
|
59
|
+
</Flex>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Bordered container for a page section (radius md, p=4). */
|
|
64
|
+
export const DashboardBox = (props: BoxProps) => (
|
|
65
|
+
<Box borderWidth='1px' borderColor='border' borderRadius='md' p={4} {...props} />
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
/** Subtle filled panel for grouped settings or summaries. */
|
|
69
|
+
export const DashboardSection = (props: BoxProps) => <Box bg='bg.muted' borderRadius='md' p={4} {...props} />
|
|
70
|
+
|
|
71
|
+
/* ---------- Status ---------- */
|
|
72
|
+
|
|
73
|
+
export type ElectionStatus = 'upcoming' | 'ongoing' | 'paused' | 'ended' | 'results' | 'canceled'
|
|
74
|
+
|
|
75
|
+
// The skill's normalized mapping (see references/brand-core.md, Status semantics).
|
|
76
|
+
const STATUS: Record<ElectionStatus, { palette: string; label: string }> = {
|
|
77
|
+
upcoming: { palette: 'yellow', label: 'Upcoming' },
|
|
78
|
+
ongoing: { palette: 'green', label: 'Ongoing' },
|
|
79
|
+
paused: { palette: 'orange', label: 'Paused' },
|
|
80
|
+
ended: { palette: 'gray', label: 'Ended' },
|
|
81
|
+
results: { palette: 'teal', label: 'Results available' },
|
|
82
|
+
canceled: { palette: 'red', label: 'Canceled' },
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function StatusBadge({ status, label }: { status: ElectionStatus; label?: string }) {
|
|
86
|
+
const s = STATUS[status]
|
|
87
|
+
return (
|
|
88
|
+
<Badge colorPalette={s.palette} variant='subtle'>
|
|
89
|
+
{label ?? s.label}
|
|
90
|
+
</Badge>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export type ResultsState = 'live' | 'secret' | 'awaiting' | 'available'
|
|
95
|
+
|
|
96
|
+
const RESULTS: Record<ResultsState, { palette: string; label: string }> = {
|
|
97
|
+
live: { palette: 'blue', label: 'Live results' },
|
|
98
|
+
secret: { palette: 'purple', label: 'Hidden until the end' },
|
|
99
|
+
awaiting: { palette: 'orange', label: 'Awaiting results' },
|
|
100
|
+
available: { palette: 'teal', label: 'Results available' },
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** Results disclosure, beside the status. Omit it when the status already says "Results available". */
|
|
104
|
+
export function ResultsTag({ state, label }: { state: ResultsState; label?: string }) {
|
|
105
|
+
const r = RESULTS[state]
|
|
106
|
+
return (
|
|
107
|
+
<Badge colorPalette={r.palette} variant='subtle'>
|
|
108
|
+
{label ?? r.label}
|
|
109
|
+
</Badge>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* ---------- Navigation ---------- */
|
|
114
|
+
|
|
115
|
+
/** Sidebar item: 32px, 16px icon + 14px label, hover bg.muted, current = palette 200. */
|
|
116
|
+
export function NavItem({
|
|
117
|
+
icon,
|
|
118
|
+
href,
|
|
119
|
+
current,
|
|
120
|
+
children,
|
|
121
|
+
}: {
|
|
122
|
+
icon: ElementType
|
|
123
|
+
href: string
|
|
124
|
+
current?: boolean
|
|
125
|
+
children: ReactNode
|
|
126
|
+
}) {
|
|
127
|
+
return (
|
|
128
|
+
<Button
|
|
129
|
+
asChild
|
|
130
|
+
size='xs'
|
|
131
|
+
w='full'
|
|
132
|
+
justifyContent='flex-start'
|
|
133
|
+
gap={2}
|
|
134
|
+
variant='ghost'
|
|
135
|
+
colorPalette='gray'
|
|
136
|
+
fontWeight='normal'
|
|
137
|
+
fontSize='sm'
|
|
138
|
+
bg={current ? 'colorPalette.muted' : undefined}
|
|
139
|
+
_hover={{ bg: current ? 'colorPalette.muted' : 'bg.muted' }}
|
|
140
|
+
>
|
|
141
|
+
<a href={href} aria-current={current ? 'page' : undefined}>
|
|
142
|
+
<Icon as={icon} boxSize={4} />
|
|
143
|
+
{children}
|
|
144
|
+
</a>
|
|
145
|
+
</Button>
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* ---------- Tables on mobile ---------- */
|
|
150
|
+
|
|
151
|
+
/** One table row as a card below 768px: title + kebab, then badges and "Label: value" lines. */
|
|
152
|
+
export function DataListCard({ title, menu, children }: { title: ReactNode; menu?: ReactNode; children: ReactNode }) {
|
|
153
|
+
return (
|
|
154
|
+
<Card.Root w='full' bg='transparent' borderWidth='1px' borderColor='border' borderRadius='sm' p={4} gap={2}>
|
|
155
|
+
<Flex align='flex-start' justify='space-between' gap={2}>
|
|
156
|
+
<Box minW={0} lineClamp={2}>
|
|
157
|
+
{title}
|
|
158
|
+
</Box>
|
|
159
|
+
{menu}
|
|
160
|
+
</Flex>
|
|
161
|
+
<Stack gap={1} fontSize='sm' color='fg.muted'>
|
|
162
|
+
{children}
|
|
163
|
+
</Stack>
|
|
164
|
+
</Card.Root>
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/* ---------- Results ---------- */
|
|
169
|
+
|
|
170
|
+
/** One choice: label left, "votes · percent" right, thin bar under it. The label names the bar. */
|
|
171
|
+
export function ResultBar({ label, votes, percent }: { label: ReactNode; votes: number; percent: number }) {
|
|
172
|
+
return (
|
|
173
|
+
<Progress.Root value={percent} size='xs' colorPalette='teal'>
|
|
174
|
+
<Flex justify='space-between' gap={2} fontSize='md' mb={1.5}>
|
|
175
|
+
<Progress.Label minW={0} overflowWrap='anywhere' fontWeight='normal'>
|
|
176
|
+
{label}
|
|
177
|
+
</Progress.Label>
|
|
178
|
+
<Text color='fg.muted' flexShrink={0} fontVariantNumeric='tabular-nums'>
|
|
179
|
+
{votes} · {percent.toFixed(1)}%
|
|
180
|
+
</Text>
|
|
181
|
+
</Flex>
|
|
182
|
+
<Progress.Track borderRadius='full'>
|
|
183
|
+
<Progress.Range />
|
|
184
|
+
</Progress.Track>
|
|
185
|
+
</Progress.Root>
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/* ---------- Voter-authentication strength ---------- */
|
|
190
|
+
|
|
191
|
+
const LEVELS = ['weak', 'mid', 'strong'] as const
|
|
192
|
+
type Level = (typeof LEVELS)[number]
|
|
193
|
+
|
|
194
|
+
/** Three pills; only the current level is colored (recipe `securityLevel`). */
|
|
195
|
+
export function SecurityLevel({ level, labels }: { level: Level; labels?: Record<Level, string> }) {
|
|
196
|
+
const recipe = useRecipe({ key: 'securityLevel' })
|
|
197
|
+
const text = labels ?? { weak: 'Weak', mid: 'Mid', strong: 'Strong' }
|
|
198
|
+
return (
|
|
199
|
+
<SimpleGrid columns={3} gap={2}>
|
|
200
|
+
{LEVELS.map((l) => (
|
|
201
|
+
<Box key={l} css={recipe({ variant: l === level ? l : 'inactive' })} fontSize='sm' aria-current={l === level}>
|
|
202
|
+
{text[l]}
|
|
203
|
+
</Box>
|
|
204
|
+
))}
|
|
205
|
+
</SimpleGrid>
|
|
206
|
+
)
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/* ---------- Confirmation ---------- */
|
|
210
|
+
|
|
211
|
+
interface ConfirmDialogProps {
|
|
212
|
+
open: boolean
|
|
213
|
+
onOpenChange: (open: boolean) => void
|
|
214
|
+
title: ReactNode
|
|
215
|
+
description: ReactNode
|
|
216
|
+
confirmLabel: ReactNode
|
|
217
|
+
cancelLabel?: ReactNode
|
|
218
|
+
destructive?: boolean
|
|
219
|
+
loading?: boolean
|
|
220
|
+
onConfirm: () => void
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** Centered dialog. Cancel (ghost) left of the confirm; red confirm when destructive. */
|
|
224
|
+
export function ConfirmDialog({
|
|
225
|
+
open,
|
|
226
|
+
onOpenChange,
|
|
227
|
+
title,
|
|
228
|
+
description,
|
|
229
|
+
confirmLabel,
|
|
230
|
+
cancelLabel = 'Cancel',
|
|
231
|
+
destructive = true,
|
|
232
|
+
loading,
|
|
233
|
+
onConfirm,
|
|
234
|
+
}: ConfirmDialogProps) {
|
|
235
|
+
return (
|
|
236
|
+
<Dialog.Root open={open} onOpenChange={(e) => onOpenChange(e.open)} placement='center' role='alertdialog'>
|
|
237
|
+
<Portal>
|
|
238
|
+
<Dialog.Backdrop />
|
|
239
|
+
<Dialog.Positioner>
|
|
240
|
+
<Dialog.Content>
|
|
241
|
+
<Dialog.Header>
|
|
242
|
+
{/* 600 is the skill's normalization: the app asks for extrabold but only loads Inter up to 500 */}
|
|
243
|
+
<Dialog.Title fontWeight='semibold'>{title}</Dialog.Title>
|
|
244
|
+
</Dialog.Header>
|
|
245
|
+
<Dialog.Body>
|
|
246
|
+
<Dialog.Description fontSize='sm' color='fg.muted'>
|
|
247
|
+
{description}
|
|
248
|
+
</Dialog.Description>
|
|
249
|
+
</Dialog.Body>
|
|
250
|
+
<Dialog.Footer>
|
|
251
|
+
<Dialog.ActionTrigger asChild>
|
|
252
|
+
<Button variant='ghost'>{cancelLabel}</Button>
|
|
253
|
+
</Dialog.ActionTrigger>
|
|
254
|
+
<Button colorPalette={destructive ? 'red' : undefined} loading={loading} onClick={onConfirm}>
|
|
255
|
+
{confirmLabel}
|
|
256
|
+
</Button>
|
|
257
|
+
</Dialog.Footer>
|
|
258
|
+
</Dialog.Content>
|
|
259
|
+
</Dialog.Positioner>
|
|
260
|
+
</Portal>
|
|
261
|
+
</Dialog.Root>
|
|
262
|
+
)
|
|
263
|
+
}
|