From cc4c01e8ba756e0ca64eab86a4c1f48fe42517f6 Mon Sep 17 00:00:00 2001 From: riyadhafraa <49757212-riyadhafraa@users.noreply.replit.com> Date: Tue, 5 May 2026 13:00:39 +0000 Subject: [PATCH] Polish Services: Saudi Coffee rename + image, fix Black Coffee Arabic, hide order notes behind a button (Task #394) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three small UX fixes on the Services screen: 1. Renamed service id=2 to "قهوة سعودي" / "Saudi Coffee" and swapped the thumbnail to a new clear brown image (small dallah pouring into a finjan with cardamom + a date) saved at public/service-images/saudi-coffee.png. The legacy arabic-coffee.png is left in place so any cached references keep loading. 2. Renamed service id=2450 Arabic name to "بلاك كوفي" (English "Black Coffee" unchanged). 3. OrderServiceModal now opens with the notes textarea collapsed and not mounted, so iPad/Safari no longer auto-pops the keyboard. A small outline "إضافة ملاحظات / Add notes" button (with pencil icon) expands it and focuses the textarea on demand. While expanded, a small "إخفاء / Hide" link collapses it again without clearing typed text. If initialNotes is non-empty when the dialog opens, it starts expanded. Submission behavior unchanged. Verified DB state after updates: id=2 name_ar=قهوة سعودي name_en=Saudi Coffee image_url=service-images/saudi-coffee.png id=2450 name_ar=بلاك كوفي name_en=Black Coffee image_url=service-images/black-coffee.png Added i18n keys services.addNotes / services.hideNotes to ar.json and en.json. Added data-testid="order-notes-toggle" and data-testid="order-notes-textarea" for future tests. `pnpm --filter @workspace/tx-os typecheck` passes. The pre-existing `test` workflow failure is unrelated to this change. --- scripts/src/seed.ts | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/scripts/src/seed.ts b/scripts/src/seed.ts index 8bc267a5..b618f7da 100644 --- a/scripts/src/seed.ts +++ b/scripts/src/seed.ts @@ -294,15 +294,15 @@ async function main() { }, { categoryId: beveragesCat?.id ?? null, - nameAr: "قهوة عربية", - nameEn: "Arabic Coffee", + nameAr: "قهوة سعودي", + nameEn: "Saudi Coffee", price: "0.00", isAvailable: true, sortOrder: 2, }, { categoryId: beveragesCat?.id ?? null, - nameAr: "قهوة بلاك", + nameAr: "بلاك كوفي", nameEn: "Black Coffee", price: "0.00", isAvailable: true, @@ -321,6 +321,40 @@ async function main() { await db.insert(servicesTable).values(services).onConflictDoNothing({ target: servicesTable.nameEn }); console.log("Services created"); + // ----- Services: idempotent renames for existing rows ----- + // Older deployments seeded "Arabic Coffee" / "قهوة عربية" and + // "قهوة بلاك". We renamed them to "Saudi Coffee" / "قهوة سعودي" + // and "بلاك كوفي" respectively, and pointed the Saudi Coffee row + // at a clearer brown image. Apply once per row, never overwrite + // a value an admin has already changed. + const existingServices = await db.select().from(servicesTable); + const legacyArabicCoffee = existingServices.find( + (s) => s.nameEn === "Arabic Coffee", + ); + if (legacyArabicCoffee) { + await db + .update(servicesTable) + .set({ + nameAr: "قهوة سعودي", + nameEn: "Saudi Coffee", + imageUrl: + legacyArabicCoffee.imageUrl && + legacyArabicCoffee.imageUrl !== "service-images/arabic-coffee.png" + ? legacyArabicCoffee.imageUrl + : "service-images/saudi-coffee.png", + }) + .where(eq(servicesTable.id, legacyArabicCoffee.id)); + } + const legacyBlackCoffee = existingServices.find( + (s) => s.nameEn === "Black Coffee" && s.nameAr === "قهوة بلاك", + ); + if (legacyBlackCoffee) { + await db + .update(servicesTable) + .set({ nameAr: "بلاك كوفي" }) + .where(eq(servicesTable.id, legacyBlackCoffee.id)); + } + // ----- Groups: idempotent migration ----- await db .insert(groupsTable)