user-ui enh

This commit is contained in:
shafi54 2026-10-02 01:46:54 +05:30
parent dec7b3a79b
commit 286943c081
10 changed files with 571 additions and 91 deletions

View file

@ -2,7 +2,7 @@
## Important instructions
- Don't run any drizzle migrations. User will handle it.
- don't try to run any test unless user explicitly asks for
- don't try to run any test from the suite unless user explicitly asks for
## Code Style Guidelines

View file

@ -391,6 +391,9 @@ const ListHeader = memo(({
return (
<>
<View style={tw`pt-2`}>
<NextOrderGlimpse />
</View>
{dashboardTags.length > 0 && (
<TagTabStrip
dashboardTags={dashboardTags}
@ -443,10 +446,6 @@ const ListHeader = memo(({
</View>
)}
<View style={tw`py-2`}>
<NextOrderGlimpse />
</View>
{sortedSlots.length > 0 && (
<View style={tw`mt-2 mb-4`}>
<View style={tw`flex-row items-center justify-between px-1 mb-6`}>

View file

@ -9,6 +9,7 @@ import Ionicons from '@expo/vector-icons/Ionicons';
import dayjs from "dayjs";
import ComplaintForm from "@/components/ComplaintForm";
import { orderStatusManipulator } from "@/src/lib/string-manipulators";
import OrderStatusTracker from "@/components/OrderStatusTracker";
export default function OrderDetails() {
const { id } = useLocalSearchParams<{ id: string }>();
@ -176,6 +177,12 @@ export default function OrderDetails() {
</View>
)}
{/* Order Status Tracker */}
<View style={tw`bg-white rounded-2xl p-5 mb-4 border border-slate-100`}>
<MyText style={tw`text-slate-400 text-[10px] font-bold uppercase mb-4`}>Order Status</MyText>
<OrderStatusTracker deliveryStatus={order.deliveryStatus} />
</View>
{/* Main Info Card */}
<View style={tw`bg-white rounded-2xl p-5 mb-4 border border-slate-100`}>
<View style={tw`flex-row items-center justify-between mb-4`}>

View file

@ -4,11 +4,11 @@ import { View, TouchableOpacity, ActivityIndicator, Linking, ScrollView, Dimensi
import { useRouter } from 'expo-router';
import { tw, MyText } from 'common-ui';
import { useNavigationTarget } from 'common-ui/hooks/useNavigationTarget';
import { MaterialIcons, Ionicons } from '@expo/vector-icons';
import { MaterialIcons } from '@expo/vector-icons';
import dayjs from 'dayjs';
import { trpc } from '@/src/trpc-client';
import { Image } from 'expo-image';
import { orderStatusManipulator } from '@/src/lib/string-manipulators';
import OrderStatusTracker from './OrderStatusTracker';
import { useGetEssentialConsts } from '@/src/hooks/prominent-api-hooks';
import { useUserDetails } from '@/src/contexts/AuthContext';
import type { Order, OrderItem } from '@/src/types/orders';
@ -22,6 +22,22 @@ interface OrderCardProps extends OrderCardActionProps<Order> {
}
function OrderCard({ order, onPress, supportMobile }: OrderCardProps) {
const statusLabel = orderStatusManipulator(order.deliveryStatus);
const hideStatus = ['confirmed', 'packaged'].includes(statusLabel.toLowerCase());
const deliveryPrimaryLabel = order.isFlashDelivery
? "30-Min"
: (() => {
const startTime = dayjs(order.deliveryDate);
const endTime = startTime.add(1, 'hour');
const startPeriod = startTime.format("A");
const endPeriod = endTime.format("A");
return startPeriod === endPeriod
? `${startTime.format("hh:mm")} - ${endTime.format("hh:mm")} ${startPeriod}`
: `${startTime.format("hh:mm A")} - ${endTime.format("hh:mm A")}`;
})();
const deliverySecondaryLabel = order.isFlashDelivery
? "Delivery"
: dayjs(order.deliveryDate).format("DD MMM");
return (
<TouchableOpacity
style={{ width: CARD_WIDTH, marginRight: 24 }}
@ -34,12 +50,15 @@ function OrderCard({ order, onPress, supportMobile }: OrderCardProps) {
<View style={tw`w-2 h-2 rounded-full bg-amber-500 mr-2`} />
<MyText style={tw`text-[10px] font-bold text-amber-600 uppercase tracking-wider`}>Upcoming Order</MyText>
</View>
{order.isFlashDelivery && (
<View style={tw`px-2 py-0.5 bg-amber-200 rounded-full flex-row items-center`}>
<MaterialIcons name="bolt" size={10} color="#D97706" style={tw`mr-0.5`} />
<MyText style={tw`text-[8px] font-black text-amber-700 uppercase`}>FLASH</MyText>
</View>
)}
<View style={tw`flex-row items-center`}>
{order.isFlashDelivery && (
<View style={tw`px-2 py-0.5 bg-amber-200 rounded-full flex-row items-center mr-1.5`}>
<MaterialIcons name="bolt" size={10} color="#D97706" style={tw`mr-0.5`} />
<MyText style={tw`text-[8px] font-black text-amber-700 uppercase`}>FLASH</MyText>
</View>
)}
<MaterialIcons name="chevron-right" size={18} color="#B45309" />
</View>
</View>
<View style={tw`flex-row justify-between items-start mb-3`}>
@ -49,57 +68,34 @@ function OrderCard({ order, onPress, supportMobile }: OrderCardProps) {
{order.items.length} {order.items.length === 1 ? 'item' : 'items'} • ₹{order.totalAmount}
</MyText>
</View>
<View style={tw`bg-white px-2 py-1 rounded-lg border border-amber-200`}>
<MyText style={tw`text-[10px] font-bold text-amber-700 uppercase`}>{orderStatusManipulator(order.deliveryStatus)}</MyText>
</View>
</View>
<View style={tw`flex-row items-center`}>
<MaterialIcons
name={order.isFlashDelivery ? "bolt" : "schedule"}
size={14}
color="#D97706"
style={tw`mr-1.5`}
/>
<MyText style={tw`text-xs font-medium text-amber-800`}>
{order.isFlashDelivery
? "30-Min Delivery"
: (() => {
const startTime = dayjs(order.deliveryDate);
const endTime = startTime.add(1, 'hour');
return `${startTime.format("DD MMM, hh:mm A")} - ${endTime.format("hh:mm A")}`;
})()
}
</MyText>
</View>
{order.items.length > 0 && (
<View style={tw`flex-row items-center mt-3 pt-3 border-t border-amber-200`}>
<View style={tw`flex-row`}>
{order.items.slice(0, 3).map((item, idx) => (
<View
key={idx}
style={[
tw`w-8 h-8 rounded-lg bg-white border border-amber-200 items-center justify-center`,
{ marginLeft: idx > 0 ? -8 : 0 }
]}
>
<Image
source={{ uri: item.image || undefined }}
style={tw`w-full h-full rounded-lg`}
/>
</View>
))}
{order.items.length > 3 && (
<View style={tw`w-8 h-8 rounded-lg bg-amber-100 border border-amber-200 items-center justify-center ml-2`}>
<MyText style={tw`text-[9px] font-bold text-amber-700`}>+{order.items.length - 3}</MyText>
</View>
)}
<View style={tw`items-end`}>
<View style={tw`bg-white px-2.5 py-1.5 rounded-2xl border border-amber-200 items-end`}>
<View style={tw`flex-row items-center`}>
<MaterialIcons
name={order.isFlashDelivery ? "bolt" : "schedule"}
size={13}
color="#D97706"
style={tw`mr-1`}
/>
<MyText style={tw`text-[13px] font-black text-amber-900`}>{deliveryPrimaryLabel}</MyText>
</View>
<MyText style={tw`text-[9px] font-semibold text-amber-500 mt-0.5`}>{deliverySecondaryLabel}</MyText>
</View>
<MyText style={tw`text-xs text-amber-700 font-medium ml-2`}>Track Order</MyText>
<Ionicons name="chevron-forward" size={14} color="#D97706" style={tw`ml-auto`} />
{!hideStatus && (
<View style={tw`bg-white px-2 py-0.5 rounded-lg border border-amber-200 mt-1`}>
<MyText style={tw`text-[10px] font-bold text-amber-700 uppercase`}>{statusLabel}</MyText>
</View>
)}
</View>
)}
</View>
<View style={tw`mt-3`}>
<OrderStatusTracker
deliveryStatus={order.deliveryStatus}
activeColor="#D97706"
inactiveColor="#FDE68A"
/>
</View>
{/* Support Mobile Number */}
{supportMobile && (

View file

@ -0,0 +1,72 @@
import { View } from 'react-native';
import { tw, MyText } from 'common-ui';
const STAGES = ['Placed', 'Packed', 'Delivered'] as const;
export type OrderStage = (typeof STAGES)[number];
/**
* Maps a backend deliveryStatus to the furthest stage reached:
* pending / processing -> 0 (Placed)
* packaged -> 1 (Packed)
* success / delivered -> 2 (Delivered)
* Anything else (incl. cancelled) falls back to 0.
*/
export function deliveryStageIndex(deliveryStatus?: string | null): number {
switch ((deliveryStatus || '').toLowerCase()) {
case 'packaged':
return 1;
case 'success':
case 'delivered':
return 2;
default:
return 0;
}
}
interface OrderStatusTrackerProps {
deliveryStatus?: string | null;
activeColor?: string;
inactiveColor?: string;
}
export default function OrderStatusTracker({
deliveryStatus,
activeColor = '#10B981',
inactiveColor = '#E2E8F0',
}: OrderStatusTrackerProps) {
const cancelled = (deliveryStatus || '').toLowerCase() === 'cancelled';
const currentIndex = cancelled ? -1 : deliveryStageIndex(deliveryStatus);
return (
<View testID="order-status-tracker" style={tw`flex-row`}>
{STAGES.map((label, i) => {
const reached = i <= currentIndex;
const dotColor = reached ? activeColor : inactiveColor;
const leftLine = i > 0 && i <= currentIndex ? activeColor : inactiveColor;
const rightLine = i < STAGES.length - 1 && i < currentIndex ? activeColor : inactiveColor;
return (
<View key={label} style={tw`flex-1 items-center`}>
<View style={tw`flex-row items-center w-full`}>
<View style={[tw`flex-1 h-0.5 rounded-full`, { backgroundColor: leftLine }]} />
<View
testID={`order-status-dot-${label.toLowerCase()}`}
style={[tw`w-3 h-3 rounded-full`, { backgroundColor: dotColor }]}
/>
<View style={[tw`flex-1 h-0.5 rounded-full`, { backgroundColor: rightLine }]} />
</View>
<MyText
style={[
tw`text-[9px] font-bold mt-1`,
{ color: reached && !cancelled ? activeColor : '#94A3B8' },
]}
>
{label}
</MyText>
</View>
);
})}
</View>
);
}

View file

@ -30,6 +30,167 @@ import { useGetCart, useUpdateCartItem, useRemoveFromCart } from '@/hooks/cart-q
import { useGetEssentialConsts } from '@/src/hooks/prominent-api-hooks';
import type { FlashDeliveryProps } from '@packages/shared';
const formatDeliverySlot = (deliveryTime: string): string => {
const time = dayjs(deliveryTime);
const endTime = time.add(1, 'hour');
const startPeriod = time.format('A');
const endPeriod = endTime.format('A');
const range = startPeriod === endPeriod
? `${time.format('h')}-${endTime.format('h')} ${startPeriod}`
: `${time.format('h:mm')} ${startPeriod} - ${endTime.format('h:mm')} ${endPeriod}`;
return `${time.format('ddd, DD MMM ')}${range}`;
};
interface DeliverySlotGroupItem {
id: number;
name: string;
quantity: number;
unitNotation?: string;
image?: string;
}
interface DeliverySlotGroup {
slotId: number;
label: string;
items: DeliverySlotGroupItem[];
}
interface DeliverySlotMergeSuggestion {
slotId: number;
label: string;
feasible: boolean;
}
function DeliverySlotSummary({
groups,
mergeSuggestion,
onMerge,
}: {
groups: DeliverySlotGroup[];
mergeSuggestion?: DeliverySlotMergeSuggestion | null;
onMerge?: () => void;
}) {
const [openGroup, setOpenGroup] = useState<DeliverySlotGroup | null>(null);
if (groups.length === 0) return null;
return (
<View
testID="delivery-slot-summary"
style={tw`bg-white rounded-2xl shadow-sm mb-4 border border-gray-100 overflow-hidden`}
>
<View style={tw`bg-gray-50 px-4 py-3 border-b border-gray-100`}>
<MyText style={tw`text-gray-900 font-bold text-base`}>Delivery Slot</MyText>
</View>
<View style={tw`p-4`}>
{groups.map((group, index) => (
<View
key={group.slotId}
style={[
tw`flex-row items-center justify-between py-2.5`,
index > 0 ? tw`border-t border-gray-100` : {},
]}
>
<View style={tw`flex-row items-center flex-1 mr-3`}>
<MaterialIcons name="schedule" size={16} color="#6B7280" style={tw`mr-2`} />
<MyText style={tw`text-sm text-gray-700 flex-1`}>{group.label}</MyText>
</View>
<MyTouchableOpacity
testID={`delivery-slot-items-${group.slotId}`}
style={tw`flex-row items-center`}
onPress={() => setOpenGroup(group)}
activeOpacity={0.7}
>
<MyText style={tw`text-sm font-medium text-brand500`}>
{group.items.length} {group.items.length === 1 ? 'item' : 'items'}
</MyText>
<MaterialIcons name="chevron-right" size={18} color="#1570EF" />
</MyTouchableOpacity>
</View>
))}
{!!mergeSuggestion && (
<View
testID="delivery-slot-merge"
style={[
tw`mt-3 flex-row items-center justify-between rounded-xl px-3 py-2.5 border`,
mergeSuggestion.feasible
? tw`bg-brand50 border-brand200`
: tw`bg-gray-50 border-gray-200`,
]}
>
<View style={tw`flex-row items-center flex-1 mr-2`}>
<MaterialIcons
name="merge-type"
size={16}
color={mergeSuggestion.feasible ? '#1570EF' : '#9CA3AF'}
/>
<MyText
style={[
tw`text-sm ml-2 flex-1`,
mergeSuggestion.feasible ? tw`font-medium text-brand700` : tw`text-gray-500`,
]}
>
Deliver All items at {mergeSuggestion.label}
</MyText>
</View>
{mergeSuggestion.feasible && (
<MyTouchableOpacity
testID="delivery-slot-merge-apply"
onPress={onMerge}
activeOpacity={0.7}
style={tw`p-1`}
>
<MaterialIcons name="chevron-right" size={20} color="#1570EF" />
</MyTouchableOpacity>
)}
</View>
)}
</View>
<BottomDialog open={!!openGroup} onClose={() => setOpenGroup(null)}>
<View style={tw`p-6`}>
<View style={tw`flex-row items-start justify-between mb-4`}>
<View style={tw`flex-1 mr-3`}>
<MyText style={tw`text-lg font-bold text-gray-900`}>Items</MyText>
<MyText style={tw`text-xs text-gray-500 mt-0.5`}>{openGroup?.label}</MyText>
</View>
<MyTouchableOpacity onPress={() => setOpenGroup(null)} style={tw`p-1`}>
<MaterialIcons name="close" size={22} color="#9CA3AF" />
</MyTouchableOpacity>
</View>
{openGroup?.items.map((item) => (
<View
key={item.id}
style={tw`flex-row items-center py-3 border-b border-gray-50`}
>
<Image
source={{ uri: item.image }}
style={tw`w-10 h-10 rounded-lg bg-gray-100 mr-3`}
/>
<View style={tw`flex-1`}>
<MyText style={tw`text-sm text-gray-900`} numberOfLines={1}>
{item.name}
</MyText>
{!!item.unitNotation && (
<MyText style={tw`text-xs text-gray-500 mt-0.5`}>
{item.unitNotation}
</MyText>
)}
</View>
<MyText style={tw`text-sm font-bold text-gray-900`}>x{item.quantity}</MyText>
</View>
))}
</View>
</BottomDialog>
</View>
);
}
export default function CartPage({ isFlashDelivery = false }: FlashDeliveryProps) {
// Hide tabs when cart page is active
useHideTabNav();
@ -297,6 +458,82 @@ export default function CartPage({ isFlashDelivery = false }: FlashDeliveryProps
const hasAvailableItems = cartItems.some(item => !productSlotsMap[item.skuId]?.isOutOfStock);
const slotGroups = useMemo<DeliverySlotGroup[]>(() => {
if (isFlashDelivery || cartItems.length === 0) return [];
const groupMap = new Map<number, DeliverySlotGroup>();
cartItems.forEach((item) => {
const slotId = selectedSlots[item.id];
if (slotId === undefined || slotId === null) return;
if (!groupMap.has(slotId)) {
let label = '';
if (slotsData) {
for (const productId of Object.keys(slotsData)) {
const slot = slotsData[Number(productId)]?.find((s) => s.id === slotId);
if (slot) {
label = formatDeliverySlot(slot.deliveryTime);
break;
}
}
}
groupMap.set(slotId, { slotId, label, items: [] });
}
const product = productsById[item.skuId];
groupMap.get(slotId)!.items.push({
id: item.id,
name: product?.name || 'Item',
quantity: quantities[item.id] || item.quantity,
unitNotation: product?.unitNotation,
image: product?.images?.[0],
});
});
return Array.from(groupMap.values()).sort((a, b) => a.slotId - b.slotId);
}, [isFlashDelivery, cartItems, selectedSlots, slotsData, productsById, quantities]);
const mergeSuggestion = useMemo<DeliverySlotMergeSuggestion | null>(() => {
if (isFlashDelivery || slotGroups.length === 0) return null;
// slotGroups is sorted by slot id, so ties keep the lowest id.
const majority = slotGroups.reduce((best, group) =>
group.items.length > best.items.length ? group : best
);
const inStockItems = cartItems.filter(
(item) => !productSlotsMap[item.skuId]?.isOutOfStock
);
const now = dayjs();
const feasible =
slotGroups.length > 1 &&
inStockItems.length > 0 &&
inStockItems.every((item) =>
(slotsData?.[item.skuId] || []).some(
(slot) =>
slot.id === majority.slotId &&
dayjs(slot.deliveryTime).isAfter(now)
)
);
return { slotId: majority.slotId, label: majority.label, feasible };
}, [isFlashDelivery, slotGroups, cartItems, productSlotsMap, slotsData]);
const handleMergeSlots = () => {
if (!mergeSuggestion) return;
setSelectedSlots((prev) => {
const next = { ...prev };
cartItems.forEach((item) => {
if (!productSlotsMap[item.skuId]?.isOutOfStock) {
next[item.id] = mergeSuggestion.slotId;
}
});
return next;
});
};
useEffect(() => {
const initial: Record<number, number> = {};
cartItems.forEach((item) => {
@ -863,6 +1100,15 @@ export default function CartPage({ isFlashDelivery = false }: FlashDeliveryProps
</View>
)}
{/* Delivery Slot Summary */}
{!isFlashDelivery && cartItems.length > 0 && (
<DeliverySlotSummary
groups={slotGroups}
mergeSuggestion={mergeSuggestion}
onMerge={handleMergeSlots}
/>
)}
{/* Bottom Checkout Bar - Now Static */}
{hasAvailableItems && (
<View style={tw`bg-white mt-4 rounded-2xl shadow-sm border border-gray-100 overflow-hidden mb-6`}>

View file

@ -90,8 +90,10 @@ describe('NextOrderGlimpse', () => {
expect(screen.getByText('#ORD-1001')).toBeVisible()
expect(screen.getByText('2 items • ₹500')).toBeVisible()
// deliveryStatus 'pending' is shown user-facing as "Confirmed".
expect(screen.getByText('Confirmed')).toBeVisible()
// The status pill is hidden for Confirmed/Packaged; the tracker shows the stage.
expect(screen.getByTestId('order-status-tracker')).toBeVisible()
expect(screen.getByText('Placed')).toBeVisible()
expect(screen.queryByText('Confirmed')).toBeNull()
})
it('flags a flash order', async () => {
@ -100,7 +102,8 @@ describe('NextOrderGlimpse', () => {
await renderLoadedHome()
await waitFor(() => expect(screen.getByText('FLASH')).toBeVisible())
expect(screen.getByText('30-Min Delivery')).toBeVisible()
expect(screen.getByText('30-Min')).toBeVisible()
expect(screen.getByText('Delivery')).toBeVisible()
})
it('ignores cancelled and completed orders', async () => {

View file

@ -21,7 +21,9 @@ import { routerMock } from '../mocks/router'
import { renderWithProviders } from '../helpers/render'
const PRODUCT_ID = 2 // Chicken Breast 500 g, price 215 (in stock, in a slot)
const OTHER_PRODUCT_ID = 40 // Chicken regular cut Large pieces (in stock)
const SLOT_ID = 1849
const OTHER_SLOT_ID = 1850
const futureSlot = () => ({
id: SLOT_ID,
@ -29,6 +31,12 @@ const futureSlot = () => ({
freezeTime: dayjs().add(2, 'hour').toISOString(),
})
const otherFutureSlot = () => ({
id: OTHER_SLOT_ID,
deliveryTime: dayjs().add(5, 'hour').toISOString(),
freezeTime: dayjs().add(4, 'hour').toISOString(),
})
async function seedCart(items: unknown[]) {
await StorageServiceCasual.setItem('cart_items', JSON.stringify(items))
}
@ -117,6 +125,70 @@ describe('Cart screen', () => {
)
})
it('shows a pressable merge banner when every item can use the majority slot', async () => {
setupApiMocks({
procedures: {
'user.cart.getCartSlots': {
[PRODUCT_ID]: [futureSlot(), otherFutureSlot()],
},
},
})
await seedCart([
cartItem({ id: 1, slotId: SLOT_ID }),
cartItem({ id: 2, slotId: OTHER_SLOT_ID }),
])
renderWithProviders(<CartPage />)
await waitFor(() =>
expect(screen.getAllByText('Chicken Breast 500 g').length).toBeGreaterThan(0)
)
await waitFor(() => expect(screen.getByTestId('delivery-slot-merge')).toBeVisible())
expect(screen.getByText(/Deliver All items at/)).toBeVisible()
expect(screen.getByTestId('delivery-slot-merge-apply')).toBeVisible()
fireEvent.press(screen.getByTestId('delivery-slot-merge-apply'))
// Merging onto one slot keeps the banner but removes the apply button.
await waitFor(() => expect(screen.queryByTestId('delivery-slot-merge-apply')).toBeNull())
expect(screen.getByTestId('delivery-slot-merge')).toBeVisible()
})
it('shows the merge banner without the apply button when one item cannot use the majority slot', async () => {
setupApiMocks({
procedures: {
'user.cart.getCartSlots': {
[PRODUCT_ID]: [futureSlot(), otherFutureSlot()],
[OTHER_PRODUCT_ID]: [otherFutureSlot()],
},
},
})
// Majority (lowest id) is SLOT_ID, which OTHER_PRODUCT_ID cannot use.
await seedCart([
cartItem({ id: 1, slotId: SLOT_ID }),
cartItem({ id: 2, skuId: OTHER_PRODUCT_ID, slotId: OTHER_SLOT_ID }),
])
renderWithProviders(<CartPage />)
await waitFor(() => expect(screen.getByTestId('delivery-slot-merge')).toBeVisible())
expect(screen.getByText(/Deliver All items at/)).toBeVisible()
expect(screen.queryByTestId('delivery-slot-merge-apply')).toBeNull()
})
it('shows the merge banner without the apply button when only one slot is selected', async () => {
setupApiMocks({
procedures: { 'user.cart.getCartSlots': { [PRODUCT_ID]: [futureSlot()] } },
})
await seedCart([cartItem()])
renderWithProviders(<CartPage />)
await waitFor(() => expect(screen.getByText('Chicken Breast 500 g')).toBeVisible())
await waitFor(() => expect(screen.getByTestId('delivery-slot-merge')).toBeVisible())
expect(screen.getByText(/Deliver All items at/)).toBeVisible()
expect(screen.queryByTestId('delivery-slot-merge-apply')).toBeNull()
})
it('renders the flash cart variant without slot selection', async () => {
setupApiMocks()
await StorageServiceCasual.setItem(

View file

@ -3610,3 +3610,114 @@ longer exports it.
Pre-existing regression surfaced while running the suite after the BASE_API_URL
move; the dashboard-hub tests expect 'Manage Orders'. Unrelated to the URL change.
[2026-10-02 00:28:44] user-ui: floating cart bar 'Go to Cart' button -> stacked 'Go to' / 'Cart'.
apps/user-ui/components/floating-cart-bar.tsx, collapsed-view button only:
-<MyText style={[tw`font-bold text-sm`, { color: cartBarColor }]}>Go to Cart</MyText>
+<View style={tw`items-center`}>
+ <MyText style={[tw`font-bold text-sm`, { color: cartBarColor }]}>Go to</MyText>
+ <MyText style={[tw`font-bold text-sm`, { color: cartBarColor }]}>Cart</MyText>
+</View>
[2026-10-02 00:31:53] user-ui: add WhatsApp contact button beside the floating cart bar.
apps/user-ui/components/floating-cart-bar.tsx
- wrap the collapsed bar in a flex-row; cart bar becomes flex-1 and a compact
green WhatsApp button sits to its right (ml-2), splitting the width.
- the button opens whatsapp://send?phone=<supportMobile from common.essentialConsts>,
normalising to a 10-digit number + '91' country code. Hidden when supportMobile
is empty or while the bar is expanded.
- imports: MaterialCommunityIcons (whatsapp glyph), expo-linking (openURL).
[2026-10-02 00:33:24] user-ui: floating cart bar WhatsApp button -> icon only (drop 'Chat' label).
[2026-10-02 00:36:40] user-ui: remove the WhatsApp support button from floating-cart-bar.
Reverts the split-row addition: cart bar back to full width; drops the
expo-linking / MaterialCommunityIcons imports, supportMobile handler and flex wrapper.
[2026-10-02 01:08:09] user-ui: NextOrderGlimpse - hide the status badge for Confirmed/Packaged.
OrderCard now computes statusLabel = orderStatusManipulator(deliveryStatus) and
omits the white status pill when the label is 'confirmed' or 'packaged'.
[2026-10-02 01:09:18] user-ui: NextOrderGlimpse - move delivery time into the top-right (status spot).
OrderCard: hoisted the delivery-time string into `deliveryTimeText`; the top row's
right column now shows the schedule/bolt + time (status pill, when visible, sits
under it). Removed the standalone delivery-time row below the header.
[2026-10-02 01:10:07] user-ui: NextOrderGlimpse - restyle the top-right delivery time as a 2-row pill.
Split deliveryTimeText into deliveryDateLabel (row 1: 'DD MMM' / '30-Min') and
deliveryTimeLabel (row 2: 'hh:mm A - hh:mm A' / 'Delivery'); wrapped in a white
rounded-2xl amber-border pill with the schedule/bolt icon.
[2026-10-02 01:12:05] user-ui: home - move NextOrderGlimpse above the tag tab strip.
app/(drawer)/(tabs)/home/index.tsx ListHeader: NextOrderGlimpse removed from the
white stores/slots section and rendered first, before <TagTabStrip>.
[2026-10-02 01:13:17] user-ui: NextOrderGlimpse - give the delivery TIME more emphasis than the date.
Swapped the pill labels so the primary line is the time range ('hh:mm A - hh:mm A',
or '30-Min' for flash) and the secondary line is the date ('DD MMM', or 'Delivery').
Primary: text-[13px] font-black text-amber-900; secondary: text-[9px] font-semibold text-amber-500.
[2026-10-02 01:14:27] user-ui: NextOrderGlimpse - don't repeat AM/PM when both times share the period.
Time range now renders '06:00 - 07:00 PM' when start/end period match, and
'11:00 AM - 12:00 PM' when they differ.
[2026-10-02 01:15:44] user-ui: NextOrderGlimpse - remove the 'Track Order' row; whole card already navigates.
Dropped the bordered item-thumbnails / 'Track Order' / chevron block. The card's
outer TouchableOpacity (onPress -> order detail) already covers the entire card.
Removed now-unused Ionicons and expo-image Image imports.
[2026-10-02 01:18:56] user-ui: add OrderStatusTracker (3 dots: Placed / Packed / Delivered).
New components/OrderStatusTracker.tsx:
- export deliveryStageIndex(deliveryStatus): pending/processing->0, packaged->1,
success/delivered->2, else 0.
- default export OrderStatusTracker { deliveryStatus, activeColor='#10B981', inactiveColor='#E2E8F0' };
renders 3 dots joined by lines with labels; reached stages filled (activeColor),
later stages muted; cancelled -> all muted.
Rendered in:
- components/NextOrderGlimpse.tsx (OrderCard, amber palette)
- app/(drawer)/(tabs)/me/my-orders/[id].tsx (new 'Order Status' card)
Tests: updated stale next-order-glimpse assertions (status pill hidden; flash label split).
[2026-10-02 01:21:25] user-ui: NextOrderGlimpse - add a top-right chevron indicating the card opens details.
Header row right side now holds the FLASH badge (when present) plus a
chevron-right (MaterialIcons, #B45309) as the tap affordance.
[2026-10-02 01:26:11] user-ui: cart-page - add a DeliverySlotSummary card before the checkout bar.
components/cart-page.tsx:
- new in-file component DeliverySlotSummary { groups }: 'Delivery Slot' card
listing each selected slot with its time label and a clickable 'n items';
tapping opens a BottomDialog listing that slot's items (image, name, unit, qty).
- formatDeliverySlot() helper; slotGroups useMemo groups cart lines by
selectedSlots[item.id] (non-flash only).
- rendered above the Bottom Checkout Bar (which holds Shop More / Checkout).
[2026-10-02 01:33:44] user-ui: cart-page - 'Deliver All items at <slot>' merge suggestion.
components/cart-page.tsx:
- DeliverySlotSummary gains mergeSuggestion + onMerge props; below the rows it
always shows 'Deliver All items at <label>' when >1 distinct slots are selected.
Feasible -> pressable row with chevron (merges all in-stock items onto that slot);
infeasible -> plain muted row, no button.
- mergeSuggestion useMemo picks the majority item-count selected slot
(tie-break lowest slot id) and flags feasible when every in-stock item can use it.
- handleMerge sets selectedSlots for all in-stock items.
Tests: added merge-banner cases in tests/screens/cart-screen.test.tsx (not run).
[2026-10-02 01:36:43] user-ui: cart-page - show merge banner even with a single slot (no button).
mergeSuggestion now returns whenever >=1 slot is selected (not only >1); `feasible`
(the apply button) additionally requires >1 distinct slots and a slot every item
can use. Single-slot -> muted banner, no button.

View file

@ -40,31 +40,6 @@ import { InfoDialog } from "./src/components/info-dialog";
import { updateStatusBarColor, useStatusBarStore } from "./src/lib/status-bar-store";
const isDevMode = Constants.executionEnvironment !== "standalone";
// const localhost =
// Platform.OS === "android"
// ? "http://10.0.2.2:4000" // Android emulator
// : "http://localhost:4000"; // iOS simulator / web dev
// const production = "https://technocracy.ovh/mf";
// // const production = "http://10.0.2.2:4000";
// // const production = "http://192.168.1.3:4000";
// const API_URL =
// Constants.executionEnvironment === "standalone" ? production : localhost;
// const BASE_API_URL = API_URL;
// const BASE_API_URL = 'http://10.0.2.2:4000';
// const BASE_API_URL = 'http://192.168.100.101:4000';
// const BASE_API_URL = 'http://192.168.1.5:8787';
// const BASE_API_URL = 'http://192.168.100.109:8787';
// let BASE_API_URL = "https://raw.freshyo.in";
let BASE_API_URL = "https://worker.freshyo.in";
// let BASE_API_URL = "https://devapi.freshyo.in";
// let BASE_API_URL = 'http://192.168.100.120:8787';
// let BASE_API_URL = 'http://192.168.29.176:4000';
// if(isDevMode) {
// }
export {
StorageService,
@ -101,7 +76,6 @@ export {
useFocusCallback,
useManualRefresh,
useDrawerTitle,
BASE_API_URL,
useMarkDataFetchers,
StorageServiceCasual,
REFUND_STATUS,