{post.title}
diff --git a/apps/web/src/dashboard/features/board/components/board-surface/status-icon.tsx b/apps/web/src/dashboard/features/board/components/board-surface/status-icon.tsx index b45165d52..c45bb6cb1 100644 --- a/apps/web/src/dashboard/features/board/components/board-surface/status-icon.tsx +++ b/apps/web/src/dashboard/features/board/components/board-surface/status-icon.tsx @@ -1,18 +1,22 @@ +import { PostStatusIcon } from "@feeblo/post-ui/post-status-icon"; import { cn } from "@feeblo/ui/utils"; import { BOARD_LANE_COLOR_MAP, - BoardIconMap, type BoardPostStatus, } from "@feeblo/web-shared/board/constants"; -import { HugeiconsIcon } from "@hugeicons/react"; -export function StatusIcon({ status }: { status: BoardPostStatus }) { - const Icon = BoardIconMap[status] ?? BoardIconMap.PLANNED; +export function StatusIcon({ + icon, + status, +}: { + icon?: string | null; + status: BoardPostStatus; +}) { const color = BOARD_LANE_COLOR_MAP[status]; return ( -
{topic.description}
diff --git a/docs/adr/0030-the-icon-picker-is-a-generated-sprite.md b/docs/adr/0030-the-icon-picker-is-a-generated-sprite.md
index f8e15b853..f2430453d 100644
--- a/docs/adr/0030-the-icon-picker-is-a-generated-sprite.md
+++ b/docs/adr/0030-the-icon-picker-is-a-generated-sprite.md
@@ -9,7 +9,7 @@
- **The picker's behaviour is a port of [Frimousse](https://github.com/liveblocks/frimousse), not a reimplementation.** The virtualization, the keyboard grid, the sticky category headers and the measurement of the caller's own `Icon` and `CategoryHeader` components are kept as they are. The emoji-specific parts are removed: skin tones, locales, the locale-aware Emojibase resolver, and the emoji font.
- **The store is an `@xstate/store` event map, and `interaction` is its one declared lifecycle.** There is no statechart, because the state the virtualizer needs is not a lifecycle: it is measured DOM geometry (`rowHeight`, `viewportHeight`, `viewportScrollY`) that a machine would only mirror.
-The picker is a design-system component exported as `@feeblo/ui/icon-picker`; no product surface selects an icon yet. Wiring it into the changelog category's `iconType: "icon"` is a product change with its own schema work, not part of this one.
+The picker is a design-system component exported as `@feeblo/ui/icon-picker`. `IconPickerField` is its popover-backed trigger, and the board, post-status and help-center-topic settings dialogs use it. Each stores a Tabler name in a nullable text column and resolves a null or unknown name to a client default in `@feeblo/web-shared/icons/defaults`: the default lives on the client so the artwork can change without a migration, and a row that predates the picker still renders a mark. Wiring the changelog category's `iconType: "icon"` is still a product change with its own schema work, not part of this one.
### The generated artefacts
@@ -19,8 +19,9 @@ The picker is a design-system component exported as `@feeblo/ui/icon-picker`; no
- `tabler-filled-icons.ts` — name, humanized label, category index and curated tags per icon; 154.2 KB raw / 30.4 KB gzip. The `category` is an index into `TABLER_FILLED_CATEGORIES` so each category name is stored once. It is a dynamically imported chunk, not part of the route bundle.
- `tabler-filled-symbol-prefix.ts` — the static `tabler-filled-` symbol prefix, in its own module on purpose: a static import of _anything_ from `tabler-filled-icons.ts` would pull the whole catalogue into the initial chunk and undo the split.
- `LICENSE-tabler-icons.txt` — Tabler's MIT notice, carried beside the derivative work.
+- `packages/web-shared/src/icons/generated/tabler-filled-names.ts` — the 1,054 names as a `ReadonlySet`, 18.9 KB raw. The entity-icon defaults validate a stored name against it before rendering, so an unknown name falls back to the entity default instead of an empty tile. The resolver lives in `@feeblo/web-shared`, which cannot import `@feeblo/ui` because the UI package depends on it, so the generator writes this one file into web-shared. It carries no labels, categories or tags; those stay in the lazy catalogue.
-The output is committed. `pnpm check` must not need a code generator, and a dependency bump should produce a reviewable diff of the sprite and the metadata rather than changing at install time. The three files are excluded from `oxlint` and `oxfmt`: the generator owns their layout, and reformatting them would make every regeneration a whole-file diff.
+The output is committed. `pnpm check` must not need a code generator, and a dependency bump should produce a reviewable diff of the sprite, the metadata and the name set rather than changing at install time. The generated files are excluded from `oxlint` and `oxfmt`: the generator owns their layout, and reformatting them would make every regeneration a whole-file diff.
`@tabler/icons` is pinned exactly in the catalog for the same reason: a range would let an install change what the generated files should contain without changing them.
@@ -34,7 +35,7 @@ It is also not inlined as `?raw`: that would put the sprite in the route chunk,
### Why only the metadata is lazy
-The two artefacts have different readers. A settings page renders a trigger that shows the selected icon; that trigger needs the sprite and nothing else. The catalogue is 30.4 KB gzip of labels and tags that only matter once the picker opens. So the metadata is a dynamic `import()` with a literal path, started when `IconPicker.Root` mounts, and the sprite stays an eagerly fetched asset because deferring it would mean a trigger cannot draw its icon.
+The artefacts have different readers. A settings page renders a trigger that shows the selected icon; that trigger needs the sprite, and the resolver needs the name set to reject an unknown stored name. The catalogue is 30.4 KB gzip of labels and tags that only matter once the picker opens. So the metadata is a dynamic `import()` with a literal path, started when `IconPicker.Root` mounts, and the sprite stays an eagerly fetched asset because deferring it would mean a trigger cannot draw its icon.
The two requests run in parallel when the picker opens, and the `Loading` part covers both. Typing before the chunk settles only records the query; the store derives the grid from the search it holds when the catalogue arrives. `IconPicker.preload` starts the chunk from a trigger's `onPointerEnter`/`onFocus`, so a hovered trigger has usually paid for it by the time the click lands.
diff --git a/oxfmt.config.ts b/oxfmt.config.ts
index 96599bad7..7e31b9b37 100644
--- a/oxfmt.config.ts
+++ b/oxfmt.config.ts
@@ -39,6 +39,9 @@ export default defineConfig({
// Reformatting them would make every regeneration a whole-file diff, and
// the generator owns their layout. See `docs/adr/0030`.
"packages/ui/src/icon-picker/generated/**",
+ // The name set beside the entity icon resolver is generated by the same
+ // script; only the names live here, not the search metadata.
+ "packages/web-shared/src/icons/generated/**",
// Drizzle migrations (generated SQL + metadata)
"packages/db/src/migrations/**",
diff --git a/oxlint.config.ts b/oxlint.config.ts
index e4d2c6120..e2b3ba370 100644
--- a/oxlint.config.ts
+++ b/oxlint.config.ts
@@ -61,6 +61,9 @@ export default defineConfig({
// Reformatting them would make every regeneration a whole-file diff, and
// the generator owns their layout. See `docs/adr/0030`.
"packages/ui/src/icon-picker/generated/**",
+ // The name set beside the entity icon resolver is generated by the same
+ // script; only the names live here, not the search metadata.
+ "packages/web-shared/src/icons/generated/**",
// Drizzle migrations (generated SQL + metadata)
"packages/db/src/migrations/**",
diff --git a/packages/db/src/migrations/20261118124737_wooden_exiles/migration.sql b/packages/db/src/migrations/20261118124737_wooden_exiles/migration.sql
new file mode 100644
index 000000000..ebad347f2
--- /dev/null
+++ b/packages/db/src/migrations/20261118124737_wooden_exiles/migration.sql
@@ -0,0 +1 @@
+ALTER TABLE "board" ADD COLUMN "icon" text;
\ No newline at end of file
diff --git a/packages/db/src/migrations/20261118124737_wooden_exiles/snapshot.json b/packages/db/src/migrations/20261118124737_wooden_exiles/snapshot.json
new file mode 100644
index 000000000..15545cfb7
--- /dev/null
+++ b/packages/db/src/migrations/20261118124737_wooden_exiles/snapshot.json
@@ -0,0 +1,47 @@
+{
+ "type": "diff",
+ "version": "9",
+ "dialect": "postgres",
+ "id": "863854fe-d0d7-47c3-8467-1f3e8a03d65a",
+ "prevIds": [
+ "6fd1d92d-f6e5-445d-8ff6-0b57edde8b4e"
+ ],
+ "footprints": [
+ {
+ "statementType": "add_column",
+ "statementTarget": [
+ "column",
+ "public",
+ "board",
+ "icon"
+ ],
+ "writes": [
+ "s|col|public.board.icon",
+ "n|col|public.board.icon",
+ "e|col|public.board.icon"
+ ],
+ "reads": [
+ "n|tbl|public.board",
+ "n|sch|public"
+ ]
+ }
+ ],
+ "deltas": [
+ {
+ "op": "create",
+ "row": {
+ "schema": "public",
+ "table": "board",
+ "name": "icon",
+ "type": "text",
+ "typeSchema": null,
+ "notNull": false,
+ "dimensions": 0,
+ "default": null,
+ "generated": null,
+ "identity": null,
+ "entityType": "columns"
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/packages/db/src/schema/feedback.ts b/packages/db/src/schema/feedback.ts
index 135199c8e..f3af491d1 100644
--- a/packages/db/src/schema/feedback.ts
+++ b/packages/db/src/schema/feedback.ts
@@ -171,6 +171,13 @@ export const boardTable = pgTable(
id: text("id").primaryKey(),
name: text("name").notNull(),
slug: text("slug").notNull(),
+ /**
+ * A Tabler icon name chosen in the dashboard's icon picker, or null for a
+ * board that has never picked one. The client resolves null to its default
+ * rather than the database writing one, so the artwork can change without
+ * a migration.
+ */
+ icon: text("icon"),
visibility: boardVisibilityEnum("visibility").notNull(),
organizationId: text("organization_id")
.notNull()
@@ -246,7 +253,8 @@ export const postStatusTable = pgTable(
// oklch() color used for status indicators; null until a workspace
// customizes the status.
color: text("color"),
- // Reserved for future icon payloads; kept in the db schema only.
+ // A Tabler icon name chosen in the dashboard's picker; null keeps the
+ // type's default mark on the client.
icon: text("icon"),
orderIndex: integer("order_index").notNull(),
// The status a post lands in when no status is named, and the one status
diff --git a/packages/db/src/schema/help-center.ts b/packages/db/src/schema/help-center.ts
index aa8c6e55b..44b200f8e 100644
--- a/packages/db/src/schema/help-center.ts
+++ b/packages/db/src/schema/help-center.ts
@@ -48,7 +48,7 @@ export const helpCenterTopicTable = pgTable(
name: text("name").notNull(),
description: text("description"),
/**
- * An icon *name* from the dashboard's icon set, not a colour triple.
+ * A Tabler icon *name* from the dashboard's picker, not a colour triple.
* `changelog_category` carries `icon_type` beside `icon` because it
* predates a decision about icon families; a new table picks one
* representation rather than encoding a union as two columns.
diff --git a/packages/domain/src/board/handlers.ts b/packages/domain/src/board/handlers.ts
index c6bbe812f..55f1f0bf3 100644
--- a/packages/domain/src/board/handlers.ts
+++ b/packages/domain/src/board/handlers.ts
@@ -97,6 +97,7 @@ export const BoardRpcHandlersEffect = Effect.gen(function* () {
Effect.gen(function* () {
yield* repository.create({
...args,
+ icon: args.icon ?? null,
creatorId: session.session.userId,
creatorMemberId: isMember.membershipId,
});
@@ -147,11 +148,18 @@ export const BoardRpcHandlersEffect = Effect.gen(function* () {
// A save that changed nothing is not an event; `fields` is what
// the reader filters on, so an empty diff is left unrecorded
// rather than written as an update with no change.
+ // `undefined` is "leave it alone"; `null` is "clear the custom
+ // icon". A nullish coalesce would make the second impossible.
+ const nextIcon =
+ args.icon === undefined ? previous.icon : args.icon;
+
+ const nextName = args.name ?? previous.name;
+ const nextVisibility = args.visibility ?? previous.visibility;
+
const fields = [
- ...(previous.name === args.name ? [] : ["name"]),
- ...(previous.visibility === args.visibility
- ? []
- : ["visibility"]),
+ ...(previous.name === nextName ? [] : ["name"]),
+ ...(previous.icon === nextIcon ? [] : ["icon"]),
+ ...(previous.visibility === nextVisibility ? [] : ["visibility"]),
];
yield* repository.update(args);
@@ -169,10 +177,15 @@ export const BoardRpcHandlersEffect = Effect.gen(function* () {
changes: {
fields,
before: {
+ icon: previous.icon,
name: previous.name,
visibility: previous.visibility,
},
- after: { name: args.name, visibility: args.visibility },
+ after: {
+ icon: nextIcon,
+ name: nextName,
+ visibility: nextVisibility,
+ },
},
});
})
diff --git a/packages/domain/src/board/policies.ts b/packages/domain/src/board/policies.ts
index 9a83f240b..143c651e5 100644
--- a/packages/domain/src/board/policies.ts
+++ b/packages/domain/src/board/policies.ts
@@ -20,7 +20,8 @@ type TCanDelete = {
type TCanUpdate = {
organizationId: string;
boardId: string;
- visibility: "PUBLIC" | "PRIVATE";
+ /** Omitted when the update does not change visibility. */
+ visibility?: "PUBLIC" | "PRIVATE" | undefined;
};
const makeBoardPolicy = Effect.gen(function* () {
diff --git a/packages/domain/src/board/repository.ts b/packages/domain/src/board/repository.ts
index c4b9dc409..fb34fa316 100644
--- a/packages/domain/src/board/repository.ts
+++ b/packages/domain/src/board/repository.ts
@@ -7,22 +7,26 @@ import * as DateTime from "effect/DateTime";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
+import type { TBoardUpdate as TBoardUpdatePayload } from "./schema";
+
interface TBoardCreate {
/** Null when the board is created by an import whose uploader is gone. */
creatorId: string | null;
creatorMemberId: string | null;
+ icon: string | null;
id: string;
name: string;
organizationId: string;
visibility: "PUBLIC" | "PRIVATE";
}
-interface TBoardUpdate {
+type TBoardUpdate = Pick<
+ TBoardUpdatePayload,
+ "icon" | "name" | "visibility"
+> & {
id: string;
- name?: string;
organizationId: string;
- visibility?: "PUBLIC" | "PRIVATE";
-}
+};
interface TBoardFindById {
id: string;
@@ -62,6 +66,7 @@ const BOARD_FIELDS = {
id: schema.boardTable.id,
name: schema.boardTable.name,
slug: schema.boardTable.slug,
+ icon: schema.boardTable.icon,
visibility: schema.boardTable.visibility,
organizationId: schema.boardTable.organizationId,
createdAt: schema.boardTable.createdAt,
diff --git a/packages/domain/src/board/schema.ts b/packages/domain/src/board/schema.ts
index 0b095caab..39dd466c5 100644
--- a/packages/domain/src/board/schema.ts
+++ b/packages/domain/src/board/schema.ts
@@ -5,6 +5,11 @@ export const Board = S.Struct({
id: S.String,
name: S.String,
slug: S.String,
+ /**
+ * A Tabler icon name from the dashboard's picker. Null is a board that has
+ * never picked one; every surface resolves it to the client's default.
+ */
+ icon: S.NullOr(S.String),
visibility: S.Literals(["PUBLIC", "PRIVATE"]),
createdAt: S.DateFromString,
updatedAt: S.DateFromString,
@@ -16,6 +21,7 @@ export type TBoard = S.Schema.Type