feat: Convert website from static HTML to .NET 9.0 Blazor Web App
Major architectural upgrade from static HTML site to modern Blazor Web App: - Migrated to .NET 9.0 Blazor Web App framework - Converted home page with 4 gateway cards (Help Desk, App Store, Cloud, SDK) - Added new SDK card linking to comprehensive SDK documentation - Converted SDK documentation page to Blazor component - Updated template download links to nuget.silverlabs.uk repository - Implemented multi-stage Docker build with .NET SDK 9.0 - Created Blazor-optimized nginx configuration - Preserved all original styling and animations - Added .gitignore for Blazor build artifacts Technical changes: - New BlazorApp/ project structure with Components architecture - MainLayout simplified (no default navigation) - CSS ported to wwwroot (styles.css + sdk-styles.css) - Multi-stage Dockerfile: Build with dotnet SDK, serve with nginx - GitLab CI/CD pipeline compatible (auto-detects new Dockerfile) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
20
BlazorApp/Components/App.razor
Normal file
20
BlazorApp/Components/App.razor
Normal file
@@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<base href="/" />
|
||||
<link rel="stylesheet" href="@Assets["styles.css"]" />
|
||||
<link rel="stylesheet" href="@Assets["sdk-styles.css"]" />
|
||||
<ImportMap />
|
||||
<link rel="icon" type="image/png" href="favicon.png" />
|
||||
<HeadOutlet />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<Routes />
|
||||
<script src="_framework/blazor.web.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
9
BlazorApp/Components/Layout/MainLayout.razor
Normal file
9
BlazorApp/Components/Layout/MainLayout.razor
Normal file
@@ -0,0 +1,9 @@
|
||||
@inherits LayoutComponentBase
|
||||
|
||||
@Body
|
||||
|
||||
<div id="blazor-error-ui" data-nosnippet>
|
||||
An unhandled error has occurred.
|
||||
<a href="." class="reload">Reload</a>
|
||||
<span class="dismiss">🗙</span>
|
||||
</div>
|
||||
98
BlazorApp/Components/Layout/MainLayout.razor.css
Normal file
98
BlazorApp/Components/Layout/MainLayout.razor.css
Normal file
@@ -0,0 +1,98 @@
|
||||
.page {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
main {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
|
||||
}
|
||||
|
||||
.top-row {
|
||||
background-color: #f7f7f7;
|
||||
border-bottom: 1px solid #d6d5d5;
|
||||
justify-content: flex-end;
|
||||
height: 3.5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.top-row ::deep a, .top-row ::deep .btn-link {
|
||||
white-space: nowrap;
|
||||
margin-left: 1.5rem;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.top-row ::deep a:first-child {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
@media (max-width: 640.98px) {
|
||||
.top-row {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.top-row ::deep a, .top-row ::deep .btn-link {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 641px) {
|
||||
.page {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
width: 250px;
|
||||
height: 100vh;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.top-row {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.top-row.auth ::deep a:first-child {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
.top-row, article {
|
||||
padding-left: 2rem !important;
|
||||
padding-right: 1.5rem !important;
|
||||
}
|
||||
}
|
||||
|
||||
#blazor-error-ui {
|
||||
color-scheme: light only;
|
||||
background: lightyellow;
|
||||
bottom: 0;
|
||||
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
|
||||
box-sizing: border-box;
|
||||
display: none;
|
||||
left: 0;
|
||||
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
#blazor-error-ui .dismiss {
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
right: 0.75rem;
|
||||
top: 0.5rem;
|
||||
}
|
||||
30
BlazorApp/Components/Layout/NavMenu.razor
Normal file
30
BlazorApp/Components/Layout/NavMenu.razor
Normal file
@@ -0,0 +1,30 @@
|
||||
<div class="top-row ps-3 navbar navbar-dark">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="">SilverLabs.Website</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="checkbox" title="Navigation menu" class="navbar-toggler" />
|
||||
|
||||
<div class="nav-scrollable" onclick="document.querySelector('.navbar-toggler').click()">
|
||||
<nav class="nav flex-column">
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
|
||||
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Home
|
||||
</NavLink>
|
||||
</div>
|
||||
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="counter">
|
||||
<span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> Counter
|
||||
</NavLink>
|
||||
</div>
|
||||
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="weather">
|
||||
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Weather
|
||||
</NavLink>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
105
BlazorApp/Components/Layout/NavMenu.razor.css
Normal file
105
BlazorApp/Components/Layout/NavMenu.razor.css
Normal file
@@ -0,0 +1,105 @@
|
||||
.navbar-toggler {
|
||||
appearance: none;
|
||||
cursor: pointer;
|
||||
width: 3.5rem;
|
||||
height: 2.5rem;
|
||||
color: white;
|
||||
position: absolute;
|
||||
top: 0.5rem;
|
||||
right: 1rem;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") no-repeat center/1.75rem rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.navbar-toggler:checked {
|
||||
background-color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
|
||||
.top-row {
|
||||
min-height: 3.5rem;
|
||||
background-color: rgba(0,0,0,0.4);
|
||||
}
|
||||
|
||||
.navbar-brand {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.bi {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
width: 1.25rem;
|
||||
height: 1.25rem;
|
||||
margin-right: 0.75rem;
|
||||
top: -1px;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.bi-house-door-fill-nav-menu {
|
||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-house-door-fill' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 14.5v-3.505c0-.245.25-.495.5-.495h2c.25 0 .5.25.5.5v3.5a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5Z'/%3E%3C/svg%3E");
|
||||
}
|
||||
|
||||
.bi-plus-square-fill-nav-menu {
|
||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-plus-square-fill' viewBox='0 0 16 16'%3E%3Cpath d='M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm6.5 4.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3a.5.5 0 0 1 1 0z'/%3E%3C/svg%3E");
|
||||
}
|
||||
|
||||
.bi-list-nested-nav-menu {
|
||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-list-nested' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M4.5 11.5A.5.5 0 0 1 5 11h10a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 3 7h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 1 3h10a.5.5 0 0 1 0 1H1a.5.5 0 0 1-.5-.5z'/%3E%3C/svg%3E");
|
||||
}
|
||||
|
||||
.nav-item {
|
||||
font-size: 0.9rem;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.nav-item:first-of-type {
|
||||
padding-top: 1rem;
|
||||
}
|
||||
|
||||
.nav-item:last-of-type {
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
|
||||
.nav-item ::deep .nav-link {
|
||||
color: #d7d7d7;
|
||||
background: none;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
height: 3rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
line-height: 3rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.nav-item ::deep a.active {
|
||||
background-color: rgba(255,255,255,0.37);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.nav-item ::deep .nav-link:hover {
|
||||
background-color: rgba(255,255,255,0.1);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.nav-scrollable {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.navbar-toggler:checked ~ .nav-scrollable {
|
||||
display: block;
|
||||
}
|
||||
|
||||
@media (min-width: 641px) {
|
||||
.navbar-toggler {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.nav-scrollable {
|
||||
/* Never collapse the sidebar for wide screens */
|
||||
display: block;
|
||||
|
||||
/* Allow sidebar to scroll for tall menus */
|
||||
height: calc(100vh - 3.5rem);
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
19
BlazorApp/Components/Pages/Counter.razor
Normal file
19
BlazorApp/Components/Pages/Counter.razor
Normal file
@@ -0,0 +1,19 @@
|
||||
@page "/counter"
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<PageTitle>Counter</PageTitle>
|
||||
|
||||
<h1>Counter</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++;
|
||||
}
|
||||
}
|
||||
36
BlazorApp/Components/Pages/Error.razor
Normal file
36
BlazorApp/Components/Pages/Error.razor
Normal file
@@ -0,0 +1,36 @@
|
||||
@page "/Error"
|
||||
@using System.Diagnostics
|
||||
|
||||
<PageTitle>Error</PageTitle>
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more 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>
|
||||
|
||||
@code{
|
||||
[CascadingParameter]
|
||||
private HttpContext? HttpContext { get; set; }
|
||||
|
||||
private string? RequestId { get; set; }
|
||||
private bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
|
||||
protected override void OnInitialized() =>
|
||||
RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier;
|
||||
}
|
||||
66
BlazorApp/Components/Pages/Home.razor
Normal file
66
BlazorApp/Components/Pages/Home.razor
Normal file
@@ -0,0 +1,66 @@
|
||||
@page "/"
|
||||
|
||||
<PageTitle>SilverLabs - Innovation Gateway</PageTitle>
|
||||
|
||||
<div class="main-content visible">
|
||||
<header class="header">
|
||||
<img src="logo.png" alt="SilverLabs Logo" class="logo">
|
||||
</header>
|
||||
|
||||
<main class="main">
|
||||
<h1 class="title">Welcome to SilverLabs</h1>
|
||||
<p class="subtitle">Your Innovation Gateway</p>
|
||||
|
||||
<div class="gateway-grid">
|
||||
<a href="https://helpdesk.silverlabs.uk" class="gateway-card">
|
||||
<div class="card-icon">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<circle cx="12" cy="12" r="10"></circle>
|
||||
<path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"></path>
|
||||
<line x1="12" y1="17" x2="12.01" y2="17"></line>
|
||||
</svg>
|
||||
</div>
|
||||
<h2 class="card-title">Help Desk</h2>
|
||||
<p class="card-description">Support & Assistance</p>
|
||||
</a>
|
||||
|
||||
<a href="https://appstore.silverlabs.uk" class="gateway-card">
|
||||
<div class="card-icon">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<rect x="3" y="3" width="7" height="7"></rect>
|
||||
<rect x="14" y="3" width="7" height="7"></rect>
|
||||
<rect x="14" y="14" width="7" height="7"></rect>
|
||||
<rect x="3" y="14" width="7" height="7"></rect>
|
||||
</svg>
|
||||
</div>
|
||||
<h2 class="card-title">App Store</h2>
|
||||
<p class="card-description">Applications & Tools</p>
|
||||
</a>
|
||||
|
||||
<a href="https://cloud.silverlabs.uk" class="gateway-card">
|
||||
<div class="card-icon">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M18 10h-1.26A8 8 0 1 0 9 20h9a5 5 0 0 0 0-10z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
<h2 class="card-title">Cloud</h2>
|
||||
<p class="card-description">Storage & Collaboration</p>
|
||||
</a>
|
||||
|
||||
<a href="/sdk" class="gateway-card">
|
||||
<div class="card-icon">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<polyline points="16 18 22 12 16 6"></polyline>
|
||||
<polyline points="8 6 2 12 8 18"></polyline>
|
||||
</svg>
|
||||
</div>
|
||||
<h2 class="card-title">SDK</h2>
|
||||
<p class="card-description">Developer Resources</p>
|
||||
</a>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer class="footer">
|
||||
<p>© 2025 SilverLabs. All rights reserved.</p>
|
||||
</footer>
|
||||
</div>
|
||||
253
BlazorApp/Components/Pages/Sdk.razor
Normal file
253
BlazorApp/Components/Pages/Sdk.razor
Normal file
@@ -0,0 +1,253 @@
|
||||
@page "/sdk"
|
||||
|
||||
<PageTitle>SilverSHELL SDK - SilverLabs</PageTitle>
|
||||
|
||||
<div class="main-content visible">
|
||||
<header class="header">
|
||||
<img src="../logo.png" alt="SilverLabs Logo" class="logo">
|
||||
</header>
|
||||
|
||||
<div class="sdk-container">
|
||||
<div class="sdk-header">
|
||||
<h1>SilverSHELL SDK</h1>
|
||||
<p style="font-size: 1.2rem; color: rgba(255, 255, 255, 0.7);">Build modular Blazor WebAssembly applications with ease</p>
|
||||
</div>
|
||||
|
||||
<!-- Quick Start Section -->
|
||||
<div class="sdk-section">
|
||||
<h2>🚀 Quick Start</h2>
|
||||
<p>Get started with SilverSHELL in just a few minutes. Follow these simple steps:</p>
|
||||
|
||||
<ol class="steps-list">
|
||||
<li>
|
||||
<strong>Download the templates</strong> (see downloads below)
|
||||
</li>
|
||||
<li>
|
||||
<strong>Extract the templates</strong> to a directory of your choice
|
||||
</li>
|
||||
<li>
|
||||
<strong>Install the templates</strong>
|
||||
<div class="code-block"><code>dotnet new install ./path/to/SilverSHELL.Starter.Template
|
||||
dotnet new install ./path/to/SilverSHELL.AppModule.Template</code></div>
|
||||
</li>
|
||||
<li>
|
||||
<strong>Create your first project</strong>
|
||||
<div class="code-block"><code>dotnet new silvershell-starter -n MyApp --pwa true --module-repository true
|
||||
cd MyApp
|
||||
dotnet run</code></div>
|
||||
</li>
|
||||
<li>
|
||||
<strong>Access your application</strong> at <code>https://localhost:5001</code>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<!-- Downloads Section -->
|
||||
<div class="sdk-section">
|
||||
<h2>📦 Downloads</h2>
|
||||
<p>Download the SilverSHELL project templates to get started:</p>
|
||||
|
||||
<div class="download-grid">
|
||||
<div class="download-card">
|
||||
<h3>Starter Template</h3>
|
||||
<p>Create a new SilverSHELL application with minimal configuration</p>
|
||||
<p><strong>Size:</strong> 6.7 KB</p>
|
||||
<p><strong>Includes:</strong> Blazor WebAssembly setup, module loading, PWA support</p>
|
||||
<a href="https://nuget.silverlabs.uk/templates/silvershell-starter-template.tar.gz" class="download-btn" download>
|
||||
Download Starter Template
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="download-card">
|
||||
<h3>Module Template</h3>
|
||||
<p>Create reusable SilverSHELL modules with best practices</p>
|
||||
<p><strong>Size:</strong> 17 KB</p>
|
||||
<p><strong>Includes:</strong> Module structure, configuration, CI/CD templates</p>
|
||||
<a href="https://nuget.silverlabs.uk/templates/silvershell-module-template.tar.gz" class="download-btn" download>
|
||||
Download Module Template
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Creating Applications Section -->
|
||||
<div class="sdk-section">
|
||||
<h2>🏗️ Creating Applications</h2>
|
||||
|
||||
<h3>Using the Starter Template</h3>
|
||||
<div class="code-block"><code># Create a new application
|
||||
dotnet new silvershell-starter -n MyAwesomeApp
|
||||
|
||||
# With PWA support
|
||||
dotnet new silvershell-starter -n MyAwesomeApp --pwa true
|
||||
|
||||
# With Module Repository integration
|
||||
dotnet new silvershell-starter -n MyAwesomeApp --module-repository true</code></div>
|
||||
|
||||
<h3>Adding Modules</h3>
|
||||
<p>SilverSHELL supports multiple ways to add modules to your application:</p>
|
||||
|
||||
<h3>Option 1: Configuration File</h3>
|
||||
<p>Edit <code>wwwroot/appsettings.json</code>:</p>
|
||||
<div class="code-block"><code>{
|
||||
"AMS": {
|
||||
"Deployment": {
|
||||
"PreloadModules": [
|
||||
"SilverLabs.SilverSHELL.Auth.Login",
|
||||
"SilverSHELL.Modules.ModuleBrowser"
|
||||
]
|
||||
}
|
||||
}
|
||||
}</code></div>
|
||||
|
||||
<h3>Option 2: Module Browser UI</h3>
|
||||
<ol>
|
||||
<li>Navigate to <code>/modules/browse</code> in your application</li>
|
||||
<li>Search for modules from <strong>library.silverlabs.uk</strong></li>
|
||||
<li>Click "Install" on any module</li>
|
||||
<li>Modules are downloaded and installed automatically</li>
|
||||
</ol>
|
||||
|
||||
<h3>Option 3: Manual Installation</h3>
|
||||
<div class="code-block"><code># Copy module DLLs to the modules directory
|
||||
cp SomeModule.dll wwwroot/modules/
|
||||
dotnet run
|
||||
# Module is automatically discovered and loaded!</code></div>
|
||||
</div>
|
||||
|
||||
<!-- Creating Modules Section -->
|
||||
<div class="sdk-section">
|
||||
<h2>🔧 Creating Modules</h2>
|
||||
|
||||
<h3>Using the Module Template</h3>
|
||||
<div class="code-block"><code># Create a basic module
|
||||
dotnet new silvershell-module -n MyModule
|
||||
|
||||
# Create a module with widgets
|
||||
dotnet new silvershell-module -n MyModule --includeWidgets true
|
||||
|
||||
# Create a module with search provider
|
||||
dotnet new silvershell-module -n MyModule --includeSearchProvider true
|
||||
|
||||
# Create a module with everything
|
||||
dotnet new silvershell-module -n MyModule \
|
||||
--includeWidgets true \
|
||||
--includeSearchProvider true \
|
||||
--includeTests true</code></div>
|
||||
|
||||
<h3>Module Structure</h3>
|
||||
<p>The template creates an organized structure:</p>
|
||||
<div class="code-block"><code>MyModule/
|
||||
├── Configuration/
|
||||
│ ├── ModuleMetadata.cs # Module identity and version
|
||||
│ ├── EndpointConfiguration.cs # Navigation routes
|
||||
│ └── WidgetConfiguration.cs # Dashboard widgets
|
||||
├── Pages/
|
||||
│ └── Index.razor # Razor pages
|
||||
├── Components/
|
||||
│ └── ... # Razor components
|
||||
├── .gitlab-ci.yml # GitLab CI/CD
|
||||
├── .github/workflows/
|
||||
│ └── publish.yml # GitHub Actions
|
||||
└── MyModuleMain.cs # Module entry point</code></div>
|
||||
</div>
|
||||
|
||||
<!-- Publishing Modules Section -->
|
||||
<div class="sdk-section">
|
||||
<h2>🚀 Publishing Modules</h2>
|
||||
|
||||
<div class="info-box">
|
||||
<strong>CI/CD Included!</strong> The module template includes ready-to-use CI/CD pipelines for both GitLab and GitHub.
|
||||
</div>
|
||||
|
||||
<h3>Automated Publishing (Recommended)</h3>
|
||||
<p>The templates include CI/CD pipelines for automatic publishing:</p>
|
||||
|
||||
<ol class="steps-list">
|
||||
<li>
|
||||
<strong>Configure CI/CD variables</strong>
|
||||
<div class="code-block"><code># In GitLab: Settings > CI/CD > Variables
|
||||
# In GitHub: Settings > Secrets > Actions
|
||||
|
||||
# Add variable:
|
||||
MODULE_REPO_TOKEN: [your token from library.silverlabs.uk]</code></div>
|
||||
</li>
|
||||
<li>
|
||||
<strong>Commit and push your code</strong>
|
||||
<div class="code-block"><code>git add .
|
||||
git commit -m "feat: Initial module implementation"
|
||||
git push</code></div>
|
||||
</li>
|
||||
<li>
|
||||
<strong>Create a release tag</strong>
|
||||
<div class="code-block"><code>git tag v1.0.0
|
||||
git push --tags</code></div>
|
||||
</li>
|
||||
<li>
|
||||
<strong>Trigger publish</strong> from your CI/CD pipeline UI
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<h3>Manual Publishing</h3>
|
||||
<div class="code-block"><code># Build and package
|
||||
dotnet pack --configuration Release -o dist/
|
||||
|
||||
# Upload to repository
|
||||
curl -X POST "https://library.silverlabs.uk/api/modules/publish" \
|
||||
-F "id=MyModule" \
|
||||
-F "name=My Awesome Module" \
|
||||
-F "version=1.0.0" \
|
||||
-F "description=A great module" \
|
||||
-F "author=Your Name" \
|
||||
-F "package=@@dist/MyModule.1.0.0.nupkg"</code></div>
|
||||
</div>
|
||||
|
||||
<!-- Available Modules Section -->
|
||||
<div class="sdk-section">
|
||||
<h2>📚 Available Modules</h2>
|
||||
<p>Browse and install modules from the SilverSHELL module repository:</p>
|
||||
|
||||
<div class="info-box">
|
||||
<strong>Module Repository:</strong> <a href="https://library.silverlabs.uk" target="_blank" style="color: #a78bfa;">library.silverlabs.uk</a>
|
||||
</div>
|
||||
|
||||
<h3>Featured Modules:</h3>
|
||||
<ul>
|
||||
<li><strong>Auth.Login</strong> - User authentication and login UI</li>
|
||||
<li><strong>Auth.Registration</strong> - User registration system</li>
|
||||
<li><strong>Auth.UserManagement</strong> - User administration</li>
|
||||
<li><strong>Auth.MyAccount</strong> - User profile management</li>
|
||||
<li><strong>ModuleBrowser</strong> - Browse and install modules from the UI</li>
|
||||
</ul>
|
||||
|
||||
<h3>Explore All Modules</h3>
|
||||
<div class="code-block"><code># List all available modules via API
|
||||
curl https://library.silverlabs.uk/api/modules
|
||||
|
||||
# Search for specific modules
|
||||
curl https://library.silverlabs.uk/api/modules/search?q=auth</code></div>
|
||||
</div>
|
||||
|
||||
<!-- Resources Section -->
|
||||
<div class="sdk-section">
|
||||
<h2>📖 Resources</h2>
|
||||
<ul>
|
||||
<li><strong>Module Repository API:</strong> <a href="https://library.silverlabs.uk/api/modules" target="_blank" style="color: #a78bfa;">https://library.silverlabs.uk/api/modules</a></li>
|
||||
<li><strong>Demo Application:</strong> <a href="https://demo.silverlabs.uk" target="_blank" style="color: #a78bfa;">https://demo.silverlabs.uk</a></li>
|
||||
<li><strong>GitLab Repository:</strong> <a href="https://gitlab.silverlabs.uk/silverlabs/silvershell" target="_blank" style="color: #a78bfa;">GitLab</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Support Section -->
|
||||
<div class="sdk-section">
|
||||
<h2>💬 Support</h2>
|
||||
<p>Need help? We're here for you:</p>
|
||||
<ul>
|
||||
<li><strong>Help Desk:</strong> <a href="https://helpdesk.silverlabs.uk" target="_blank" style="color: #a78bfa;">helpdesk.silverlabs.uk</a></li>
|
||||
<li><strong>Issues:</strong> <a href="https://gitlab.silverlabs.uk/silverlabs/silvershell/-/issues" target="_blank" style="color: #a78bfa;">GitLab Issues</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<a href="/" class="back-link">← Back to SilverLabs Home</a>
|
||||
</div>
|
||||
</div>
|
||||
64
BlazorApp/Components/Pages/Weather.razor
Normal file
64
BlazorApp/Components/Pages/Weather.razor
Normal file
@@ -0,0 +1,64 @@
|
||||
@page "/weather"
|
||||
@attribute [StreamRendering]
|
||||
|
||||
<PageTitle>Weather</PageTitle>
|
||||
|
||||
<h1>Weather</h1>
|
||||
|
||||
<p>This component demonstrates showing data.</p>
|
||||
|
||||
@if (forecasts == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th aria-label="Temperature in Celsius">Temp. (C)</th>
|
||||
<th aria-label="Temperature in Farenheit">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;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// Simulate asynchronous loading to demonstrate streaming rendering
|
||||
await Task.Delay(500);
|
||||
|
||||
var startDate = DateOnly.FromDateTime(DateTime.Now);
|
||||
var summaries = new[] { "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" };
|
||||
forecasts = 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();
|
||||
}
|
||||
|
||||
private class WeatherForecast
|
||||
{
|
||||
public DateOnly Date { get; set; }
|
||||
public int TemperatureC { get; set; }
|
||||
public string? Summary { get; set; }
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
}
|
||||
}
|
||||
6
BlazorApp/Components/Routes.razor
Normal file
6
BlazorApp/Components/Routes.razor
Normal file
@@ -0,0 +1,6 @@
|
||||
<Router AppAssembly="typeof(Program).Assembly">
|
||||
<Found Context="routeData">
|
||||
<RouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)" />
|
||||
<FocusOnNavigate RouteData="routeData" Selector="h1" />
|
||||
</Found>
|
||||
</Router>
|
||||
10
BlazorApp/Components/_Imports.razor
Normal file
10
BlazorApp/Components/_Imports.razor
Normal file
@@ -0,0 +1,10 @@
|
||||
@using System.Net.Http
|
||||
@using System.Net.Http.Json
|
||||
@using Microsoft.AspNetCore.Components.Forms
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@using static Microsoft.AspNetCore.Components.Web.RenderMode
|
||||
@using Microsoft.AspNetCore.Components.Web.Virtualization
|
||||
@using Microsoft.JSInterop
|
||||
@using SilverLabs.Website
|
||||
@using SilverLabs.Website.Components
|
||||
Reference in New Issue
Block a user