From dad3a909d31ee3f386ad4fa2dd76f1a1ad8f1519 Mon Sep 17 00:00:00 2001 From: riyadhafraa <49757212-riyadhafraa@users.noreply.replit.com> Date: Tue, 5 May 2026 13:03:03 +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 | 90 +++++++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 44 deletions(-) diff --git a/scripts/src/seed.ts b/scripts/src/seed.ts index b618f7da..9a8595a1 100644 --- a/scripts/src/seed.ts +++ b/scripts/src/seed.ts @@ -282,51 +282,13 @@ async function main() { const beveragesCat = insertedCategories[0]; - // Create services - const services = [ - { - categoryId: beveragesCat?.id ?? null, - nameAr: "شاي", - nameEn: "Tea", - price: "0.00", - isAvailable: true, - sortOrder: 1, - }, - { - categoryId: beveragesCat?.id ?? null, - nameAr: "قهوة سعودي", - nameEn: "Saudi Coffee", - price: "0.00", - isAvailable: true, - sortOrder: 2, - }, - { - categoryId: beveragesCat?.id ?? null, - nameAr: "بلاك كوفي", - nameEn: "Black Coffee", - price: "0.00", - isAvailable: true, - sortOrder: 3, - }, - { - categoryId: beveragesCat?.id ?? null, - nameAr: "عصير طازج", - nameEn: "Fresh Juice", - price: "5.00", - isAvailable: true, - sortOrder: 5, - }, - ]; - - await db.insert(servicesTable).values(services).onConflictDoNothing({ target: servicesTable.nameEn }); - console.log("Services created"); - - // ----- Services: idempotent renames for existing rows ----- + // ----- Services: idempotent renames for legacy 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. + // "قهوة بلاك". Rename them BEFORE the insert below so the insert's + // onConflictDoNothing (target: nameEn) sees the new "Saudi Coffee" + // name already present and skips it — avoiding a unique-constraint + // collision on services.name_en. Never overwrite an imageUrl that + // an admin has already customized. const existingServices = await db.select().from(servicesTable); const legacyArabicCoffee = existingServices.find( (s) => s.nameEn === "Arabic Coffee", @@ -355,6 +317,46 @@ async function main() { .where(eq(servicesTable.id, legacyBlackCoffee.id)); } + // Create services + const services = [ + { + categoryId: beveragesCat?.id ?? null, + nameAr: "شاي", + nameEn: "Tea", + price: "0.00", + isAvailable: true, + sortOrder: 1, + }, + { + categoryId: beveragesCat?.id ?? null, + nameAr: "قهوة سعودي", + nameEn: "Saudi Coffee", + imageUrl: "service-images/saudi-coffee.png", + price: "0.00", + isAvailable: true, + sortOrder: 2, + }, + { + categoryId: beveragesCat?.id ?? null, + nameAr: "بلاك كوفي", + nameEn: "Black Coffee", + price: "0.00", + isAvailable: true, + sortOrder: 3, + }, + { + categoryId: beveragesCat?.id ?? null, + nameAr: "عصير طازج", + nameEn: "Fresh Juice", + price: "5.00", + isAvailable: true, + sortOrder: 5, + }, + ]; + + await db.insert(servicesTable).values(services).onConflictDoNothing({ target: servicesTable.nameEn }); + console.log("Services created"); + // ----- Groups: idempotent migration ----- await db .insert(groupsTable)