Reworking UI added theme toggle, fixed small errors in UI

This commit is contained in:
Max 2023-06-24 11:22:14 +02:00
parent 3e570a40a2
commit 993302657a
5 changed files with 11 additions and 9 deletions

View File

@ -58,8 +58,8 @@ namespace SharpRss
if (category == null) return modelReturn;
await using SqliteConnection dbc = new SqliteConnection(ConnectionString);
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)",
new { Id = category.Id, Name = category.Name, HexColor = category.HexColor, LastUpdated = category.LastUpdated.ToUnixTimeMilliseconds() });
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, Icon = category.Icon, LastUpdated = category.LastUpdated.ToUnixTimeMilliseconds() });
if (affected <= 0) return modelReturn;
var catModel = await GetCategoriesAsync();
modelReturn = catModel.Where(x => x.Name == category.Name).ToHashSet().FirstOrDefault() ?? null;

View File

@ -117,10 +117,10 @@ namespace SharpRss.Services
}
private async void SetupTestCategoriesAndFeedsAsync()
{
/*Log.Information("Setting up test data...");
Log.Information("Setting up test data...");
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)
{
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);
}
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)
{
await AddSubscriptionAsync("https://itsfoss.com/feed", techCategory);
@ -138,7 +138,7 @@ namespace SharpRss.Services
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)
{
await AddSubscriptionAsync("https://www.youtube.com/feeds/videos.xml?channel_id=UCXuqSBlHAE6Xw-yeJA0Tunw", youtubeCategory);
@ -157,7 +157,7 @@ namespace SharpRss.Services
catch (Exception e)
{
Log.Error(e, "Exception!");
}*/
}
}
}
}

View File

@ -1,6 +1,6 @@
@inherits LayoutComponentBase
<MudThemeProvider IsDarkMode="true"/>
<MudThemeProvider @bind-IsDarkMode="@_darkTheme" Theme="_mainTheme"/>
<MudDialogProvider/>
<MudSnackbarProvider/>
<style>
@ -23,6 +23,7 @@
<MudIconButton Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start" OnClick="@((e) => DrawerToggle())"/>
<MudText Typo="Typo.h6">SharpRSS</MudText>
<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>
</MudAppBar>
<MudDrawer @bind-Open="@_drawerOpen" ClipMode="DrawerClipMode.Always">
@ -34,6 +35,8 @@
</MudLayout>
@code {
MudTheme _mainTheme = new MudTheme();
bool _darkTheme = true;
bool _drawerOpen = true;
void DrawerToggle()

View File

@ -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.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();

Binary file not shown.