Skip to content

Commit

Permalink
Include issue lists and homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
Strypper committed Mar 23, 2024
1 parent b6afa88 commit ee712b0
Show file tree
Hide file tree
Showing 34 changed files with 4,834 additions and 2,108 deletions.
4 changes: 2 additions & 2 deletions src/Presentations/Windows/AppShell.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
ContentTemplate="{DataTemplate app:HomePage}"
Icon="{x:StaticResource HomeIcon}"
Route="homePage" />
<ShellContent
<!--<ShellContent
Title="Chat"
ContentTemplate="{DataTemplate app:ChatPage}"
Icon="{x:StaticResource ChatIcon}"
Route="chatPage" />
Route="chatPage" />-->
<ShellContent
Title="Gallery"
ContentTemplate="{DataTemplate app:GalleryPage}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ async Task RefreshAsync()
}
#endregion


#region [ Methods ]

async Task RefreshControlIssues(bool forced)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public SliderPageViewModel(IAppNavigator appNavigator,
#region [ Properties ]

[ObservableProperty]
string emptyViewText = "No issues found for this control";
string emptyViewText = "Fetching issues";

[ObservableProperty]
string gitHubAPIRateLimit = "https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28";
Expand Down Expand Up @@ -85,7 +85,6 @@ async Task RefreshAsync()
}
#endregion


#region [ Methods ]

async Task RefreshControlIssues(bool forced)
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,21 +1,45 @@
namespace MAUIsland;
using MAUIsland.GitHubFeatures;

namespace MAUIsland;

public partial class StepperPageViewModel : NavigationAwareBaseViewModel
{
#region [CTor]
public StepperPageViewModel(IAppNavigator appNavigator)
#region [ Fields ]

private readonly IGitHubService gitHubService;
#endregion

#region [ CTor ]
public StepperPageViewModel(IAppNavigator appNavigator,
IGitHubService gitHubService)
: base(appNavigator)
{

this.gitHubService = gitHubService;
}
#endregion

#region [Properties]
#region [ Properties ]

[ObservableProperty]
string emptyViewText = "No issues found for this control";

[ObservableProperty]
IGalleryCardInfo controlInformation;
string gitHubAPIRateLimit = "https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28";

[ObservableProperty]
string xamlStandardStepper =
IBuiltInGalleryCardInfo controlInformation;

[ObservableProperty]
bool isBusy;

[ObservableProperty]
ObservableCollection<ControlIssueModel> controlIssues;

[ObservableProperty]
ControlIssueModel selectedControlIssue;

[ObservableProperty]
string xamlStandardStepper =
"<StackLayout Margin=\"20\">\r\n" +
" <Label x:Name=\"RotatingLabel\"\r\n" +
" Text=\"ROTATING TEXT\"\r\n" +
Expand Down Expand Up @@ -60,19 +84,80 @@ public StepperPageViewModel(IAppNavigator appNavigator)

#endregion

#region [Overrides]
#region [ Overrides ]
protected override void OnInit(IDictionary<string, object> query)
{
base.OnInit(query);

ControlInformation = query.GetData<IGalleryCardInfo>();
ControlInformation = query.GetData<IBuiltInGalleryCardInfo>();

}

public override async Task OnAppearingAsync()
{
await base.OnAppearingAsync();
await RefreshAsync();
}
#endregion

#region [Relay Commands]
#region [ Relay Commands ]

[RelayCommand]
Task OpenUrlAsync(string url)
=> AppNavigator.OpenUrlAsync(url);

[RelayCommand]
async Task RefreshAsync()
{
await RefreshControlIssues(true);
}
#endregion

#region [ Methods ]

async Task RefreshControlIssues(bool forced)
{
if (IsBusy)
return;

IsBusy = true;

var result = await gitHubService.GetGitHubIssuesByLabels(ControlInformation.GitHubAuthorIssueName,
ControlInformation.GitHubRepositoryIssueName,
ControlInformation.GitHubIssueLabels);

IsBusy = false;

if (result.IsT0) // Check if result is ServiceSuccess
{
var items = result.AsT0.AttachedData as IEnumerable<GitHubIssueModel>;

if (ControlIssues is null || forced)
{
ControlIssues = new(items.Select(x => new ControlIssueModel()
{
IssueId = x.Id,
Title = x.Title,
IssueLinkUrl = x.HtmlUrl,
MileStone = x.Milestone is null ? "No mile stone" : x.Milestone.Title,
OwnerName = x.User.Login,
AvatarUrl = x.User.AvatarUrl,
CreatedDate = x.CreatedAt.DateTime,
LastUpdated = x.UpdatedAt is null ? x.CreatedAt.DateTime : x.UpdatedAt.Value.DateTime
}));
}
}
else
{
var error = result.AsT1;
EmptyViewText = error.ErrorDetail;
await AppNavigator.ShowSnackbarAsync(error.ErrorDetail,
async () =>
{
await AppNavigator.OpenUrlAsync(GitHubAPIRateLimit);
},
"Visit GitHub API Rate Limits Policies");
}
}
#endregion
}
Loading

0 comments on commit ee712b0

Please sign in to comment.