Skip to content

Commit

Permalink
updated way of doing it ,pretty hacky but works
Browse files Browse the repository at this point in the history
  • Loading branch information
pieckenst committed Nov 14, 2024
1 parent 2772884 commit 8a679dd
Show file tree
Hide file tree
Showing 69 changed files with 1,158 additions and 485 deletions.
Binary file modified .vs/handlerlaunch/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file modified .vs/handlerlaunch/v17/.suo
Binary file not shown.
107 changes: 65 additions & 42 deletions .vs/handlerlaunch/v17/DocumentLayout.backup.json

Large diffs are not rendered by default.

103 changes: 63 additions & 40 deletions .vs/handlerlaunch/v17/DocumentLayout.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions LaunchApp/LaunchApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AKSoftware.Blazor.Utilities" Version="1.1.0" />
<PackageReference Include="LumexUI" Version="1.0.0-preview.3" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.10" PrivateAssets="all" />
Expand Down
10 changes: 10 additions & 0 deletions LaunchApp/Models/models.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace LaunchApp.Models
{
public class NavLink
{
public string Text { get; set; }

Check warning on line 5 in LaunchApp/Models/models.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Text' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
public string Url { get; set; }

Check warning on line 6 in LaunchApp/Models/models.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Url' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
public string Icon { get; set; }

Check warning on line 7 in LaunchApp/Models/models.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Icon' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
public bool IsActive { get; set; }
}
}
11 changes: 2 additions & 9 deletions LaunchApp/Pages/ChroniclesOfSpellborn.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@inject MasaBlazor MasaBlazor

<PageTitle>Chronicles of Spellborn</PageTitle>
<GameSubHeader IsVisible="true" NavigationLinks="@_navLinks" />


<MContainer Fluid>
<div class="game-header">
Expand Down Expand Up @@ -184,14 +184,7 @@
</style>

@code {
private List<GameSubHeader.NavLink> _navLinks = new()
{
new() { Text = "About", Url = "#", IsActive = true },
new() { Text = "Shop", Url = "#" },
new() { Text = "News", Url = "#" },
new() { Text = "Guides", Url = "#" },
new() { Text = "Updates", Url = "#" }
};

private string gamepathersinp = "";
bool showModal = false;
void ModalOk()
Expand Down
46 changes: 29 additions & 17 deletions LaunchApp/Pages/Counter.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
@inject IJSRuntime jsRuntime
@inject MasaBlazor MasaBlazor
@using System.Security.Cryptography;
@using AKSoftware.Blazor.Utilities

<PageTitle>FFXIV Login</PageTitle>
<GameSubHeader IsVisible="true" NavigationLinks="@_navLinks" />

<MContainer Fluid>
<div class="game-header">
<MImage Src="https://img.finalfantasyxiv.com/lds/h/V/U5TjBZoXVbddg1ZB7H4k0fkYqo.jpg"
Expand Down Expand Up @@ -172,14 +173,18 @@
}
.header-content {
position: absolute;
top: 0;
left: 0;
right: 0;
padding: 2rem;
color: white;
animation: fadeIn 0.5s ease-out 0.2s forwards;
}
position: absolute;
top: 0;
left: 0;
right: 0;
padding: 2rem;
color: var(--foreground);
animation: fadeIn 0.5s ease-out 0.2s forwards;
}
[data-theme="light"] .header-content {
color: var(--background);
}
.play-card {
padding: 1rem;
Expand Down Expand Up @@ -215,14 +220,7 @@
}
</style>
@code {
private List<GameSubHeader.NavLink> _navLinks = new()
{
new() { Text = "About", Url = "#", IsActive = true },
new() { Text = "Shop", Url = "#" },
new() { Text = "News", Url = "#" },
new() { Text = "Guides", Url = "#" },
new() { Text = "Updates", Url = "#" }
};

private string statusstring = "Awaiting input";
private string usernameinp = "";
private string passinp = "";
Expand All @@ -232,6 +230,18 @@
private bool checkedValue;
bool showModal = false;

protected override void OnInitialized()
{
var links = new List<(string Text, string Url, string Icon, bool IsActive)>
{
("Overview", "", "", true),
("Characters", "characters", "", false),
("Shop", "shop", "", false)
};

MessagingCenter.Send(this, "update_nav", links);
}

void ModalShow() => showModal = true;
void ModalCancel() => showModal = false;
void ModalOk()
Expand All @@ -240,6 +250,8 @@
showModal = false;
}



