Merge branch 'master' of http://188.181.83.156:6969/BOTAlex/Otakians
This commit is contained in:
commit
607394c99a
|
@ -20,13 +20,15 @@
|
|||
<MudGrid Spacing="6" Justify="Justify.Center">
|
||||
@for (int i = 0; i < 100; i++)
|
||||
{
|
||||
<MudItem>
|
||||
<MudPaper Class="md-8 rounded-lg" Style="position:relative">
|
||||
int postId = (LoadedImages.Count > i) ? LoadedImages[i] : GetRandomImageNumber();
|
||||
|
||||
<MudItem @onclick="() => ClickPost(postId)">
|
||||
<MudPaper Class="md-8" Style="position:relative">
|
||||
<MudContainer Style="position:absolute;" Class="mt-4">
|
||||
<MudText Style="background-color:rgba(0, 0, 0, 0.6); backdrop-filter:blur(2px)" Class="pl-2 rounded-t-lg py-2" Color="Color.Surface" Typo="Typo.h6">@("@" + RandomUsernames[random.Next(0, RandomUsernames.Length)])</MudText>
|
||||
<MudText Style="background-color:rgba(0, 0, 0, 0.55); backdrop-filter:blur(2px)" Class="pl-2 rounded-t-lg" Color="Color.Secondary" Typo="Typo.h6">@("@" + RandomUsernames[postId])</MudText>
|
||||
</MudContainer>
|
||||
<MudContainer>
|
||||
<MudImage Class="rounded-lg my-4" Src="@GetRandomImage()" Height="250" Width="250"></MudImage>
|
||||
<MudImage Class="rounded-lg my-4" Src="@GetImage(postId)" Height="250" Width="250"></MudImage>
|
||||
</MudContainer>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
|
@ -51,7 +53,7 @@
|
|||
|
||||
private Random random = new Random();
|
||||
const int numImages = 211;
|
||||
string GetRandomImage()
|
||||
int GetRandomImageNumber()
|
||||
{
|
||||
int selectedImage;
|
||||
reselect:
|
||||
|
@ -60,21 +62,30 @@
|
|||
goto reselect;
|
||||
|
||||
LoadedImages.Add(selectedImage);
|
||||
return $@"\images\AnimeImages\AnimeImage ({selectedImage}).jpeg";
|
||||
return selectedImage;
|
||||
}
|
||||
|
||||
string GetImage(int imageIndex)
|
||||
{
|
||||
return $@"\images\AnimeImages\AnimeImage ({imageIndex}).jpeg";
|
||||
}
|
||||
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
if (!firstRender)
|
||||
{
|
||||
LoadedImages.Clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TODO: Add a "save post" button to each post.
|
||||
|
||||
string[] RandomUsernames = new string[1000];
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
RandomUsernames = (await Http.GetStringAsync("RandomUsernames.txt")).Split("\n");
|
||||
}
|
||||
|
||||
void ClickPost(int postImage)
|
||||
{
|
||||
Console.WriteLine(postImage);
|
||||
}
|
||||
}
|
|
@ -4,16 +4,12 @@
|
|||
|
||||
<MudLayout Class="overflow-hidden">
|
||||
<MudAppBar Elevation="1">
|
||||
@* <MudIconButton Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start" OnClick="@((e) => ToggleDrawer())" />
|
||||
*@
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="AddUser">Primary</MudButton>
|
||||
<MudSpacer />
|
||||
<MudAvatar Class="mr-n2">
|
||||
<MudImage Src="images/BOTAlex.png"></MudImage>
|
||||
</MudAvatar>
|
||||
<MudAvatar Style="cursor:pointer" @onclick="ToggleDrawer" Variant="Variant.Outlined" Color="Color.Success" Class="mr-n2">BT</MudAvatar>
|
||||
</MudAppBar>
|
||||
|
||||
<MudDrawer @bind-Open="@openStart" ClipMode="DrawerClipMode.Always" Breakpoint="Breakpoint.Lg" PreserveOpenState="false" Elevation="1" Variant="@DrawerVariant.Mini" OpenMiniOnHover="true">
|
||||
<MudDrawer @bind-Open="@openContentDrawer" ClipMode="DrawerClipMode.Always" Breakpoint="Breakpoint.Lg" PreserveOpenState="false" Elevation="1" Variant="@DrawerVariant.Mini" OpenMiniOnHover="true">
|
||||
<MudNavMenu>
|
||||
<MudNavLink Match="NavLinkMatch.All" Icon="@Icons.Material.Filled.Image">Posts</MudNavLink>
|
||||
<MudNavLink Match="NavLinkMatch.All" Icon="@Icons.Material.Filled.LibraryBooks">Library</MudNavLink>
|
||||
|
@ -21,7 +17,7 @@
|
|||
</MudNavMenu>
|
||||
</MudDrawer>
|
||||
|
||||
<MudDrawer Anchor="Anchor.End" @bind-Open="@openEnd" ClipMode="DrawerClipMode.Always" Breakpoint="Breakpoint.Lg" PreserveOpenState="false" Elevation="1" Variant="@DrawerVariant.Mini" OpenMiniOnHover="true">
|
||||
<MudDrawer Anchor="Anchor.End" @bind-Open="@openProfileDrawer" ClipMode="DrawerClipMode.Always" Breakpoint="Breakpoint.Lg" PreserveOpenState="true" Elevation="1" Variant="@DrawerVariant.Temporary">
|
||||
<MudNavMenu>
|
||||
<MudNavLink Match="NavLinkMatch.All" Icon="@Icons.Material.Filled.Store">Store</MudNavLink>
|
||||
<MudNavLink Match="NavLinkMatch.All" Icon="@Icons.Material.Filled.LibraryBooks">Library</MudNavLink>
|
||||
|
@ -37,15 +33,13 @@
|
|||
|
||||
@code {
|
||||
|
||||
bool openStart = false;
|
||||
bool openEnd = false;
|
||||
bool openContentDrawer = false;
|
||||
bool openProfileDrawer = false;
|
||||
|
||||
void ToggleDrawer(Anchor anchor)
|
||||
void ToggleDrawer()
|
||||
{
|
||||
if (anchor == Anchor.Start)
|
||||
openStart = !openStart;
|
||||
if (anchor == Anchor.End)
|
||||
openEnd = !openEnd;
|
||||
Console.WriteLine("Open!");
|
||||
openProfileDrawer = !openProfileDrawer;
|
||||
}
|
||||
|
||||
void getPos()
|
||||
|
|
Loading…
Reference in New Issue