Compare commits

...

2 Commits

Author SHA1 Message Date
fa6e8bf7cc read feeds implemented 2024-09-09 12:21:47 +02:00
c744b55de4 blazor ui css works 2024-09-07 15:21:16 +02:00
22 changed files with 187 additions and 109 deletions

View File

@ -15,7 +15,7 @@ namespace RBLNews.Maui
});
builder.Services.AddMauiBlazorWebView();
builder.Services.AddAntDesign();
builder.Services.AddBlazorBootstrap();
#if DEBUG
builder.Services.AddBlazorWebViewDeveloperTools();

View File

@ -58,6 +58,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Blazor.Bootstrap" Version="3.0.0" />
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="$(MauiVersion)" />

View File

@ -5,7 +5,12 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
<title>RBLNews.Maui</title>
<base href="/" />
<link rel="stylesheet" href="_content/RBLNews.Shared/css/bootstrap/bootstrap.min.css" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet" />
<link href="_content/RBLNews.Shared/blazor.bootstrap.css" rel="stylesheet" />
<!--<link rel="stylesheet" href="_content/RBLNews.Shared/css/bootstrap/bootstrap.min.css" />-->
<link rel="stylesheet" href="_content/RBLNews.Shared/css/app.css" />
<link rel="stylesheet" href="RBLNews.Maui.styles.css" />
<link rel="icon" type="image/png" href="favicon.png" />
@ -23,6 +28,14 @@
<a class="dismiss">🗙</a>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
<!-- Add chart.js reference if chart components are used in your application. -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.0.1/chart.umd.js" integrity="sha512-gQhCDsnnnUfaRzD8k1L5llCCV6O9HN09zClIzzeJ8OJ9MpGmIlCxm+pdCkqTwqJ4JcjbojFr79rl2F1mzcoLMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!-- Add chartjs-plugin-datalabels.min.js reference if chart components with data label feature is used in your application. -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/chartjs-plugin-datalabels/2.2.0/chartjs-plugin-datalabels.min.js" integrity="sha512-JPcRR8yFa8mmCsfrw4TNte1ZvF1e3+1SdGMslZvmrzDYxS69J7J49vkFL8u6u8PlPJK+H3voElBtUCzaXj+6ig==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!-- Add sortable.js reference if SortableList component is used in your application. -->
<script src="https://cdn.jsdelivr.net/npm/sortablejs@latest/Sortable.min.js"></script>
<script src="_framework/blazor.webview.js" autostart="false"></script>
</body>

View File

@ -1,14 +1,16 @@
@inherits LayoutComponentBase
<NavMenu />
<div class="page">
<div class="sidebar">
<NavMenu />
</div>
@* <div class="sidebar">
<NavMenu />
</div> *@
<main>
<div class="top-row px-4">
@* <div class="top-row px-4">
<a href="https://learn.microsoft.com/aspnet/core/" target="_blank">About</a>
</div>
</div> *@
<article class="content px-4">
@Body

View File

@ -1,9 +1,9 @@
<div class="top-row ps-3 navbar navbar-dark">
<div class="container-fluid">
<a class="navbar-brand" href="">RBLNews.Maui</a>
<a class="navbar-brand" href="">RBL News auf einen Blick!</a>
</div>
</div>
@*
<input type="checkbox" title="Navigation menu" class="navbar-toggler" />
<div class="nav-scrollable" onclick="document.querySelector('.navbar-toggler').click()">
@ -14,7 +14,7 @@
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="counter">
<NavLink class="nav-link" href="feeds">
<span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> Counter
</NavLink>
</div>
@ -25,3 +25,4 @@
</div>
</nav>
</div>
*@

View File

@ -1,16 +0,0 @@
@page "/counter"
<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++;
}
}

View File

@ -0,0 +1,67 @@
@page "/"
@using RBLFeederCommon.Models.RssFeed
@using RBLNews.Shared.Enums
@if (rssVM == null)
{
<div class="d-flex justify-content-center">
Lade Feeds ...
<Spinner Type="SpinnerType.Grow" Color="SpinnerColor.Primary" Size="SpinnerSize.Large" />
</div>
}
else
{
<div class="row">
@foreach (FeedGroupVM feedGrp in rssVM.FeedGroups)
{
<h3>@feedGrp.PublishDate</h3>
@foreach (FeedVM feed in feedGrp.Feeds)
{
<div class="col-sm-12 col-md-9 col-lg-6">
<Card>
<CardBody>
<CardTitle>@feed.Title</CardTitle>
<CardText>@feed.Description</CardText>
</CardBody>
<CardFooter>
@GetRssSourceName((RssFeedSources)@feed.Source) | @feed.PubDate <Button Color="ButtonColor.Primary" To="@feed.Link" Type="ButtonType.Link">Öffnen</Button>
</CardFooter>
</Card>
<br />
</div>
}
}
</div>
}
@code {
private RssVM rssVM;
HttpClient httpClient = new HttpClient();
protected async override Task OnInitializedAsync()
{
rssVM = await httpClient.GetFromJsonAsync<RssVM>("https://rblnews.de/api/feeds");
}
private string GetRssSourceName(RssFeedSources source)
{
switch (source)
{
case RssFeedSources.RbLive:
case RssFeedSources.NitterRbLive:
return "RBLive!";
case RssFeedSources.NitterFabrizioRomano:
return "Fabrizio Romano";
case RssFeedSources.Lvz:
return "LVZ";
case RssFeedSources.Kicker:
return "Kicker";
case RssFeedSources.Bild:
return "BILD";
case RssFeedSources.Transfermarkt:
return "Transfermarkt";
default:
return "?";
}
}
}

