diff --git a/flutter/lib/common/widgets/peer_tab_page.dart b/flutter/lib/common/widgets/peer_tab_page.dart index 869bd5fd9..52bdc8cc6 100644 --- a/flutter/lib/common/widgets/peer_tab_page.dart +++ b/flutter/lib/common/widgets/peer_tab_page.dart @@ -167,7 +167,7 @@ class _PeerTabPageState extends State color: model.currentTab == t ? Theme.of(context).colorScheme.background : null, - borderRadius: BorderRadius.circular(isDesktop ? 2 : 6), + borderRadius: BorderRadius.circular(6), ), child: Align( alignment: Alignment.center, diff --git a/flutter/lib/common/widgets/peers_view.dart b/flutter/lib/common/widgets/peers_view.dart index 71cd5d999..43f65b4b4 100644 --- a/flutter/lib/common/widgets/peers_view.dart +++ b/flutter/lib/common/widgets/peers_view.dart @@ -1,8 +1,8 @@ import 'dart:async'; +import 'dart:collection'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_hbb/consts.dart'; import 'package:get/get.dart'; import 'package:provider/provider.dart'; import 'package:visibility_detector/visibility_detector.dart'; @@ -30,6 +30,13 @@ class PeerSortType { ]; } +class LoadEvent { + static const String recent = 'load_recent_peers'; + static const String favorite = 'load_fav_peers'; + static const String lan = 'load_lan_peers'; + static const String addressBook = 'load_address_book_peers'; +} + /// for peer search text, global obs value final peerSearchText = "".obs; @@ -61,6 +68,12 @@ class _PeersView extends StatefulWidget { /// State for the peer widget. class _PeersViewState extends State<_PeersView> with WindowListener { static const int _maxQueryCount = 3; + final HashMap _emptyMessages = HashMap.from({ + LoadEvent.recent: 'empty_recent_tip', + LoadEvent.favorite: 'empty_favorite_tip', + LoadEvent.lan: 'empty_lan_tip', + LoadEvent.addressBook: 'empty_address_book_tip', + }); final space = isDesktop ? 12.0 : 8.0; final _curPeers = {}; var _lastChangeTime = DateTime.now(); @@ -112,12 +125,30 @@ class _PeersViewState extends State<_PeersView> with WindowListener { return ChangeNotifierProvider( create: (context) => widget.peers, child: Consumer( - builder: (context, peers, child) => peers.peers.isEmpty - ? Container( - margin: EdgeInsets.only(top: kEmptyMarginTop), - alignment: Alignment.topCenter, - child: Text(translate("Empty"))) - : _buildPeersView(peers)), + builder: (context, peers, child) => peers.peers.isEmpty + ? Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.sentiment_very_dissatisfied_rounded, + color: Theme.of(context).tabBarTheme.labelColor, + size: 40, + ).paddingOnly(bottom: 10), + Text( + translate( + _emptyMessages[widget.peers.loadEvent] ?? 'Empty', + ), + textAlign: TextAlign.center, + style: TextStyle( + color: Theme.of(context).tabBarTheme.labelColor, + ), + ), + ], + ), + ) + : _buildPeersView(peers), + ), ); } @@ -221,7 +252,7 @@ class _PeersViewState extends State<_PeersView> with WindowListener { ); } - if (widget.peers.loadEvent != 'load_recent_peers') { + if (widget.peers.loadEvent != LoadEvent.recent) { switch (sortedBy) { case PeerSortType.remoteId: peers.sort((p1, p2) => p1.getId().compareTo(p2.getId())); @@ -289,7 +320,7 @@ class RecentPeersView extends BasePeersView { : super( key: key, name: 'recent peer', - loadEvent: 'load_recent_peers', + loadEvent: LoadEvent.recent, peerCardBuilder: (Peer peer) => RecentPeerCard( peer: peer, menuPadding: menuPadding, @@ -311,7 +342,7 @@ class FavoritePeersView extends BasePeersView { : super( key: key, name: 'favorite peer', - loadEvent: 'load_fav_peers', + loadEvent: LoadEvent.favorite, peerCardBuilder: (Peer peer) => FavoritePeerCard( peer: peer, menuPadding: menuPadding, @@ -333,7 +364,7 @@ class DiscoveredPeersView extends BasePeersView { : super( key: key, name: 'discovered peer', - loadEvent: 'load_lan_peers', + loadEvent: LoadEvent.lan, peerCardBuilder: (Peer peer) => DiscoveredPeerCard( peer: peer, menuPadding: menuPadding, @@ -358,7 +389,7 @@ class AddressBookPeersView extends BasePeersView { : super( key: key, name: 'address book peer', - loadEvent: 'load_address_book_peers', + loadEvent: LoadEvent.addressBook, peerFilter: (Peer peer) => _hitTag(gFFI.abModel.selectedTags, peer.tags), peerCardBuilder: (Peer peer) => AddressBookPeerCard( diff --git a/src/lang/ca.rs b/src/lang/ca.rs index 297bfdc35..68f46438c 100644 --- a/src/lang/ca.rs +++ b/src/lang/ca.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/cn.rs b/src/lang/cn.rs index b92a33eea..a04bd7c04 100644 --- a/src/lang/cn.rs +++ b/src/lang/cn.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/cs.rs b/src/lang/cs.rs index 49c286d9c..6e7ae7172 100644 --- a/src/lang/cs.rs +++ b/src/lang/cs.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/da.rs b/src/lang/da.rs index 401601e2b..a5aad7929 100644 --- a/src/lang/da.rs +++ b/src/lang/da.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/de.rs b/src/lang/de.rs index 6c2c06e45..13d17c833 100644 --- a/src/lang/de.rs +++ b/src/lang/de.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", "Minimieren"), ("Maximize", "Maximieren"), ("Your Device", "Ihr Gerät"), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/el.rs b/src/lang/el.rs index c569c8a6e..0e7a3e5ae 100644 --- a/src/lang/el.rs +++ b/src/lang/el.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/en.rs b/src/lang/en.rs index 7107c1865..b5d4d8b25 100644 --- a/src/lang/en.rs +++ b/src/lang/en.rs @@ -46,6 +46,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("relay_hint_tip", "It may not be possible to connect directly, you can try to connect via relay. \nIn addition, if you want to use relay on your first try, you can add the \"/r\" suffix to the ID, or select the option \"Always connect via relay\" in the peer card."), ("No transfers in progress", ""), ("idd_driver_tip", "Install virtual display driver which is used when you have no physical displays."), - ("confirm_idd_driver_tip", "The option to install the virtual display driver is checked. Note that a test certificate will be installed to trust the virtual display driver. This test certificate will only be used to trust Rustdesk drivers.") + ("confirm_idd_driver_tip", "The option to install the virtual display driver is checked. Note that a test certificate will be installed to trust the virtual display driver. This test certificate will only be used to trust Rustdesk drivers."), + ("empty_recent_tip", "Oops, no recent sessions!\nTime to plan a new one."), + ("empty_favorite_tip", "No favorite peers yet?\nLet's find someone to connect with and add it to your favorites!"), + ("empty_lan_tip", "Oh no, it looks like we haven't discovered any peers yet."), + ("empty_address_book_tip", "Oh dear, it appears that there are currently no peers listed in your address book."), ].iter().cloned().collect(); } diff --git a/src/lang/eo.rs b/src/lang/eo.rs index fb9ab4dd4..5f5934012 100644 --- a/src/lang/eo.rs +++ b/src/lang/eo.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/es.rs b/src/lang/es.rs index c05f32ff1..e161e228b 100644 --- a/src/lang/es.rs +++ b/src/lang/es.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/fa.rs b/src/lang/fa.rs index 63c40c851..c5d708b0d 100644 --- a/src/lang/fa.rs +++ b/src/lang/fa.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/fr.rs b/src/lang/fr.rs index ddb8ebb57..3ddb5603a 100644 --- a/src/lang/fr.rs +++ b/src/lang/fr.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/hu.rs b/src/lang/hu.rs index ba8e6e86c..11c49bd44 100644 --- a/src/lang/hu.rs +++ b/src/lang/hu.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/id.rs b/src/lang/id.rs index 8accb7519..d256259e7 100644 --- a/src/lang/id.rs +++ b/src/lang/id.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/it.rs b/src/lang/it.rs index fe265777c..9d7239352 100644 --- a/src/lang/it.rs +++ b/src/lang/it.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", "Minimizza"), ("Maximize", "Massimizza"), ("Your Device", "Il tuo dispositivo"), + ("empty_recent_tip", "Oops, non c'è nessuna sessione recente!\nTempo di pianificarne una."), + ("empty_favorite_tip", "Ancora nessun peer?\nTrova qualcuno con cui connetterti e aggiungilo ai tuoi preferiti!"), + ("empty_lan_tip", "Oh no, sembra proprio che non abbiamo ancora rilevato nessun peer."), + ("empty_address_book_tip", "Oh diamine, sembra che per ora non ci siano peer nella tua rubrica."), ].iter().cloned().collect(); } diff --git a/src/lang/ja.rs b/src/lang/ja.rs index 214f354eb..53c7cda36 100644 --- a/src/lang/ja.rs +++ b/src/lang/ja.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ko.rs b/src/lang/ko.rs index 8641abe36..d208f399f 100644 --- a/src/lang/ko.rs +++ b/src/lang/ko.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/kz.rs b/src/lang/kz.rs index 42340ba68..8505c7336 100644 --- a/src/lang/kz.rs +++ b/src/lang/kz.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/nl.rs b/src/lang/nl.rs index a0d035be5..2ae74ecb7 100644 --- a/src/lang/nl.rs +++ b/src/lang/nl.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/pl.rs b/src/lang/pl.rs index baf439a2c..3226157fb 100644 --- a/src/lang/pl.rs +++ b/src/lang/pl.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/pt_PT.rs b/src/lang/pt_PT.rs index 805f69488..7a6d0106d 100644 --- a/src/lang/pt_PT.rs +++ b/src/lang/pt_PT.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ptbr.rs b/src/lang/ptbr.rs index 6ac256634..98fd2161f 100644 --- a/src/lang/ptbr.rs +++ b/src/lang/ptbr.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ro.rs b/src/lang/ro.rs index f1734f0ea..3396dc50e 100644 --- a/src/lang/ro.rs +++ b/src/lang/ro.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ru.rs b/src/lang/ru.rs index d37bb367d..4f263ded5 100644 --- a/src/lang/ru.rs +++ b/src/lang/ru.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sk.rs b/src/lang/sk.rs index 9328f79de..ae47c809d 100644 --- a/src/lang/sk.rs +++ b/src/lang/sk.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sl.rs b/src/lang/sl.rs index 73b3579cf..fa4fc17fd 100755 --- a/src/lang/sl.rs +++ b/src/lang/sl.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sq.rs b/src/lang/sq.rs index da461da3b..27297c659 100644 --- a/src/lang/sq.rs +++ b/src/lang/sq.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sr.rs b/src/lang/sr.rs index b1aaafcf1..1bf53571c 100644 --- a/src/lang/sr.rs +++ b/src/lang/sr.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sv.rs b/src/lang/sv.rs index b49b73cb6..00abe840b 100644 --- a/src/lang/sv.rs +++ b/src/lang/sv.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/template.rs b/src/lang/template.rs index b785b0d60..9b920e6f7 100644 --- a/src/lang/template.rs +++ b/src/lang/template.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/th.rs b/src/lang/th.rs index 47eba46de..7fee731b6 100644 --- a/src/lang/th.rs +++ b/src/lang/th.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/tr.rs b/src/lang/tr.rs index 027d5de05..5f7062331 100644 --- a/src/lang/tr.rs +++ b/src/lang/tr.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/tw.rs b/src/lang/tw.rs index d342db858..84e8b822e 100644 --- a/src/lang/tw.rs +++ b/src/lang/tw.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ua.rs b/src/lang/ua.rs index 368d5d3d2..87e060eb0 100644 --- a/src/lang/ua.rs +++ b/src/lang/ua.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/vn.rs b/src/lang/vn.rs index e4df09d77..f7563b281 100644 --- a/src/lang/vn.rs +++ b/src/lang/vn.rs @@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Minimize", ""), ("Maximize", ""), ("Your Device", ""), + ("empty_recent_tip", ""), + ("empty_favorite_tip", ""), + ("empty_lan_tip", ""), + ("empty_address_book_tip", ""), ].iter().cloned().collect(); }