private async Task<(string encrypted, string hash)> EncryptPassword(string password)
{
try
Expand Down
6 changes: 6 additions & 0 deletions LaunchApp/Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@
</style>

@code {

protected override void OnInitialized()
{
// Send message to hide subheader when landing page loads
MessagingCenter.Send(this, "hide_subheader");
}
private List<GameInfo> _games = new()
{
new GameInfo
Expand Down
193 changes: 140 additions & 53 deletions LaunchApp/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
@using LumexUI
@* MainLayout.razor *@
@using LumexUI
@using LumexUI.Common
@using LaunchApp.Pages
@using LaunchApp.Models
@using AKSoftware.Blazor.Utilities
@inherits LayoutComponentBase
@inject MasaBlazor MasaBlazor
@inject IJSRuntime JSRuntime
Expand All @@ -10,60 +14,89 @@
<MApp Dark="@MasaBlazor.Theme.Dark">
<MErrorHandler DisablePopupIfErrorContentRender>
<ChildContent>
<LumexNavbar Class="default-app-bar" ShouldHideOnScroll>
<LumexNavbarContent>
<LumexNavbarMenuToggle Class="sm:hidden" />
<LumexNavbarBrand Class="ml-4">
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
<path clip-rule="evenodd"
d="M17.6482 10.1305L15.8785 7.02583L7.02979 22.5499H10.5278L17.6482 10.1305ZM19.8798 14.0457L18.11 17.1983L19.394 19.4511H16.8453L15.1056 22.5499H24.7272L19.8798 14.0457Z"
fill="currentColor" />
</svg>
<span class="font-bold text-xl ml-2">Game Launcher</span>
</LumexNavbarBrand>
</LumexNavbarContent>

<LumexNavbarContent Class="hidden sm:flex justify-center flex-1">
<LumexNavbarItem>
<LumexLink Href="" Color="@ThemeColor.None">
<MIcon>mdi-home</MIcon>
Home
</LumexLink>
</LumexNavbarItem>
</LumexNavbarContent>

<LumexNavbarContent Justify="End">
<LumexNavbarItem>
<LumexSwitch
StartIcon="@LumexUI.Icons.Rounded.LightMode"
EndIcon="@LumexUI.Icons.Rounded.DarkMode"
Color="@ThemeColor.Danger"
Size="@Size.Medium"
Value="@MasaBlazor.Theme.Dark"
ValueChanged="@(async (v) => {
MasaBlazor.ToggleTheme();
await JSRuntime.InvokeVoidAsync("switchTheme", MasaBlazor.Theme.Dark);
})">
Dark Mode
</LumexSwitch>
</LumexNavbarItem>
<LumexNavbarItem>
<LumexButton Size="@Size.Small" Color="@ThemeColor.Primary" Variant="@Variant.Flat">
Launch Game
</LumexButton>
</LumexNavbarItem>
</LumexNavbarContent>

<LumexNavbarMenu Class="sm:hidden">
<LumexNavbarMenuItem>
<LumexLink Href="" Color="@ThemeColor.None">Home</LumexLink>
</LumexNavbarMenuItem>
</LumexNavbarMenu>
</LumexNavbar>
<div class="navbar-wrapper">
<LumexNavbar Class="default-app-bar" ShouldHideOnScroll>
<LumexNavbarContent>
<LumexNavbarMenuToggle Class="sm:hidden" />
<LumexNavbarBrand Class="ml-4">
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
<path clip-rule="evenodd" d="M17.6482 10.1305L15.8785 7.02583L7.02979 22.5499H10.5278L17.6482 10.1305ZM19.8798 14.0457L18.11 17.1983L19.394 19.4511H16.8453L15.1056 22.5499H24.7272L19.8798 14.0457Z" fill="currentColor" />
</svg>
<span class="font-bold text-xl ml-2">Game Launcher</span>
</LumexNavbarBrand>
</LumexNavbarContent>

<LumexNavbarContent Class="hidden sm:flex justify-center flex-1">
<LumexNavbarItem>
<LumexLink Href="" Color="@ThemeColor.None">
<MIcon>mdi-home</MIcon>
Home
</LumexLink>
</LumexNavbarItem>
</LumexNavbarContent>

<LumexNavbarContent Justify="End">
<LumexNavbarItem>
<LumexSwitch StartIcon="@LumexUI.Icons.Rounded.LightMode"
EndIcon="@LumexUI.Icons.Rounded.DarkMode"
Size="@Size.Small"
Value="@MasaBlazor.Theme.Dark"
ValueChanged="@(async (v) => {
MasaBlazor.ToggleTheme();
await JSRuntime.InvokeVoidAsync("switchTheme", MasaBlazor.Theme.Dark);
})" />
</LumexNavbarItem>
<LumexNavbarItem>
<LumexButton Size="@Size.Small" Color="@ThemeColor.Primary" Variant="@Variant.Flat">
Launch Game
</LumexButton>
</LumexNavbarItem>
</LumexNavbarContent>