View File

@ -1,7 +0,0 @@
@page "/"
<h1>Hello, world!</h1>
Welcome to your new app.
<Button Type="primary">Hello World from ANT CSS!</Button>

View File

@ -1,61 +0,0 @@
@page "/weather"
<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>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;
protected override async Task OnInitializedAsync()
{
// Simulate asynchronous loading to demonstrate a loading indicator
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);
}
}

View File

@ -0,0 +1,13 @@
namespace RBLNews.Shared.Enums
{
public enum RssFeedSources
{
Lvz,
Kicker,
Bild,
Transfermarkt,
NitterRbLive,
NitterFabrizioRomano,
RbLive
}
}

View File

@ -0,0 +1,12 @@
using Newtonsoft.Json;
namespace RBLFeederCommon.Models.RssFeed;
public class FeedGroupVM
{
[JsonProperty("pubDate")]
public DateTime PublishDate { get; set; }
[JsonProperty("news")]
public IList<FeedVM> Feeds { get; set; }
}

View File

@ -0,0 +1,27 @@
using Newtonsoft.Json;
namespace RBLFeederCommon.Models.RssFeed;
public class FeedVM
{
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("title")]
public string Title { get; set; }
[JsonProperty("imgUrl")]
public string ImgUrl { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
[JsonProperty("pubDate")]
public DateTime? PubDate { get; set; }
[JsonProperty("link")]
public string Link { get; set; }
[JsonProperty("source")]
public int Source { get; set; }
}

View File

@ -0,0 +1,17 @@
using Newtonsoft.Json;
namespace RBLFeederCommon.Models.RssFeed;
public class RssVM
{
[JsonProperty("lastUpdate")]
public DateTime LastUpdate { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
[JsonProperty("feedGroups")]
public IList<FeedGroupVM> FeedGroups { get; set; } = new List<FeedGroupVM>();
}

View File

@ -13,7 +13,9 @@
<ItemGroup>
<PackageReference Include="AntDesign" Version="0.20.3" />
<PackageReference Include="Blazor.Bootstrap" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.8" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>

View File

@ -1,4 +1,4 @@
@* ANT CSS DESIGN IMPORT -------------------- *@
@using AntDesign
@using BlazorBootstrap;
@using Microsoft.AspNetCore.Components.Web

View File

@ -1,4 +1,4 @@
html, body {
/*html, body {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
@ -84,3 +84,4 @@ h1:focus {
padding-left: env(safe-area-inset-left);
}
}
*/

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,11 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="/" />
<link rel="stylesheet" href="_content/RBLNews.Shared/css/bootstrap/bootstrap.min.css" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet" />
<link href="_content/RBLNews.Shared/blazor.bootstrap.css" rel="stylesheet" />
@* <link rel="stylesheet" href="_content/RBLNews.Shared/css/bootstrap/bootstrap.min.css" /> *@
<link rel="stylesheet" href="_content/RBLNews.Shared/css/app.css" />
<link rel="stylesheet" href="RBLNews.Web.styles.css" />
<HeadOutlet @rendermode="InteractiveServer" />
@ -13,7 +17,13 @@
<body>
<Routes @rendermode="InteractiveServer" />
<AntContainer @rendermode="RenderMode.InteractiveAuto" />
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
<!-- Add chart.js reference if chart components are used in your application. -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.0.1/chart.umd.js" integrity="sha512-gQhCDsnnnUfaRzD8k1L5llCCV6O9HN09zClIzzeJ8OJ9MpGmIlCxm+pdCkqTwqJ4JcjbojFr79rl2F1mzcoLMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!-- Add chartjs-plugin-datalabels.min.js reference if chart components with data label feature is used in your application. -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/chartjs-plugin-datalabels/2.2.0/chartjs-plugin-datalabels.min.js" integrity="sha512-JPcRR8yFa8mmCsfrw4TNte1ZvF1e3+1SdGMslZvmrzDYxS69J7J49vkFL8u6u8PlPJK+H3voElBtUCzaXj+6ig==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!-- Add sortable.js reference if SortableList component is used in your application. -->
<script src="https://cdn.jsdelivr.net/npm/sortablejs@latest/Sortable.min.js"></script>
<script src="_framework/blazor.web.js"></script>
</body>

View File

@ -3,7 +3,7 @@
@using RBLNews.Shared.Components
@* ANT CSS DESIGN IMPORT -------------------- *@
@using AntDesign
@using BlazorBootstrap;
@* DEFAULT IMPORTS -------------------------- *@
@using System.Net.Http

View File

@ -5,7 +5,7 @@ var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents();
builder.Services.AddAntDesign();
builder.Services.AddBlazorBootstrap();
var app = builder.Build();

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
@ -14,4 +14,8 @@
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Blazor.Bootstrap" Version="3.0.0" />
</ItemGroup>
</Project>