Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/features/home/providers/home_order_providers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,11 @@ final filteredOrdersProvider = Provider<List<OrderItem>>((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)) {
Expand Down
50 changes: 29 additions & 21 deletions lib/features/home/widgets/order_list_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions lib/l10n/app_es.arb
Original file line number Diff line number Diff line change
Expand Up @@ -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",

Expand Down
13 changes: 10 additions & 3 deletions test/features/home/filtered_orders_provider_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
});

Expand Down
Binary file modified test/features/home/goldens/order_list_item_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/features/home/goldens/order_list_item_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading