mirror of
https://github.com/hmaxnl/SharpRSS.git
synced 2025-01-18 21:04:21 +01:00
Reworking UI added theme toggle, fixed small errors in UI
This commit is contained in:
parent
3e570a40a2
commit
993302657a
|
@ -58,8 +58,8 @@ namespace SharpRss
|
||||||
if (category == null) return modelReturn;
|
if (category == null) return modelReturn;
|
||||||
await using SqliteConnection dbc = new SqliteConnection(ConnectionString);
|
await using SqliteConnection dbc = new SqliteConnection(ConnectionString);
|
||||||
dbc.Open();
|
dbc.Open();
|
||||||
int affected = await dbc.ExecuteAsync("INSERT OR REPLACE INTO category (id, name, hex_color, last_updated) VALUES (IFNULL((SELECT id FROM category WHERE name=@Name), @Id), @Name, @HexColor, @LastUpdated)",
|
int affected = await dbc.ExecuteAsync("INSERT OR REPLACE INTO category (id, name, hex_color, icon, last_updated) VALUES (IFNULL((SELECT id FROM category WHERE name=@Name), @Id), @Name, @HexColor, @Icon, @LastUpdated)",
|
||||||
new { Id = category.Id, Name = category.Name, HexColor = category.HexColor, LastUpdated = category.LastUpdated.ToUnixTimeMilliseconds() });
|
new { Id = category.Id, Name = category.Name, HexColor = category.HexColor, Icon = category.Icon, LastUpdated = category.LastUpdated.ToUnixTimeMilliseconds() });
|
||||||
if (affected <= 0) return modelReturn;
|
if (affected <= 0) return modelReturn;
|
||||||
var catModel = await GetCategoriesAsync();
|
var catModel = await GetCategoriesAsync();
|
||||||
modelReturn = catModel.Where(x => x.Name == category.Name).ToHashSet().FirstOrDefault() ?? null;
|
modelReturn = catModel.Where(x => x.Name == category.Name).ToHashSet().FirstOrDefault() ?? null;
|
||||||
|
|
|
@ -117,10 +117,10 @@ namespace SharpRss.Services
|
||||||
}
|
}
|
||||||
private async void SetupTestCategoriesAndFeedsAsync()
|
private async void SetupTestCategoriesAndFeedsAsync()
|
||||||
{
|
{
|
||||||
/*Log.Information("Setting up test data...");
|
Log.Information("Setting up test data...");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
CategoryModel? newsCategory = await CreateCategoryAsync(new CategoryModel() { Name = "News" });
|
CategoryModel? newsCategory = await CreateCategoryAsync(new CategoryModel() { Name = "News", Icon = "<g><rect fill=\"none\" height=\"24\" width=\"24\"/></g><g><path d=\"M22,3l-1.67,1.67L18.67,3L17,4.67L15.33,3l-1.66,1.67L12,3l-1.67,1.67L8.67,3L7,4.67L5.33,3L3.67,4.67L2,3v16 c0,1.1,0.9,2,2,2l16,0c1.1,0,2-0.9,2-2V3z M11,19H4v-6h7V19z M20,19h-7v-2h7V19z M20,15h-7v-2h7V15z M20,11H4V8h16V11z\"/></g>"});
|
||||||
if (newsCategory != null)
|
if (newsCategory != null)
|
||||||
{
|
{
|
||||||
await AddSubscriptionAsync("https://www.nu.nl/rss/Algemeen", newsCategory);
|
await AddSubscriptionAsync("https://www.nu.nl/rss/Algemeen", newsCategory);
|
||||||
|
@ -129,7 +129,7 @@ namespace SharpRss.Services
|
||||||
await AddSubscriptionAsync("http://news.google.com/?output=atom", newsCategory);
|
await AddSubscriptionAsync("http://news.google.com/?output=atom", newsCategory);
|
||||||
}
|
}
|
||||||
|
|
||||||
CategoryModel? techCategory = await CreateCategoryAsync(new CategoryModel() { Name = "Tech" });
|
CategoryModel? techCategory = await CreateCategoryAsync(new CategoryModel() { Name = "Tech", Icon = "<g><rect fill=\"none\" height=\"24\" width=\"24\"/></g><g><path d=\"M17,10.43V2H7v8.43c0,0.35,0.18,0.68,0.49,0.86l4.18,2.51l-0.99,2.34l-3.41,0.29l2.59,2.24L9.07,22L12,20.23L14.93,22 l-0.78-3.33l2.59-2.24l-3.41-0.29l-0.99-2.34l4.18-2.51C16.82,11.11,17,10.79,17,10.43z M13,12.23l-1,0.6l-1-0.6V3h2V12.23z\"/></g>"});
|
||||||
if (techCategory != null)
|
if (techCategory != null)
|
||||||
{
|
{
|
||||||
await AddSubscriptionAsync("https://itsfoss.com/feed", techCategory);
|
await AddSubscriptionAsync("https://itsfoss.com/feed", techCategory);
|
||||||
|
@ -138,7 +138,7 @@ namespace SharpRss.Services
|
||||||
await AddSubscriptionAsync("https://feeds.arstechnica.com/arstechnica/gadgets", techCategory);
|
await AddSubscriptionAsync("https://feeds.arstechnica.com/arstechnica/gadgets", techCategory);
|
||||||
}
|
}
|
||||||
|
|
||||||
CategoryModel? youtubeCategory = await CreateCategoryAsync(new CategoryModel() { Name = "YouTube" });
|
CategoryModel? youtubeCategory = await CreateCategoryAsync(new CategoryModel() { Name = "YouTube", Icon = "<path d=\"M10 15l5.19-3L10 9v6m11.56-7.83c.13.47.22 1.1.28 1.9.07.8.1 1.49.1 2.09L22 12c0 2.19-.16 3.8-.44 4.83-.25.9-.83 1.48-1.73 1.73-.47.13-1.33.22-2.65.28-1.3.07-2.49.1-3.59.1L12 19c-4.19 0-6.8-.16-7.83-.44-.9-.25-1.48-.83-1.73-1.73-.13-.47-.22-1.1-.28-1.9-.07-.8-.1-1.49-.1-2.09L2 12c0-2.19.16-3.8.44-4.83.25-.9.83-1.48 1.73-1.73.47-.13 1.33-.22 2.65-.28 1.3-.07 2.49-.1 3.59-.1L12 5c4.19 0 6.8.16 7.83.44.9.25 1.48.83 1.73 1.73z\"/>"});
|
||||||
if (youtubeCategory != null)
|
if (youtubeCategory != null)
|
||||||
{
|
{
|
||||||
await AddSubscriptionAsync("https://www.youtube.com/feeds/videos.xml?channel_id=UCXuqSBlHAE6Xw-yeJA0Tunw", youtubeCategory);
|
await AddSubscriptionAsync("https://www.youtube.com/feeds/videos.xml?channel_id=UCXuqSBlHAE6Xw-yeJA0Tunw", youtubeCategory);
|
||||||
|
@ -157,7 +157,7 @@ namespace SharpRss.Services
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log.Error(e, "Exception!");
|
Log.Error(e, "Exception!");
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
@inherits LayoutComponentBase
|
@inherits LayoutComponentBase
|
||||||
|
|
||||||
<MudThemeProvider IsDarkMode="true"/>
|
<MudThemeProvider @bind-IsDarkMode="@_darkTheme" Theme="_mainTheme"/>
|
||||||
<MudDialogProvider/>
|
<MudDialogProvider/>
|
||||||
<MudSnackbarProvider/>
|
<MudSnackbarProvider/>
|
||||||
<style>
|
<style>
|
||||||
|
@ -23,6 +23,7 @@
|
||||||
<MudIconButton Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start" OnClick="@((e) => DrawerToggle())"/>
|
<MudIconButton Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start" OnClick="@((e) => DrawerToggle())"/>
|
||||||
<MudText Typo="Typo.h6">SharpRSS</MudText>
|
<MudText Typo="Typo.h6">SharpRSS</MudText>
|
||||||
<MudSpacer/>
|
<MudSpacer/>
|
||||||
|
<MudToggleIconButton @bind-Toggled="@_darkTheme" Icon="@Icons.Material.Filled.LightMode" ToggledIcon="@Icons.Material.Filled.DarkMode"></MudToggleIconButton>
|
||||||
<MudIconButton Icon="@Icons.Custom.Brands.GitHub" Href="https://github.com/hmaxnl/SharpRSS" Target="_blank"></MudIconButton>
|
<MudIconButton Icon="@Icons.Custom.Brands.GitHub" Href="https://github.com/hmaxnl/SharpRSS" Target="_blank"></MudIconButton>
|
||||||
</MudAppBar>
|
</MudAppBar>
|
||||||
<MudDrawer @bind-Open="@_drawerOpen" ClipMode="DrawerClipMode.Always">
|
<MudDrawer @bind-Open="@_drawerOpen" ClipMode="DrawerClipMode.Always">
|
||||||
|
@ -34,6 +35,8 @@
|
||||||
</MudLayout>
|
</MudLayout>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
MudTheme _mainTheme = new MudTheme();
|
||||||
|
bool _darkTheme = true;
|
||||||
bool _drawerOpen = true;
|
bool _drawerOpen = true;
|
||||||
|
|
||||||
void DrawerToggle()
|
void DrawerToggle()
|
||||||
|
|
|
@ -31,7 +31,6 @@ if (!app.Environment.IsDevelopment())
|
||||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||||
app.UseHsts();
|
app.UseHsts();
|
||||||
}
|
}
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
|
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user