4290bc54c9
The four default home-screen tiles (Notes / Services / Meetings /
Admin) showed up as three blue tiles + one orange one. Root cause was
NOT the DB — seed.ts already gave each app a distinct hex — but the
`gradientForColor()` mapper in `artifacts/tx-os/src/pages/home.tsx`
only recognised blue/purple/green/orange/pink/teal, so yellow
(#eab308), red (#ef4444), and the dark navy meetings colour all fell
through to the default blue gradient.
Changes:
1. `artifacts/tx-os/src/index.css` — added `.icon-tile-red` and
`.icon-tile-yellow` gradients matching the existing tile style.
2. `artifacts/tx-os/src/pages/home.tsx` — `gradientForColor()` now
maps red/dc2626 and yellow/facc15 first. Purple branch stays for
admin-custom apps but no seeded row uses it.
3. `scripts/src/seed.ts` —
- Meetings: `#0B1E3F` → `#22c55e` (green).
- Notifications: `#8b5cf6` → `#06b6d4` (cyan) — kills the last
purple in the default palette per user direction.
4. `scripts/src/update-app-colors.ts` (new) — idempotent migration
that bumps existing rows ONLY when they still hold the exact old
default colour, so admin customisations from the Apps editor are
preserved. Wired into `scripts/package.json` as
`pnpm run update-app-colors`.
5. `scripts/redeploy.sh` — new step 5/6 runs the colour migration
after seed and before `docker compose up -d`, on the same one-shot
`migrate` container pattern as other one-shot scripts.
No schema changes, no new deps. tx-os tsc passes, scripts tsc passes.
After `./scripts/redeploy.sh` on Mac, home shows four distinct hues
(yellow / orange / green / red) and no tile is purple anywhere.
49 lines
1.7 KiB
TypeScript
49 lines
1.7 KiB
TypeScript
import { db, appsTable } from "@workspace/db";
|
|
import { and, eq } from "drizzle-orm";
|
|
|
|
// #603: One-shot migration that bumps the seeded app colours on
|
|
// existing installs to the new #603 palette. The seed itself uses
|
|
// `onConflictDoNothing` on `slug`, so previously-seeded rows would
|
|
// otherwise keep their old hex values forever and continue to render
|
|
// as three identical blue tiles on the home screen.
|
|
//
|
|
// Each update is gated on the row STILL holding the old default —
|
|
// admins who customised an app colour from the Apps editor keep their
|
|
// choice untouched.
|
|
const MIGRATIONS: Array<{ slug: string; from: string; to: string }> = [
|
|
// Meetings: dark navy → green (was falling through to default blue).
|
|
{ slug: "executive-meetings", from: "#0B1E3F", to: "#22c55e" },
|
|
// Notifications: purple → cyan (purple is no longer in the palette).
|
|
{ slug: "notifications", from: "#8b5cf6", to: "#06b6d4" },
|
|
];
|
|
|
|
async function main(): Promise<void> {
|
|
console.log("Migrating app colours to the #603 palette...");
|
|
let touched = 0;
|
|
for (const m of MIGRATIONS) {
|
|
const updated = await db
|
|
.update(appsTable)
|
|
.set({ color: m.to })
|
|
.where(and(eq(appsTable.slug, m.slug), eq(appsTable.color, m.from)))
|
|
.returning({ slug: appsTable.slug, color: appsTable.color });
|
|
if (updated.length === 0) {
|
|
console.log(
|
|
` - ${m.slug}: skipped (row missing or already customised)`,
|
|
);
|
|
} else {
|
|
touched += updated.length;
|
|
for (const row of updated) {
|
|
console.log(` - ${row.slug}: color → ${row.color}`);
|
|
}
|
|
}
|
|
}
|
|
console.log(`Done. Rows updated: ${touched}.`);
|
|
}
|
|
|
|
main()
|
|
.catch((err) => {
|
|
console.error(err);
|
|
process.exit(1);
|
|
})
|
|
.finally(() => process.exit(0));
|