Skip to content

Commit

Permalink
added empty state in token page (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
LiorAgnin authored Sep 15, 2020
1 parent 1a19f8e commit 6d8ba15
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 21 deletions.
Binary file added assets/images/no-activity.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,8 @@
"selected": "Selected",
"fee_amount": "Fee amount:",
"total_amount": "Total amount:",
"pay_with": "Pay with"
"pay_with": "Pay with",
"transaction_failed": "Transaction failed",
"something_went_wrong": "Something went wrong",
"no_activity": "No activity"
}
6 changes: 6 additions & 0 deletions lib/generated/i18n.dart
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,12 @@ class I18n implements WidgetsLocalizations {
String get total_amount => "Total amount:";
/// "Pay with"
String get pay_with => "Pay with";
/// "Transaction failed"
String get transaction_failed => "Transaction failed";
/// "Something went wrong"
String get something_went_wrong => "Something went wrong";
/// "No activity"
String get no_activity => "No activity";
}

class _I18n_en_US extends I18n {
Expand Down
19 changes: 5 additions & 14 deletions lib/models/jobs/join_bonus_job.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ class JoinBonusJob extends Job {
@override
onDone(store, dynamic fetchedData) async {
final logger = await AppFactory().getLogger('Job');
if (isReported == true) {
logger.info('joinBonus FAILED');
store.dispatch(transactionFailed(arguments['joinBonus'], arguments['communityAddress']));
store.dispatch(segmentTrackCall('Wallet: joinBonus failed'));
store.dispatch(UpdateJob(communityAddress: arguments['communityAddress'], job: this));
return;
}
int current = DateTime.now().millisecondsSinceEpoch;
int jobTime = this.timeStart;
final int millisecondsIntoMin = 2 * 60 * 1000;
Expand Down Expand Up @@ -77,13 +70,6 @@ class JoinBonusJob extends Job {
return;
}
} else {
if (fetchedData['failReason'] != null && fetchedData['failedAt'] != null) {
logger.info('JoinBonusJob FAILED');
String failReason = fetchedData['failReason'];
store.dispatch(transactionFailed(arguments['joinBonus'], arguments['communityAddress']));
store.dispatch(segmentTrackCall('Wallet: job failed', properties: new Map<String, dynamic>.from({ 'id': id, 'failReason': failReason, 'name': name })));
return;
}
if (fetchedData['data']['funderJobId'] != null) {
String funderJobId = fetchedData['data']['funderJobId'];
dynamic response = await api.getFunderJob(funderJobId);
Expand Down Expand Up @@ -115,6 +101,11 @@ class JoinBonusJob extends Job {
store.dispatch(transactionFailed(arguments['joinBonus'], arguments['communityAddress']));
return;
}
} else {
this.status = 'FAILED';
logger.info('JoinBonusJob FAILED');
store.dispatch(UpdateJob(communityAddress: arguments['communityAddress'], job: this));
return;
}
}
}
Expand Down
33 changes: 27 additions & 6 deletions lib/screens/home/screens/token_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class TokenScreen extends StatelessWidget {
builder: (_, viewModel) {
final token = viewModel.tokens
.firstWhere((element) => element.address == tokenAddress);
final List<Transaction> list =
token?.transactions?.list?.reversed?.toList() ?? [];
return Scaffold(
key: key,
appBar: MyAppBar(
Expand All @@ -28,12 +30,31 @@ class TokenScreen extends StatelessWidget {
backgroundColor: Colors.white),
drawerEdgeDragWidth: 0,
body: Column(children: <Widget>[
Expanded(
child: ListView(children: [
TransfersList(
list:
(token?.transactions?.list?.reversed?.toList() ?? []))
])),
list.isEmpty
? Flexible(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'assets/images/no-activity.png',
fit: BoxFit.cover,
height: 100,
),
SizedBox(
height: 10,
),
Text(I18n.of(context).no_activity,
style: TextStyle(
color: Color(0xFF979797),
fontSize: 16.0,
fontWeight: FontWeight.normal))
],
),
),
)
: Expanded(
child: ListView(children: [TransfersList(list: list)])),
]));
});
}
Expand Down

0 comments on commit 6d8ba15

Please sign in to comment.