mirror of
https://github.com/Stefan-5422/-T5-Elektrifikatsiya.git
synced 2026-09-04 08:55:59 +02:00
Yeet 🎂
🐱🐉🎉🙌🤞
This commit is contained in:
@@ -16,11 +16,21 @@
|
||||
{
|
||||
BarOptions = new()
|
||||
{
|
||||
HorizontalHeight = "72px"
|
||||
HorizontalHeight = "72px",
|
||||
DarkColors = new()
|
||||
{
|
||||
ItemColorOptions = new()
|
||||
{
|
||||
ActiveBackgroundColor = "#1a237e",
|
||||
ActiveColor = "#1a237e",
|
||||
HoverColor = "#1a237e",
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
ColorOptions = new()
|
||||
{
|
||||
Primary = "#0288D1",
|
||||
Primary = "#1a237e",
|
||||
Secondary = "#A65529",
|
||||
Success = "#23C02E",
|
||||
Info = "#9BD8FE",
|
||||
@@ -31,7 +41,7 @@
|
||||
},
|
||||
BackgroundOptions = new()
|
||||
{
|
||||
Primary = "#0288D1",
|
||||
Primary = "#1a237e",
|
||||
Secondary = "#A65529",
|
||||
Success = "#23C02E",
|
||||
Info = "#9BD8FE",
|
||||
@@ -42,7 +52,12 @@
|
||||
},
|
||||
InputOptions = new()
|
||||
{
|
||||
CheckColor = "#0288D1",
|
||||
CheckColor = "#1a237e",
|
||||
},
|
||||
TextColorOptions = new()
|
||||
{
|
||||
Dark = "#000000",
|
||||
Primary = "#1a237e"
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<Bar Breakpoint="Breakpoint.Desktop" NavigationBreakpoint="Breakpoint.Tablet" ThemeContrast="ThemeContrast.Dark"
|
||||
Mode="BarMode.VerticalInline" CollapseMode="BarCollapseMode.Small">
|
||||
<BarToggler />
|
||||
<BarToggler TextColor="TextColor.Primary" />
|
||||
<BarBrand>
|
||||
<BarItem>
|
||||
<BarLink To="">
|
||||
@@ -12,28 +12,28 @@
|
||||
<BarMenu>
|
||||
<BarStart>
|
||||
<BarItem>
|
||||
<BarLink To="/">
|
||||
<BarIcon IconName="IconName.Dashboard" />
|
||||
<BarLink To="/" TextColor="TextColor.White">
|
||||
<BarIcon Style="color:white" IconName="IconName.Dashboard" />
|
||||
Dashboard
|
||||
</BarLink>
|
||||
</BarItem>
|
||||
<BarItem>
|
||||
<BarLink To="/">
|
||||
<BarIcon IconName="IconName.ShieldAlt" />
|
||||
<BarLink To="/" TextColor="TextColor.White">
|
||||
<BarIcon Style="color:white" IconName="IconName.ShieldAlt" />
|
||||
Admin
|
||||
</BarLink>
|
||||
</BarItem>
|
||||
<BarItem>
|
||||
<BarLink To="/">
|
||||
<BarIcon IconName="IconName.Plug" />
|
||||
<BarLink To="/" TextColor="TextColor.White">
|
||||
<BarIcon Style="color:white" IconName="IconName.Plug" />
|
||||
Add Plug
|
||||
</BarLink>
|
||||
</BarItem>
|
||||
</BarStart>
|
||||
<BarEnd>
|
||||
<BarItem>
|
||||
<BarLink To="/">
|
||||
<BarIcon IconName="IconName.Wrench" />
|
||||
<BarLink To="/" TextColor="TextColor.White">
|
||||
<BarIcon Style="color:white" IconName="IconName.Wrench" />
|
||||
Settings
|
||||
</BarLink>
|
||||
</BarItem>
|
||||
@@ -43,5 +43,6 @@
|
||||
@code {
|
||||
private bool pagesBarVisible = true;
|
||||
|
||||
RenderFragment customIcon =@<img src="/brand-logo.png" style="width:32px; height: 32px" />;
|
||||
//TODO: replace logo png with transparent background one
|
||||
RenderFragment customIcon =@<img src="/logo.png" style="width:32px; height: 32px" />;
|
||||
}
|
||||
@@ -1,160 +0,0 @@
|
||||
@using Blazorise.Localization
|
||||
|
||||
<Bar @bind-Visible="@topbarVisible" Breakpoint="Breakpoint.Desktop" Background="Background.Primary" ThemeContrast="ThemeContrast.Light">
|
||||
<BarBrand>
|
||||
<BarItem>
|
||||
<BarLink To="">
|
||||
<BarIcon Margin="Margin.Is2.FromEnd" IconName="IconName.Dashboard" />
|
||||
Elektrifikatsiya
|
||||
</BarLink>
|
||||
</BarItem>
|
||||
</BarBrand>
|
||||
<BarToggler />
|
||||
<BarMenu>
|
||||
<BarStart>
|
||||
<BarItem>
|
||||
<BarLink To="https://blazorise.com/docs/">Documentation</BarLink>
|
||||
</BarItem>
|
||||
<BarItem>
|
||||
<BarDropdown>
|
||||
<BarDropdownToggle>More</BarDropdownToggle>
|
||||
<BarDropdownMenu>
|
||||
<BarDropdownItem To="https://blazorise.com/docs/start/">
|
||||
Quick-Start Guide
|
||||
</BarDropdownItem>
|
||||
<BarDropdownDivider />
|
||||
<BarDropdownItem To="https://blazorise.com/docs/usage/">
|
||||
Usage
|
||||
</BarDropdownItem>
|
||||
</BarDropdownMenu>
|
||||
</BarDropdown>
|
||||
</BarItem>
|
||||
<BarItem>
|
||||
<BarDropdown>
|
||||
<BarDropdownToggle>Layout</BarDropdownToggle>
|
||||
<BarDropdownMenu>
|
||||
<BarDropdownItem Clicked="@(()=>OnLayoutTypeChecked("fixed-header"))">
|
||||
@if ( LayoutType == "fixed-header" )
|
||||
{
|
||||
<Icon Name="IconName.CheckCircle" TextColor="TextColor.Success" />
|
||||
}
|
||||
Fixed Header
|
||||
</BarDropdownItem>
|
||||
<BarDropdownItem Clicked="@(()=>OnLayoutTypeChecked("fixed-header-footer-only"))">
|
||||
@if ( LayoutType == "fixed-header-footer-only" )
|
||||
{
|
||||
<Icon Name="IconName.CheckCircle" TextColor="TextColor.Success" />
|
||||
}
|
||||
Fixed Header and Footer only
|
||||
</BarDropdownItem>
|
||||
<BarDropdownItem Clicked="@(()=>OnLayoutTypeChecked("sider-with-header-on-top"))">
|
||||
@if ( LayoutType == "sider-with-header-on-top" )
|
||||
{
|
||||
<Icon Name="IconName.CheckCircle" TextColor="TextColor.Success" />
|
||||
}
|
||||
Sider with Header on top
|
||||
</BarDropdownItem>
|
||||
</BarDropdownMenu>
|
||||
</BarDropdown>
|
||||
</BarItem>
|
||||
|
||||
|
||||
</BarStart>
|
||||
<BarEnd>
|
||||
<BarItem>
|
||||
<BarDropdown RightAligned>
|
||||
<BarDropdownToggle><Icon Name="IconName.Language" /></BarDropdownToggle>
|
||||
<BarDropdownMenu>
|
||||
@foreach ( var cultureInfo in LocalizationService.AvailableCultures )
|
||||
{
|
||||
<BarDropdownItem @key="@cultureInfo.Name" Clicked="@(()=>SelectCulture(cultureInfo.Name))">
|
||||
@if ( cultureInfo.IsNeutralCulture )
|
||||
{
|
||||
@cultureInfo.EnglishName
|
||||
}
|
||||
else
|
||||
{
|
||||
@cultureInfo.Parent.EnglishName
|
||||
}
|
||||
</BarDropdownItem>
|
||||
}
|
||||
</BarDropdownMenu>
|
||||
</BarDropdown>
|
||||
</BarItem>
|
||||
<BarItem>
|
||||
<BarDropdown RightAligned>
|
||||
<BarDropdownToggle><Icon Name="IconName.Tint" /> Theme</BarDropdownToggle>
|
||||
<BarDropdownMenu Style="padding: 15px; min-width:550px;">
|
||||
<Row>
|
||||
<Column Margin="Margin.Is2.FromBottom">
|
||||
<Field>
|
||||
<Switch TValue="bool" Checked="@(Theme?.Enabled == true)" CheckedChanged="@ThemeEnabledChanged">Theme enabled</Switch>
|
||||
</Field>
|
||||
</Column>
|
||||
</Row>
|
||||
<Row>
|
||||
<Column Margin="Margin.Is2.FromBottom">
|
||||
<Field>
|
||||
<Check TValue="bool" Checked="@(Theme?.IsGradient == true)" CheckedChanged="@ThemeGradientChanged">Gradient colors</Check>
|
||||
</Field>
|
||||
<Field>
|
||||
<Check TValue="bool" Checked="@(Theme?.IsRounded == true)" CheckedChanged="@ThemeRoundedChanged">Rounded elements</Check>
|
||||
</Field>
|
||||
</Column>
|
||||
</Row>
|
||||
<Row>
|
||||
<Column>
|
||||
<Container Fluid>
|
||||
<ThemeColorSelector Value="@(Theme?.ColorOptions?.Primary)" ValueChanged="@ThemeColorChanged"></ThemeColorSelector>
|
||||
</Container>
|
||||
</Column>
|
||||
</Row>
|
||||
</BarDropdownMenu>
|
||||
</BarDropdown>
|
||||
</BarItem>
|
||||
<BarItem>
|
||||
<BarLink To="https://github.com/Megabit/Blazorise">GitHub</BarLink>
|
||||
</BarItem>
|
||||
</BarEnd>
|
||||
</BarMenu>
|
||||
</Bar>
|
||||
@code {
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await SelectCulture( "en-US" );
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
Task SelectCulture( string name )
|
||||
{
|
||||
LocalizationService.ChangeLanguage( name );
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private bool topbarVisible = false;
|
||||
|
||||
Task OnLayoutTypeChecked( string layoutType )
|
||||
{
|
||||
LayoutType = layoutType;
|
||||
|
||||
return LayoutTypeChanged.InvokeAsync( layoutType );
|
||||
}
|
||||
|
||||
[Parameter] public EventCallback<bool> ThemeEnabledChanged { get; set; }
|
||||
|
||||
[Parameter] public EventCallback<bool> ThemeGradientChanged { get; set; }
|
||||
|
||||
[Parameter] public EventCallback<bool> ThemeRoundedChanged { get; set; }
|
||||
|
||||
[Parameter] public EventCallback<string> ThemeColorChanged { get; set; }
|
||||
|
||||
[Parameter] public string LayoutType { get; set; }
|
||||
|
||||
[Parameter] public EventCallback<string> LayoutTypeChanged { get; set; }
|
||||
|
||||
[Inject] protected ITextLocalizerService LocalizationService { get; set; }
|
||||
|
||||
[CascadingParameter] protected Theme Theme { get; set; }
|
||||
}
|
||||
@@ -18,10 +18,11 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Blazorise" Version="1.1.*" />
|
||||
<PackageReference Include="Blazorise.Components" Version="1.1.6" />
|
||||
<PackageReference Include="Blazorise.Material" Version="1.1.*" />
|
||||
<PackageReference Include="Blazorise.Icons.Material" Version="1.1.*" />
|
||||
<PackageReference Include="Blazorise" Version="1.2.0" />
|
||||
<PackageReference Include="Blazorise.Charts" Version="1.2.0" />
|
||||
<PackageReference Include="Blazorise.Components" Version="1.2.0" />
|
||||
<PackageReference Include="Blazorise.Material" Version="1.2.0" />
|
||||
<PackageReference Include="Blazorise.Icons.Material" Version="1.2.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.0" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -2,57 +2,8 @@
|
||||
@inherits LayoutComponentBase
|
||||
|
||||
|
||||
@if ( layoutType == "fixed-header" )
|
||||
{
|
||||
<Layout Sider>
|
||||
<LayoutSider>
|
||||
<LayoutSiderContent>
|
||||
<SideMenu />
|
||||
</LayoutSiderContent>
|
||||
</LayoutSider>
|
||||
<Layout>
|
||||
<LayoutHeader Fixed>
|
||||
<TopMenu ThemeEnabledChanged="@OnThemeEnabledChanged"
|
||||
ThemeGradientChanged="@OnThemeGradientChanged"
|
||||
ThemeRoundedChanged="@OnThemeRoundedChanged"
|
||||
ThemeColorChanged="@OnThemeColorChanged"
|
||||
@bind-LayoutType="@layoutType" />
|
||||
</LayoutHeader>
|
||||
<LayoutContent Padding="Padding.Is4.OnX.Is4.FromTop">
|
||||
@Body
|
||||
</LayoutContent>
|
||||
</Layout>
|
||||
</Layout>
|
||||
}
|
||||
else if ( layoutType == "fixed-header-footer-only" )
|
||||
{
|
||||
<Layout>
|
||||
<LayoutHeader Fixed>
|
||||
<TopMenu ThemeEnabledChanged="@OnThemeEnabledChanged"
|
||||
ThemeGradientChanged="@OnThemeGradientChanged"
|
||||
ThemeRoundedChanged="@OnThemeRoundedChanged"
|
||||
ThemeColorChanged="@OnThemeColorChanged"
|
||||
@bind-LayoutType="@layoutType" />
|
||||
</LayoutHeader>
|
||||
<LayoutContent Padding="Padding.Is4.OnX.Is4.FromTop">
|
||||
@Body
|
||||
</LayoutContent>
|
||||
<LayoutFooter Fixed>
|
||||
<FooterMenu></FooterMenu>
|
||||
</LayoutFooter>
|
||||
</Layout>
|
||||
}
|
||||
else if ( layoutType == "sider-with-header-on-top" )
|
||||
{
|
||||
<Layout>
|
||||
<LayoutHeader Fixed>
|
||||
<TopMenu ThemeEnabledChanged="@OnThemeEnabledChanged"
|
||||
ThemeGradientChanged="@OnThemeGradientChanged"
|
||||
ThemeRoundedChanged="@OnThemeRoundedChanged"
|
||||
ThemeColorChanged="@OnThemeColorChanged"
|
||||
@bind-LayoutType="@layoutType" />
|
||||
</LayoutHeader>
|
||||
<Layout Sider>
|
||||
|
||||
<Layout Sider>
|
||||
<LayoutSider>
|
||||
<LayoutSiderContent>
|
||||
<SideMenu />
|
||||
@@ -63,6 +14,4 @@ else if ( layoutType == "sider-with-header-on-top" )
|
||||
@Body
|
||||
</LayoutContent>
|
||||
</Layout>
|
||||
</Layout>
|
||||
</Layout>
|
||||
}
|
||||
</Layout>
|
||||
@@ -2,7 +2,8 @@
|
||||
@using Blazorise.Components;
|
||||
@using Elektrifikatsiya.Models;
|
||||
@inject IVersionProvider VersionProvider
|
||||
<Row>
|
||||
|
||||
<Row Padding="Padding.Is3">
|
||||
<Column ColumnSize="ColumnSize.Is6">
|
||||
<ListView TItem="Device"
|
||||
Data="@plugs"
|
||||
@@ -55,8 +56,67 @@
|
||||
</ListView>
|
||||
</Column>
|
||||
</Row>
|
||||
<Row Padding="Padding.Is3">
|
||||
<Column>
|
||||
<Button Color="Color.Primary" Clicked="@(async () => await HandleRedraw())">Aktualisieren</Button>
|
||||
<LineChart @ref="lineChart" TItem="double" />
|
||||
</Column>
|
||||
</Row>
|
||||
|
||||
@code {
|
||||
List<Event> events = new List<Event>() { new Event("Jude", "Alles kaputt", DateTime.Now), new Event("Jude", "Alles kaputt", DateTime.Now), new Event("Jude", "Alles kaputt", DateTime.Now) };
|
||||
//TODO: insert new event here if plug produces one
|
||||
List<Event> events = new List<Event>() { new Event("Placeholder", "Placeholder", DateTime.Now), new Event("Placeholder", "Placeholder", DateTime.Now), new Event("Placeholder", "Placeholder", DateTime.Now) };
|
||||
//TODO: insert new Device here if user adds one
|
||||
List<Device> plugs = new List<Device>() { new Device("Placeholder", "Plug", System.Net.IPAddress.Broadcast, 60, "Oldin", "4AHINF"), new Device("Placeholder", "Plug", System.Net.IPAddress.Broadcast, 60, "Oldin", "4AHINF"), new Device("Placeholder", "Plug", System.Net.IPAddress.Broadcast, 60, "Oldin", "4AHINF") };
|
||||
|
||||
//code for graph
|
||||
LineChart<double> lineChart;
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
await HandleRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
async Task HandleRedraw()
|
||||
{
|
||||
await lineChart.Clear();
|
||||
|
||||
await lineChart.AddLabelsDatasetsAndUpdate(Labels, GetLineChartDataset());
|
||||
}
|
||||
|
||||
//TODO: insert dataset of current and last voltage usages
|
||||
LineChartDataset<double> GetLineChartDataset()
|
||||
{
|
||||
return new LineChartDataset<double>
|
||||
{
|
||||
Label = "# of random number in thousands",
|
||||
Data = RandomizeData(),
|
||||
BackgroundColor = backgroundColors,
|
||||
BorderColor = borderColors,
|
||||
Fill = true,
|
||||
PointRadius = 3,
|
||||
CubicInterpolationMode = "monotone",
|
||||
};
|
||||
}
|
||||
|
||||
string[] Labels = { "Red", "Blue", "Yellow", "Green", "Purple", "Orange" };
|
||||
List<string> backgroundColors = new List<string> { ChartColor.FromRgba(255, 99, 132, 0.2f), ChartColor.FromRgba(54, 162, 235, 0.2f), ChartColor.FromRgba(255, 206, 86, 0.2f), ChartColor.FromRgba(75, 192, 192, 0.2f), ChartColor.FromRgba(153, 102, 255, 0.2f), ChartColor.FromRgba(255, 159, 64, 0.2f) };
|
||||
List<string> borderColors = new List<string> { ChartColor.FromRgba(255, 99, 132, 1f), ChartColor.FromRgba(54, 162, 235, 1f), ChartColor.FromRgba(255, 206, 86, 1f), ChartColor.FromRgba(75, 192, 192, 1f), ChartColor.FromRgba(153, 102, 255, 1f), ChartColor.FromRgba(255, 159, 64, 1f) };
|
||||
|
||||
List<double> RandomizeData()
|
||||
{
|
||||
var r = new Random(DateTime.Now.Millisecond);
|
||||
|
||||
return new List<double> {
|
||||
r.Next( 3, 50 ) * r.NextDouble(),
|
||||
r.Next( 3, 50 ) * r.NextDouble(),
|
||||
r.Next( 3, 50 ) * r.NextDouble(),
|
||||
r.Next( 3, 50 ) * r.NextDouble(),
|
||||
r.Next( 3, 50 ) * r.NextDouble(),
|
||||
r.Next( 3, 50 ) * r.NextDouble() };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,3 +6,4 @@
|
||||
}
|
||||
|
||||
<component type="typeof(App)" render-mode="Server" />
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.7.1/chart.min.js"></script>
|
||||
|
||||
@@ -40,5 +40,6 @@
|
||||
|
||||
<script src="js/material/material.min.js"></script>
|
||||
<script src="_framework/blazor.server.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.7.1/chart.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -9,3 +9,4 @@
|
||||
|
||||
@using Elektrifikatsiya
|
||||
@using Blazorise
|
||||
@using Blazorise.Charts
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 264 KiB |
Reference in New Issue
Block a user