Skip to content

Commit

Permalink
Enhance repo filtering and UI accessibility
Browse files Browse the repository at this point in the history
- Added checkbox filters in `RepositoryFilterBar.razor` for archived, forked, and template repositories, including corresponding state variables and event handlers (`HandleArchivedChange`, `HandleForkedChange`, `HandleTemplatesChange`).
- Updated `ApplyFilters` method in `RepositoryFilterBar.razor` to incorporate filtering logic based on the new checkboxes.
- Made `readme` parameter nullable in `ReadmeModal.razor` to handle repositories without a readme file.
- Improved UI and accessibility in `RepositoryDisplay.razor` by grouping repository name, archived status, and template status within a single heading element and ensuring external links open in a new tab.
- Conducted minor styling and structural adjustments for enhanced layout and visual appeal of repository display cards.
  • Loading branch information
sametcn99 committed Jul 3, 2024
1 parent 60c2136 commit d39a7d5
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@
<div class="control is-expanded">
<input type="text" value="@searchQuery" @oninput="OnSearchQueryChanged" class="input" placeholder="Search...">
</div>
<div class="control">
<label class="checkbox">
<input type="checkbox" @onchange="HandleArchivedChange" checked="@includeArchived">
Include Archived
</label>
</div>
<div class="control">
<label class="checkbox">
<input type="checkbox" @onchange="HandleForkedChange" checked="@includeForked">
Include Forked
</label>
</div>
<div class="control">
<label class="checkbox">
<input type="checkbox" @onchange="HandleTemplatesChange" checked="@includeTemplates">
Include Templates
</label>
</div>
<div class="control">
<div class="select is-fullwidth">
<select @onchange="HandleSortChange">
Expand Down Expand Up @@ -77,6 +95,9 @@
private string selectedTopic = string.Empty;
private string selectedLanguage = string.Empty;
private string selectedLicense = string.Empty;
private bool includeArchived = true;
private bool includeForked = true;
private bool includeTemplates = true;

protected override void OnInitialized()
{
Expand Down Expand Up @@ -134,6 +155,25 @@
ApplyFilters();
}

private void HandleArchivedChange(ChangeEventArgs e)
{
includeArchived = (bool)e.Value;

Check warning on line 160 in GPVBlazor/GPVBlazor/Components/Displays/FilterDisplays/RepositoryFilterBar.razor

View workflow job for this annotation

GitHub Actions / build

Unboxing a possibly null value.

Check warning on line 160 in GPVBlazor/GPVBlazor/Components/Displays/FilterDisplays/RepositoryFilterBar.razor

View workflow job for this annotation

GitHub Actions / build

Unboxing a possibly null value.
ApplyFilters();
}

private void HandleForkedChange(ChangeEventArgs e)
{
includeForked = (bool)e.Value;

Check warning on line 166 in GPVBlazor/GPVBlazor/Components/Displays/FilterDisplays/RepositoryFilterBar.razor

View workflow job for this annotation

GitHub Actions / build

Unboxing a possibly null value.

Check warning on line 166 in GPVBlazor/GPVBlazor/Components/Displays/FilterDisplays/RepositoryFilterBar.razor

View workflow job for this annotation

GitHub Actions / build

Unboxing a possibly null value.
ApplyFilters();
}

private void HandleTemplatesChange(ChangeEventArgs e)
{
includeTemplates = (bool)e.Value;

Check warning on line 172 in GPVBlazor/GPVBlazor/Components/Displays/FilterDisplays/RepositoryFilterBar.razor

View workflow job for this annotation

GitHub Actions / build

Unboxing a possibly null value.

Check warning on line 172 in GPVBlazor/GPVBlazor/Components/Displays/FilterDisplays/RepositoryFilterBar.razor

View workflow job for this annotation

GitHub Actions / build

Unboxing a possibly null value.
ApplyFilters();
}


private void ApplyFilters(bool reset = false)
{
if (reset)
Expand All @@ -152,6 +192,9 @@
if (!string.IsNullOrWhiteSpace(selectedLanguage)) query = query.Where(r => r.Language == selectedLanguage);

if (!string.IsNullOrWhiteSpace(selectedLicense)) query = query.Where(r => r.License != null && r.License.Name == selectedLicense);
if (!includeArchived) query = query.Where(r => !r.Archived);
if (!includeForked) query = query.Where(r => !r.Fork);
if (!includeTemplates) query = query.Where(r => !r.IsTemplate);

switch (selectedSort)
{
Expand Down
2 changes: 1 addition & 1 deletion GPVBlazor/GPVBlazor/Components/Displays/ReadmeModal.razor
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@

@code {
[Parameter] public bool ShowModal { get; set; }
[Parameter] public Readme readme { get; set; }
[Parameter] public Readme? readme { get; set; }
}
16 changes: 8 additions & 8 deletions GPVBlazor/GPVBlazor/Components/Displays/RepositoryDisplay.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@
{
<div class="box h-100" style="min-height: 300px;">
<div>
<div class="is-flex is-align-items-center is-flex-wrap-wrap" style="gap: 0.5rem;">
<h5 class="title is-5">@repository.Name</h5>
<h6 class="subtitle is-6 has-text-grey">@((repository.Archived) ? "Archived" : "")</h6>
</div>
<h5 class="title is-5 is-flex is-flex-wrap-wrap is-column-gap-1">
@repository.Name <span class="subtitle is-6 has-text-grey">@((repository.Archived) ? "Archived" : "")</span>
<span class="subtitle is-6 has-text-grey">@((repository.IsTemplate) ? "Template" : "")</span>
</h5>

<h6 class="subtitle is-6 mb-2 has-text-grey">@repository.Language</h6>
<div class="is-flex is-flex-direction-row is-flex-wrap-wrap" style="gap: 0.5rem;">
@if (!string.IsNullOrEmpty(repository.Homepage) && Uri.IsWellFormedUriString(repository.Homepage, UriKind.Absolute))
{
<a href="@repository.Homepage" class="button is-small is-link is-inverted">Homepage</a>
<a href="@repository.Homepage" class="button is-small is-link is-inverted" target="_blank">Homepage</a>
}
<a href="@repository.HtmlUrl" class="button is-small is-link is-inverted">GitHub</a>
<a href="@repository.CloneUrl" class="button is-small is-link is-inverted">Clone URL</a>
<a href="@repository.HtmlUrl" class="button is-small is-link is-inverted" target="_blank">GitHub</a>
<a href="@repository.CloneUrl" class="button is-small is-link is-inverted" target="_blank">Clone URL</a>
<button class="button is-small is-link is-inverted is-column-gap-1">
@repository.StargazersCount
<span class="icon">
Expand Down Expand Up @@ -44,7 +45,6 @@
}
</div>
}

</footer>
</div>
}
Expand Down

0 comments on commit d39a7d5

Please sign in to comment.