diff --git a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml index 4f0ec579c..68f44b232 100644 --- a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml +++ b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml @@ -3,6 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Bit.App.Pages.GroupingsPage" xmlns:pages="clr-namespace:Bit.App.Pages" + xmlns:u="clr-namespace:Bit.App.Utilities" xmlns:controls="clr-namespace:Bit.App.Controls" x:DataType="pages:GroupingsPageViewModel" Title="{Binding PageTitle}"> @@ -60,9 +61,23 @@ CollectionTemplate="{StaticResource collectionTemplate}" /> - + + + + + _allCiphers; private readonly ICipherService _cipherService; @@ -32,6 +36,7 @@ namespace Bit.App.Pages PageTitle = AppResources.MyVault; GroupedItems = new ExtendedObservableCollection(); LoadCommand = new Command(async () => await LoadAsync()); + AddCipherCommand = new Command(() => { /* TODO */ }); } public bool ShowFavorites { get; set; } = true; @@ -58,17 +63,40 @@ namespace Bit.App.Pages public bool Loaded { get => _loaded; - set - { - SetProperty(ref _loaded, value); - SetProperty(ref _loading, !value); - } + set => SetProperty(ref _loaded, value); + } + public bool ShowAddCipherButton + { + get => _showAddCipherButton; + set => SetProperty(ref _showAddCipherButton, value); + } + public bool ShowNoData + { + get => _showNoData; + set => SetProperty(ref _showNoData, value); + } + public string NoDataText + { + get => _noDataText; + set => SetProperty(ref _noDataText, value); + } + public bool ShowList + { + get => _showList; + set => SetProperty(ref _showList, value); } public ExtendedObservableCollection GroupedItems { get; set; } public Command LoadCommand { get; set; } + public Command AddCipherCommand { get; set; } public async Task LoadAsync() { + ShowNoData = false; + Loading = true; + ShowList = false; + ShowAddCipherButton = true; + var groupedItems = new List(); + try { await LoadDataAsync(); @@ -79,7 +107,6 @@ namespace Bit.App.Pages var collectionListItems = NestedCollections?.Select(c => new GroupingsPageListItem { Collection = c.Node }).ToList(); - var groupedItems = new List(); if(favListItems?.Any() ?? false) { groupedItems.Add(new GroupingsPageListGroup(favListItems, AppResources.Favorites, @@ -104,7 +131,10 @@ namespace Bit.App.Pages } finally { + ShowNoData = !groupedItems.Any(); + ShowList = !ShowNoData; Loaded = true; + Loading = false; } } @@ -152,6 +182,7 @@ namespace Bit.App.Pages private async Task LoadDataAsync() { + NoDataText = AppResources.NoItems; _allCiphers = await _cipherService.GetAllDecryptedAsync(); if(MainPage) { @@ -195,6 +226,7 @@ namespace Bit.App.Pages } else if(FolderId != null) { + NoDataText = AppResources.NoItemsFolder; FolderId = FolderId == "none" ? null : FolderId; if(FolderId != null) { @@ -213,6 +245,8 @@ namespace Bit.App.Pages } else if(CollectionId != null) { + ShowAddCipherButton = false; + NoDataText = AppResources.NoItemsCollection; var collectionNode = await _collectionService.GetNestedAsync(CollectionId); if(collectionNode?.Node != null) {