Skip to content

Commit 044fa0a

Browse files
committed
Get Repo Info With Api
1 parent 9d61a74 commit 044fa0a

10 files changed

Lines changed: 376 additions & 25 deletions

File tree

CodeBeam.Website/CodeBeam.Website.Client/CodeBeam.Website.Client.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
1+
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
22

33
<PropertyGroup>
44
<TargetFramework>net10.0</TargetFramework>
@@ -7,6 +7,7 @@
77
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
88
<StaticWebAssetProjectMode>Default</StaticWebAssetProjectMode>
99
<BlazorDisableThrowNavigationException>true</BlazorDisableThrowNavigationException>
10+
<UserSecretsId>1b4a34e0-b1ab-4b6c-91df-88637c93150b</UserSecretsId>
1011
</PropertyGroup>
1112

1213
<ItemGroup>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace CodeBeam.Website.Client.Models;
2+
3+
public class NuGetSearchResult
4+
{
5+
public List<NuGetSearchPackage> data { get; set; } = [];
6+
}
7+
8+
public class NuGetSearchPackage
9+
{
10+
public string id { get; set; } = "";
11+
public long totalDownloads { get; set; }
12+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
namespace CodeBeam.Website.Client.Models;
2+
3+
public sealed class RepoStats
4+
{
5+
public int Stars { get; set; }
6+
public int Forks { get; set; }
7+
public int OpenIssues { get; set; }
8+
public int Contributors { get; set; }
9+
public long Downloads { get; set; }
10+
}
11+
12+
public sealed class AllRepoStatsDto
13+
{
14+
public RepoStats UltimateAuth { get; set; } = new();
15+
public RepoStats MudExtensions { get; set; } = new();
16+
public RepoStats Bcss { get; set; } = new();
17+
}

CodeBeam.Website/CodeBeam.Website.Client/Pages/Home.razor

Lines changed: 140 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,18 @@
2121

2222
<a id="vision"></a>
2323
<MudPage FullScreen="FullScreen.Full" Row="1" Column="1">
24-
<MudContainer MaxWidth="MaxWidth.Medium" Class="mud-height-full d-flex align-center justify-center my-4">
25-
<MudStack Spacing="0">
26-
<MudText Typo="Typo.h4" Color="Color.Primary">Our Vision</MudText>
27-
<MudDivider Class="my-8" Style="width: 120px" />
28-
<MudText>We believe software should be simple — even when the problem is not.</MudText>
29-
<MudText Class="mt-4">At CodeBeam, we focus on building systems, not just libraries.</MudText>
30-
<MudText>Reusable, practical, and designed for real-world applications.</MudText>
31-
</MudStack>
24+
<MudContainer MaxWidth="MaxWidth.ExtraSmall" Class="mud-height-full d-flex align-center justify-center my-4">
25+
<MudPaper Elevation="0" Outlined="true" Class="pa-4" Style="background: transparent">
26+
<MudStack Spacing="2">
27+
<MudText Typo="Typo.h4" Color="Color.Primary">Our Vision</MudText>
28+
<MudDivider Class="my-8" Style="width: 120px" />
29+
<MudText>We believe software should be simple — even when the problem is not.</MudText>
30+
<MudText Class="mt-4">At CodeBeam, we focus on building systems that developers can rely on in real-world applications.</MudText>
31+
<MudText>Our focus is clarity over complexity, practicality over abstraction, and building tools that actually solve problems — not just describe them.</MudText>
32+
<MudText>From UI extensions to authentication infrastructure, everything we build aims to reduce friction and give developers control.</MudText>
33+
<MudText>Because good software is not just powerful — it is understandable, predictable, and usable.</MudText>
34+
</MudStack>
35+
</MudPaper>
3236
</MudContainer>
3337
</MudPage>
3438

@@ -42,11 +46,48 @@
4246
<MudContainer MaxWidth="MaxWidth.Large" Class="mud-height-full d-flex flex-column align-center justify-center my-4">
4347
<MudGrid>
4448
<MudItem xs="12" md="6">
45-
<MudStack Row="true" AlignItems="AlignItems.Center">
46-
<MudIcon Icon="@CodeBeamBrands.UltimateAuth" Color="Color.Primary" Style="height: 72px; width: 72px" />
47-
<MudStack Spacing="0">
48-
<MudText Typo="Typo.h4" Color="Color.Primary">UltimateAuth</MudText>
49-
<MudText>The modern unified Auth framework for .NET - Reimagined.</MudText>
49+
<MudStack Class="mud-width-full mud-height-full" Justify="Justify.SpaceBetween">
50+
<MudStack Row="true" AlignItems="AlignItems.Center">
51+
<MudIcon Icon="@CodeBeamBrands.UltimateAuth" Color="Color.Primary" Style="height: 72px; width: 72px" />
52+
<MudStack Spacing="0">
53+
<MudText Typo="Typo.h4" Color="Color.Primary">UltimateAuth</MudText>
54+
<MudText>The modern unified Auth framework for .NET - Reimagined.</MudText>
55+
</MudStack>
56+
</MudStack>
57+
58+
<MudStack Spacing="2" Class="mt-2">
59+
<MudStack Row="true" Spacing="1">
60+
<MudChip T="string" Color="Color.Primary" Size="Size.Small" Variant="Variant.Outlined">Authentication</MudChip>
61+
<MudChip T="string" Color="Color.Primary" Size="Size.Small" Variant="Variant.Outlined">Security</MudChip>
62+
<MudChip T="string" Color="Color.Primary" Size="Size.Small" Variant="Variant.Outlined">Session-based</MudChip>
63+
<MudChip T="string" Color="Color.Primary" Size="Size.Small" Variant="Variant.Outlined">Zero-trust</MudChip>
64+
</MudStack>
65+
66+
<MudStack Row="true" Spacing="4" Class="mt-1">
67+
<MudStack AlignItems="AlignItems.Center" Justify="Justify.Center" Spacing="2">
68+
<MudText Typo="Typo.h4" Color="Color.Primary">@Format(_repoStats?.UltimateAuth.Stars ?? 9)</MudText>
69+
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2">
70+
<MudIcon Icon="@Icons.Material.Filled.Star" Color="Color.Primary" Size="Size.Small" />
71+
<MudText Typo="Typo.subtitle2">Stars</MudText>
72+
</MudStack>
73+
</MudStack>
74+
75+
<MudStack AlignItems="AlignItems.Center" Justify="Justify.Center" Spacing="2">
76+
<MudText Typo="Typo.h4" Color="Color.Primary">@Format(_repoStats?.UltimateAuth.Contributors ?? 1)</MudText>
77+
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2">
78+
<MudIcon Icon="@Icons.Material.Filled.People" Color="Color.Primary" Size="Size.Small" />
79+
<MudText Typo="Typo.subtitle2">@GetContributorLabel(_repoStats?.UltimateAuth.Contributors ?? 1)</MudText>
80+
</MudStack>
81+
</MudStack>
82+
83+
<MudStack AlignItems="AlignItems.Center" Justify="Justify.Center" Spacing="2">
84+
<MudText Typo="Typo.h4" Color="Color.Primary">@Format((int?)_repoStats?.UltimateAuth.Downloads ?? 0)</MudText>
85+
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2">
86+
<MudIcon Icon="@Icons.Material.Filled.Download" Color="Color.Primary" Size="Size.Small" />
87+
<MudText Typo="Typo.subtitle2">Downloads</MudText>
88+
</MudStack>
89+
</MudStack>
90+
</MudStack>
5091
</MudStack>
5192
</MudStack>
5293
</MudItem>
@@ -109,13 +150,52 @@
109150
<MudContainer MaxWidth="MaxWidth.Large" Class="mud-height-full d-flex flex-column align-center justify-center my-4">
110151
<MudGrid>
111152
<MudItem xs="12" md="6">
112-
<MudStack Row="true" AlignItems="AlignItems.Center">
113-
<MudIcon Icon="@Icons.Custom.Brands.MudBlazor" Color="Color.Primary" Style="height: 72px; width: 72px" />
114-
<MudStack Spacing="0">
115-
<MudText Typo="Typo.h4" Color="Color.Primary">MudBlazor Extensions</MudText>
116-
<MudText>Powering MudBlazor with advanced components and utilities.</MudText>
153+
<MudStack Class="mud-width-full mud-height-full" Justify="Justify.SpaceBetween">
154+
<MudStack Row="true" AlignItems="AlignItems.Center">
155+
<MudIcon Icon="@Icons.Custom.Brands.MudBlazor" Color="Color.Primary" Style="height: 72px; width: 72px" />
156+
<MudStack Spacing="0">
157+
<MudText Typo="Typo.h4" Color="Color.Primary">MudBlazor Extensions</MudText>
158+
<MudText>Powering MudBlazor with advanced components and utilities.</MudText>
159+
</MudStack>
160+
</MudStack>
161+
162+
<MudStack Spacing="2" Class="mt-2">
163+
<MudStack Row="true" Spacing="1">
164+
<MudChip T="string" Color="Color.Primary" Size="Size.Small" Variant="Variant.Outlined">Component</MudChip>
165+
<MudChip T="string" Color="Color.Primary" Size="Size.Small" Variant="Variant.Outlined">UI</MudChip>
166+
<MudChip T="string" Color="Color.Primary" Size="Size.Small" Variant="Variant.Outlined">Extension</MudChip>
167+
<MudChip T="string" Color="Color.Primary" Size="Size.Small" Variant="Variant.Outlined">Utility</MudChip>
168+
</MudStack>
169+
170+
<MudStack Row="true" Spacing="4" Class="mt-1">
171+
<MudStack AlignItems="AlignItems.Center" Justify="Justify.Center" Spacing="2">
172+
<MudText Typo="Typo.h4" Color="Color.Primary">@Format(_repoStats?.MudExtensions.Stars ?? 570)</MudText>
173+
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2">
174+
<MudIcon Icon="@Icons.Material.Filled.Star" Color="Color.Primary" Size="Size.Small" />
175+
<MudText Typo="Typo.subtitle2">Stars</MudText>
176+
</MudStack>
177+
</MudStack>
178+
179+
<MudStack AlignItems="AlignItems.Center" Justify="Justify.Center" Spacing="2">
180+
<MudText Typo="Typo.h4" Color="Color.Primary">@Format(_repoStats?.MudExtensions.Contributors ?? 42)</MudText>
181+
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2">
182+
<MudIcon Icon="@Icons.Material.Filled.People" Color="Color.Primary" Size="Size.Small" />
183+
<MudText Typo="Typo.subtitle2">Contributors</MudText>
184+
</MudStack>
185+
</MudStack>
186+
187+
<MudStack AlignItems="AlignItems.Center" Justify="Justify.Center" Spacing="2">
188+
<MudText Typo="Typo.h4" Color="Color.Primary">@Format((int?)_repoStats?.MudExtensions.Downloads ?? 1900000)</MudText>
189+
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2">
190+
<MudIcon Icon="@Icons.Material.Filled.Download" Color="Color.Primary" Size="Size.Small" />
191+
<MudText Typo="Typo.subtitle2">Downloads</MudText>
192+
</MudStack>
193+
</MudStack>
194+
</MudStack>
117195
</MudStack>
118196
</MudStack>
197+
198+
119199
</MudItem>
120200

121201
<MudItem xs="12" md="6">
@@ -177,11 +257,48 @@
177257
<MudContainer MaxWidth="MaxWidth.Large" Class="mud-height-full d-flex flex-column align-center justify-center">
178258
<MudGrid>
179259
<MudItem xs="12" md="6">
180-
<MudStack Row="true" AlignItems="AlignItems.Center">
181-
<MudImage Src="BCSS.jpg" Style="width: 72px" Fluid="true" />
182-
<MudStack Spacing="0">
183-
<MudText Typo="Typo.h4" Color="Color.Primary">BCSS</MudText>
184-
<MudText>Runtime CSS generation for modern applications.</MudText>
260+
<MudStack Class="mud-width-full mud-height-full" Justify="Justify.SpaceBetween">
261+
<MudStack Row="true" AlignItems="AlignItems.Center">
262+
<MudImage Src="BCSS.jpg" Style="width: 72px" Fluid="true" />
263+
<MudStack Spacing="0">
264+
<MudText Typo="Typo.h4" Color="Color.Primary">BCSS</MudText>
265+
<MudText>Runtime CSS generation for modern applications.</MudText>
266+
</MudStack>
267+
</MudStack>
268+
269+
<MudStack Spacing="2" Class="mt-2">
270+
<MudStack Row="true" Spacing="1">
271+
<MudChip T="string" Color="Color.Primary" Size="Size.Small" Variant="Variant.Outlined">CSS</MudChip>
272+
<MudChip T="string" Color="Color.Primary" Size="Size.Small" Variant="Variant.Outlined">Generator</MudChip>
273+
<MudChip T="string" Color="Color.Primary" Size="Size.Small" Variant="Variant.Outlined">Runtime</MudChip>
274+
<MudChip T="string" Color="Color.Primary" Size="Size.Small" Variant="Variant.Outlined">Blazor</MudChip>
275+
</MudStack>
276+
277+
<MudStack Row="true" Spacing="4" Class="mt-1">
278+
<MudStack AlignItems="AlignItems.Center" Justify="Justify.Center" Spacing="2">
279+
<MudText Typo="Typo.h4" Color="Color.Primary">@Format(_repoStats?.Bcss.Stars ?? 14)</MudText>
280+
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2">
281+
<MudIcon Icon="@Icons.Material.Filled.Star" Color="Color.Primary" Size="Size.Small" />
282+
<MudText Typo="Typo.subtitle2">Stars</MudText>
283+
</MudStack>
284+
</MudStack>
285+
286+
<MudStack AlignItems="AlignItems.Center" Justify="Justify.Center" Spacing="2">
287+
<MudText Typo="Typo.h4" Color="Color.Primary">@Format(_repoStats?.Bcss.Contributors ?? 1)</MudText>
288+
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2">
289+
<MudIcon Icon="@Icons.Material.Filled.People" Color="Color.Primary" Size="Size.Small" />
290+
<MudText Typo="Typo.subtitle2">Contributors</MudText>
291+
</MudStack>
292+
</MudStack>
293+
294+
<MudStack AlignItems="AlignItems.Center" Justify="Justify.Center" Spacing="2">
295+
<MudText Typo="Typo.h4" Color="Color.Primary">@Format((int?)_repoStats?.Bcss.Downloads ?? 4300)</MudText>
296+
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2">
297+
<MudIcon Icon="@Icons.Material.Filled.Download" Color="Color.Primary" Size="Size.Small" />
298+
<MudText Typo="Typo.subtitle2">Downloads</MudText>
299+
</MudStack>
300+
</MudStack>
301+
</MudStack>
185302
</MudStack>
186303
</MudStack>
187304
</MudItem>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using CodeBeam.Website.Client.Models;
2+
using Microsoft.AspNetCore.Components;
3+
using System.Net.Http.Json;
4+
5+
namespace CodeBeam.Website.Client.Pages;
6+
7+
public partial class Home
8+
{
9+
private AllRepoStatsDto? _repoStats;
10+
11+
[Inject] HttpClient Http { get; set; } = null!;
12+
protected override async Task OnInitializedAsync()
13+
{
14+
if (RendererInfo.IsInteractive)
15+
{
16+
_repoStats = await Http.GetFromJsonAsync<AllRepoStatsDto>("/api/github/all");
17+
}
18+
}
19+
20+
string Format(int n) =>
21+
n >= 1_000_000 ? $"{n / 1_000_000.0:0.#}M+" :
22+
n >= 1_000 ? $"{n / 1_000.0:0.#}k+" :
23+
n.ToString();
24+
25+
string GetContributorLabel(int count)
26+
{
27+
return count <= 1
28+
? "Maintained"
29+
: "Contributors";
30+
}
31+
}

CodeBeam.Website/CodeBeam.Website.Client/Program.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,9 @@
77
builder.Services.AddMudServices();
88
builder.Services.AddMudExtensions();
99

10+
builder.Services.AddScoped(sp => new HttpClient
11+
{
12+
BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
13+
});
14+
1015
await builder.Build().RunAsync();

CodeBeam.Website/CodeBeam.Website/CodeBeam.Website.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Web">
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
44
<TargetFramework>net10.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<BlazorDisableThrowNavigationException>true</BlazorDisableThrowNavigationException>
8+
<UserSecretsId>fef0272e-546f-42eb-bf78-39fa6dec43c7</UserSecretsId>
89
</PropertyGroup>
910

1011
<ItemGroup>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace CodeBeam.Website.Models;
2+
3+
public class GitHubRepoDto
4+
{
5+
public int stargazers_count { get; set; }
6+
public int forks_count { get; set; }
7+
public int open_issues_count { get; set; }
8+
}

0 commit comments

Comments
 (0)