diff --git a/lib/features/home/providers/home_order_providers.dart b/lib/features/home/providers/home_order_providers.dart index d0e7e71..8fb7bac 100644 --- a/lib/features/home/providers/home_order_providers.dart +++ b/lib/features/home/providers/home_order_providers.dart @@ -180,8 +180,11 @@ final filteredOrdersProvider = Provider>((ref) { return allOrders.where((o) { // Order book shows only pending orders. if (o.status != OrderStatus.pending) return false; - // Own orders are always shown regardless of which tab is active. - if (!o.isMine && o.kind != targetKind) return false; + // Own orders follow the same tab split as everyone else's — a sell + // order lives in BUY BTC, a buy order in SELL BTC — distinguished only + // by the "you are selling/buying" pill (issue #290). Managing them has + // its own place (My Trades / MyOrderScreen on tap). + if (o.kind != targetKind) return false; if (selectedCurrencies.isNotEmpty && !selectedCurrencies.contains(o.fiatCode)) { diff --git a/lib/features/home/widgets/order_list_item.dart b/lib/features/home/widgets/order_list_item.dart index e0d4116..5f3d956 100644 --- a/lib/features/home/widgets/order_list_item.dart +++ b/lib/features/home/widgets/order_list_item.dart @@ -114,30 +114,38 @@ class OrderListItem extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - // Row 1: reason pill (+ "yours" pill) · relative timestamp + // Row 1: reason pill (+ "yours" pill) · relative timestamp. + // Pills keep their intrinsic width and wrap to a second run + // when they don't fit beside the timestamp — shrinking them + // ellipsized the labels on small phones ("ESTÁS COMP…"). Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (reasonLabel != null) ...[ - Flexible( - child: _Pill( - label: reasonLabel, - color: reasonColor!, - background: reasonBg!, - ), + Expanded( + child: Wrap( + spacing: 6, + runSpacing: 4, + children: [ + // Own-order pill first: on an own order it must + // always be readable, so the reason badge is the + // one that drops to the next run when they don't + // fit together. + if (mineLabel != null) + _Pill( + label: mineLabel, + color: pal.textSecondary, + background: pal.bgElevated, + ), + if (reasonLabel != null) + _Pill( + label: reasonLabel, + color: reasonColor!, + background: reasonBg!, + ), + ], ), - const SizedBox(width: 6), - ], - if (mineLabel != null) ...[ - Flexible( - child: _Pill( - label: mineLabel, - color: pal.textSecondary, - background: pal.bgElevated, - ), - ), - const SizedBox(width: 6), - ], - const Spacer(), + ), + const SizedBox(width: 6), Text( _relativeTime(order.createdAt, l10n), style: TextStyle(fontSize: 11, color: pal.textTertiary), diff --git a/lib/l10n/app_es.arb b/lib/l10n/app_es.arb index ac381a4..03c0805 100644 --- a/lib/l10n/app_es.arb +++ b/lib/l10n/app_es.arb @@ -225,8 +225,8 @@ "confirmReleaseSatsButton": "Confirmar y liberar sats", "shareOrderButton": "Compartir orden", - "orderPillYouAreSelling": "USTED ESTÁ VENDIENDO", - "orderPillYouAreBuying": "USTED ESTÁ COMPRANDO", + "orderPillYouAreSelling": "ESTÁS VENDIENDO", + "orderPillYouAreBuying": "ESTÁS COMPRANDO", "orderPillSelling": "VENDIENDO", "orderPillBuying": "COMPRANDO", diff --git a/test/features/home/filtered_orders_provider_test.dart b/test/features/home/filtered_orders_provider_test.dart index 35de10d..9fb7bc4 100644 --- a/test/features/home/filtered_orders_provider_test.dart +++ b/test/features/home/filtered_orders_provider_test.dart @@ -26,13 +26,20 @@ void main() { expect(helper.ids(), ['buy']); }); - test('own orders show regardless of the active tab', () async { + test('own orders follow the same tab split as everyone else', () async { + // Issue #290: own orders used to show in both tabs, which read as + // duplication. A sell order lives in BUY BTC, a buy order in SELL + // BTC — same as third-party orders. final helper = await bookWith([ fakeOrder(id: 'mine-buy', kind: 'buy', isMine: true), - fakeOrder(id: 'other-buy', kind: 'buy'), + fakeOrder(id: 'mine-sell', kind: 'sell', isMine: true), + fakeOrder(id: 'other-sell', kind: 'sell'), ]); - helper.setTab(OrderType.buy); // buy tab targets sell orders + helper.setTab(OrderType.buy); // targets sell orders + expect(helper.ids(), ['mine-sell', 'other-sell']); + + helper.setTab(OrderType.sell); // targets buy orders expect(helper.ids(), ['mine-buy']); }); diff --git a/test/features/home/goldens/order_list_item_dark.png b/test/features/home/goldens/order_list_item_dark.png index b29d9df..9eec54b 100644 Binary files a/test/features/home/goldens/order_list_item_dark.png and b/test/features/home/goldens/order_list_item_dark.png differ diff --git a/test/features/home/goldens/order_list_item_light.png b/test/features/home/goldens/order_list_item_light.png index 6f7a828..2dd51d8 100644 Binary files a/test/features/home/goldens/order_list_item_light.png and b/test/features/home/goldens/order_list_item_light.png differ