Task #501: Default new notes to yellow

The notes composer now starts with the yellow swatch pre-selected
instead of the neutral "default" color, so a freshly created note
becomes a yellow sticky by default. The user can still pick any
other color from the swatch picker before saving, and that choice
is honored. After a successful save (or send), the composer resets
back to yellow rather than "default", so the next note in the same
session is also yellow unless the user changes it.

Changes:
- artifacts/tx-os/src/pages/notes.tsx
  - Composer initial color state: useState("default") -> useState("yellow")
  - Composer reset() helper: setColor("default") -> setColor("yellow")

Out of scope (per task spec):
- No backend changes. The API's data.color = "default" fallback for
  notes created via other paths (shared-folder stamping, incoming-
  note flows) is intentionally untouched.
- No changes to existing notes already saved in the database.
- No new "default color" user setting.
- NOTE_COLORS palette and color-picker UI unchanged.

Verification:
- `pnpm exec tsc --noEmit` passes clean.
- "yellow" is a valid id in NOTE_COLORS (src/lib/notes-api.ts:801),
  so colorBg/colorAccent/colorMeta resolve correctly and the swatch
  shows pre-selected.
- Color-picker onChange path unchanged, so user-picked colors still
  override the new yellow default before save.
This commit is contained in:
riyadhafraa
2026-05-11 15:48:35 +00:00
parent 5efaac8c2c
commit 95522dacbe
+2 -2
View File
@@ -2865,7 +2865,7 @@ function Composer({
const { t } = useTranslation();
const [open, setOpen] = useState(false);
const [content, setContent] = useState("");
const [color, setColor] = useState("default");
const [color, setColor] = useState("yellow");
const [labelIds, setLabelIds] = useState<number[]>([]);
const [kind, setKind] = useState<NoteKind>("text");
const [items, setItems] = useState<ChecklistItem[]>([]);
@@ -2917,7 +2917,7 @@ function Composer({
const reset = () => {
setContent("");
setColor("default");
setColor("yellow");
setLabelIds([]);
setKind("text");
setItems([]);