<LumexNavbarMenu Class="sm:hidden">
<LumexNavbarMenuItem>
<LumexLink Href="" Color="@ThemeColor.None">Home</LumexLink>
</LumexNavbarMenuItem>
@if (ShowGameNav)
{
@foreach (var link in GameNavLinks)
{
<LumexNavbarMenuItem>
<LumexLink Href="@link.Url" Color="@ThemeColor.None">@link.Text</LumexLink>
</LumexNavbarMenuItem>
}
}
</LumexNavbarMenu>
</LumexNavbar>

@if (ShowGameNav)
{
<div class="game-subheader">
<LumexNavbar Dense ShouldHideOnScroll>
<LumexNavbarContent Class="justify-center">
@foreach (var link in GameNavLinks)
{
<LumexNavbarItem>
<LumexLink Href="@link.Url"
Color="@ThemeColor.None"
Class="@(link.IsActive ? "active-link" : "")">
@if (!string.IsNullOrEmpty(link.Icon))
{
<MIcon Size="20" Class="mr-2">@link.Icon</MIcon>
}
@link.Text
</LumexLink>
</LumexNavbarItem>
}
</LumexNavbarContent>
</LumexNavbar>
</div>
}
</div>

<MMain>
<MTransition Name="fade-transition">

Check warning on line 98 in LaunchApp/Shared/MainLayout.razor

View workflow job for this annotation

GitHub Actions / build

Found markup element with unexpected name 'MTransition'. If this is intended to be a component, add a @using directive for its namespace.
<div class="game-content">
<div class="game-content @(ShowGameNav ? "with-subheader" : "")">
@Body
</div>
</MTransition>
Expand All @@ -73,28 +106,80 @@
</MApp>

<style>
.navbar-wrapper {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 100;
}
.game-content {
min-height: 100vh;
background-color: var(--theme-background);
transition: background-color 0.3s ease;
padding-top: var(--navbar-height);
}
.game-content.with-subheader {
padding-top: calc(var(--navbar-height) + 48px);
}
.default-app-bar {
border-bottom: 1px solid rgba(255,255,255,0.12);
}
</style>
.game-subheader {
width: 100%;
background: var(--background-secondary);
border-bottom: 1px solid var(--subheader-border);
}
.active-link {
color: var(--primary) !important;
border-bottom: 2px solid var(--primary);
}
.header-content {
position: absolute;
top: 0;
left: 0;
right: 0;
padding: 2rem;
color: var(--foreground);
animation: fadeIn 0.5s ease-out 0.2s forwards;
}
[data-theme="light"] .header-content {
color: var(--background);
}
</style>

@code {
private DotNetObjectReference<MainLayout>? _objRef;
public bool ShowGameNav { get; set; }
public List<(string Text, string Url, string Icon, bool IsActive)> GameNavLinks { get; set; } = new();

protected override async Task OnInitializedAsync()
{
_objRef = DotNetObjectReference.Create(this);
MasaBlazor.MobileChanged += MasaBlazorOnMobileChanged;
await InitializeTheme();

MessagingCenter.Subscribe<Counter, List<(string, string, string, bool)>>(
this, "update_nav", (sender, links) =>
{
GameNavLinks = links;
ShowGameNav = true;
StateHasChanged();
});

MessagingCenter.Subscribe<LaunchApp.Pages.Index>(this, "hide_subheader", (sender) =>
{
ShowGameNav = false;
GameNavLinks.Clear();
StateHasChanged();
});
}

private async Task InitializeTheme()
Expand Down Expand Up @@ -124,5 +209,7 @@
{
MasaBlazor.MobileChanged -= MasaBlazorOnMobileChanged;
_objRef?.Dispose();
MessagingCenter.Unsubscribe<Counter, List<(string, string, string, bool)>>(this, "update_nav");
MessagingCenter.Unsubscribe<LaunchApp.Pages.Index>(this, "hide_subheader");
}
}
2 changes: 2 additions & 0 deletions LaunchApp/_Imports.razor
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@
@using LaunchApp.Shared
@using Masa.Blazor
@using LumexUI
@using AKSoftware.Blazor.Utilities

Binary file not shown.
Binary file modified LaunchApp/bin/Debug/net8.0/LaunchApp.dll
Binary file not shown.
Binary file modified LaunchApp/bin/Debug/net8.0/LaunchApp.pdb
Binary file not shown.
Loading

0 comments on commit 8a679dd

Please sign in to comment.