Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
12 changes: 12 additions & 0 deletions KitX Official Website/KitX Website/App.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
13 changes: 13 additions & 0 deletions KitX Official Website/KitX Website/Data/WeatherForecast.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace KitX_Website.Data
{
public class WeatherForecast
{
public DateTime Date { get; set; }

public int TemperatureC { get; set; }

public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);

public string? Summary { get; set; }
}
}
20 changes: 20 additions & 0 deletions KitX Official Website/KitX Website/Data/WeatherForecastService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace KitX_Website.Data
{
public class WeatherForecastService
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};

public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate)
{
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = startDate.AddDays(index),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
}).ToArray());
}
}
}
23 changes: 23 additions & 0 deletions KitX Official Website/KitX Website/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["nuget.config", "."]
COPY ["KitX Official Website/KitX Website/KitX Website.csproj", "KitX Official Website/KitX Website/"]
RUN dotnet restore "KitX Official Website/KitX Website/KitX Website.csproj"
COPY . .
WORKDIR "/src/KitX Official Website/KitX Website"
RUN dotnet build "KitX Website.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "KitX Website.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "KitX Website.dll"]
19 changes: 19 additions & 0 deletions KitX Official Website/KitX Website/KitX Website.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>KitX_Website</RootNamespace>
<UserSecretsId>392aa4c0-1b97-4c7d-8a3d-6a27f16239f9</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
<InvariantGlobalization>false</InvariantGlobalization>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.0" />
<PackageReference Include="Toolbelt.Blazor.I18nText" Version="12.0.0" />
</ItemGroup>

</Project>
26 changes: 26 additions & 0 deletions KitX Official Website/KitX Website/Pages/Download.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@page "/download"
@inject Toolbelt.Blazor.I18nText.I18nText I18nText

<PageTitle>@Text["Page_Title_Download"]</PageTitle>

<h1>Download</h1>

<p role="status">Current count: @currentCount</p>

<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>

@code {
private int currentCount = 0;

private void IncrementCount()
{
currentCount++;
}

I18nText.Text Text = new I18nText.Text();

protected override async Task OnInitializedAsync()
{
Text = await I18nText.GetTextTableAsync<I18nText.Text>(this);
}
}
42 changes: 42 additions & 0 deletions KitX Official Website/KitX Website/Pages/Error.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@page
@model KitX_Website.Pages.ErrorModel

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Error</title>
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="~/css/site.css" rel="stylesheet" asp-append-version="true" />
</head>

<body>
<div class="main">
<div class="content px-4">
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>

@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}

<h3>Development Mode</h3>
<p>
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>
</div>
</div>
</body>

</html>
27 changes: 27 additions & 0 deletions KitX Official Website/KitX Website/Pages/Error.cshtml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using System.Diagnostics;

namespace KitX_Website.Pages
{
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel
{
public string? RequestId { get; set; }

public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);

private readonly ILogger<ErrorModel> _logger;

public ErrorModel(ILogger<ErrorModel> logger)
{
_logger = logger;
}

public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
}
39 changes: 39 additions & 0 deletions KitX Official Website/KitX Website/Pages/Index.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
@page "/"
@inject Toolbelt.Blazor.I18nText.I18nText I18nText

<PageTitle>@Text["Page_Title_Home"]</PageTitle>

<div>
<embed src="https://source.catrol.cn/icons/Project/Catrol/KitX/KitX.svg"
type="image/svg+xml"
width="150" height="150"
style="margin:0 auto;display:table;" />
<div style="height:30px;" />
<div style="margin:0 auto;display:table;">
<h1>@Text["KitX_Name"]</h1>
</div>
<div style="height:20px;" />
<div style="margin:0 auto;display:table;align-items:center;">
<img src="https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white"
alt="windows" />
<img src="https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black"
alt="linux" />
<img src="https://img.shields.io/badge/mac%20os-000000?style=for-the-badge&logo=macos&logoColor=F0F0F0"
alt="macos" />
<img src="https://img.shields.io/badge/Android-3DDC84?style=for-the-badge&logo=android&logoColor=white"
alt="android" />
<img src="https://img.shields.io/badge/iOS-000000?style=for-the-badge&logo=ios&logoColor=white"
alt="ios" />
</div>
</div>

<SurveyPrompt Title="@Text["KitX_Descr"]" />

@code {
I18nText.Text Text = new I18nText.Text();

protected override async Task OnInitializedAsync()
{
Text = await I18nText.GetTextTableAsync<I18nText.Text>(this);
}
}
52 changes: 52 additions & 0 deletions KitX Official Website/KitX Website/Pages/Plugins.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
@page "/plugins"
@inject Toolbelt.Blazor.I18nText.I18nText I18nText

<PageTitle>@Text["Page_Title_PluginsMarketplace"]</PageTitle>

@using KitX_Website.Data
@inject WeatherForecastService ForecastService

<h1>Plugins</h1>

<p>This component demonstrates fetching data from a service.</p>

@if (forecasts == null)
{
<p><em>Loading...</em></p>
}
else
{
<table class="table">
<thead>
<tr>
<th>Date</th>
<th>Temp. (C)</th>
<th>Temp. (F)</th>
<th>Summary</th>
</tr>
</thead>
<tbody>
@foreach (var forecast in forecasts)
{
<tr>
<td>@forecast.Date.ToShortDateString()</td>
<td>@forecast.TemperatureC</td>
<td>@forecast.TemperatureF</td>
<td>@forecast.Summary</td>
</tr>
}
</tbody>
</table>
}

@code {
private WeatherForecast[]? forecasts;

I18nText.Text Text = new I18nText.Text();

protected override async Task OnInitializedAsync()
{
forecasts = await ForecastService.GetForecastAsync(DateTime.Now);
Text = await I18nText.GetTextTableAsync<I18nText.Text>(this);
}
}
8 changes: 8 additions & 0 deletions KitX Official Website/KitX Website/Pages/_Host.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@page "/"
@namespace KitX_Website.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = "_Layout";
}

<component type="typeof(App)" render-mode="ServerPrerendered" />
32 changes: 32 additions & 0 deletions KitX Official Website/KitX Website/Pages/_Layout.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@using Microsoft.AspNetCore.Components.Web
@namespace KitX_Website.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="~/" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link href="css/site.css" rel="stylesheet" />
<link href="KitX Website.styles.css" rel="stylesheet" />
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
</head>
<body>
@RenderBody()

<div id="blazor-error-ui">
<environment include="Staging,Production">
An error has occurred. This application may no longer respond until reloaded.
</environment>
<environment include="Development">
An unhandled exception has occurred. See browser dev tools for details.
</environment>
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>

<script src="_framework/blazor.server.js"></script>
</body>
</html>
Loading