Polish Services: Saudi Coffee rename + image, fix Black Coffee Arabic, hide order notes behind a button (Task #394)
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.
This commit is contained in:
+37
-3
@@ -294,15 +294,15 @@ async function main() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
categoryId: beveragesCat?.id ?? null,
|
categoryId: beveragesCat?.id ?? null,
|
||||||
nameAr: "قهوة عربية",
|
nameAr: "قهوة سعودي",
|
||||||
nameEn: "Arabic Coffee",
|
nameEn: "Saudi Coffee",
|
||||||
price: "0.00",
|
price: "0.00",
|
||||||
isAvailable: true,
|
isAvailable: true,
|
||||||
sortOrder: 2,
|
sortOrder: 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
categoryId: beveragesCat?.id ?? null,
|
categoryId: beveragesCat?.id ?? null,
|
||||||
nameAr: "قهوة بلاك",
|
nameAr: "بلاك كوفي",
|
||||||
nameEn: "Black Coffee",
|
nameEn: "Black Coffee",
|
||||||
price: "0.00",
|
price: "0.00",
|
||||||
isAvailable: true,
|
isAvailable: true,
|
||||||
@@ -321,6 +321,40 @@ async function main() {
|
|||||||
await db.insert(servicesTable).values(services).onConflictDoNothing({ target: servicesTable.nameEn });
|
await db.insert(servicesTable).values(services).onConflictDoNothing({ target: servicesTable.nameEn });
|
||||||
console.log("Services created");
|
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 -----
|
// ----- Groups: idempotent migration -----
|
||||||
await db
|
await db
|
||||||
.insert(groupsTable)
|
.insert(groupsTable)
|
||||||
|
|||||||
Reference in New Issue
Block a user