Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove info icons on order modal #2097

Merged
merged 1 commit into from
Feb 28, 2024
Merged
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
29 changes: 0 additions & 29 deletions mobile/lib/features/trade/trade_bottom_sheet_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import 'package:get_10101/common/domain/model.dart';
import 'package:get_10101/features/trade/channel_configuration.dart';
import 'package:get_10101/features/trade/domain/channel_opening_params.dart';
import 'package:get_10101/ffi.dart' as rust;
import 'package:get_10101/common/modal_bottom_sheet_info.dart';
import 'package:get_10101/common/value_data_row.dart';
import 'package:get_10101/features/trade/domain/contract_symbol.dart';
import 'package:get_10101/features/trade/domain/direction.dart';
Expand Down Expand Up @@ -189,24 +188,13 @@ class _TradeBottomSheetTabState extends State<TradeBottomSheetTab> {
}

int usableBalance = channelTradeConstraints.maxLocalMarginSats;
bool isChannelBalance = channelTradeConstraints.isChannelBalance;

// We compute the max quantity based on the margin needed for the counterparty and how much he has available.
double price = tradeValues.price ?? 0.0;
double maxQuantity = (channelTradeConstraints.maxCounterpartyMarginSats / 100000000) *
price *
channelTradeConstraints.coordinatorLeverage;

String text =
"The usable balance of ${formatSats(Amount(usableBalance))} are your on-chain funds. If you need more, you can always deposit more into you wallet. "
"\nWith your current balance, the maximum you can trade is ${formatUsd(Usd(maxQuantity.toInt()))}";
if (isChannelBalance) {
text =
"The usable balance of ${formatSats(Amount(usableBalance))} are your off-chain funds. At the moment you can't add more than this as we do not support splicing. \n"
"If you want to trade more than this, you will need to close the channel and open a bigger one. "
"\nWith your current balance, the maximum you can trade is ${formatUsd(Usd(maxQuantity.toInt()))}";
}

return Wrap(
runSpacing: 12,
children: [
Expand All @@ -217,14 +205,6 @@ class _TradeBottomSheetTabState extends State<TradeBottomSheetTab> {
const Flexible(child: Text("Balance:")),
const SizedBox(width: 5),
Flexible(child: AmountText(amount: Amount(usableBalance))),
const SizedBox(
width: 5,
),
ModalBottomSheetInfo(
closeButtonText: "Back to order",
infoButtonPadding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Text(text),
)
],
),
),
Expand Down Expand Up @@ -317,15 +297,6 @@ class _TradeBottomSheetTabState extends State<TradeBottomSheetTab> {
return AmountTextField(
value: margin,
label: "Margin (sats)",
suffixIcon: showCapacityInfo
? ModalBottomSheetInfo(
closeButtonText: "Back to order",
child: Text(
"The max amount you can trade depends on your balance, your counterparty's balance and your leverage: \n\n"
"- Your max margin is ${formatSats(Amount(usableBalance))}\n"
"- Counterparty max margin is ${formatSats(Amount(channelTradeConstraints.maxLocalMarginSats))}\n"
"- This results in a max amount of ${formatUsd(Usd(maxQuantity.toInt()))} with your current leverage of ${tradeValues.leverage.formatted()}"))
: null,
);
})),
],
Expand Down
Loading