[frontend/components] Add proper loading spinner to all loading indicators

This commit is contained in:
Lilian 2025-02-09 16:48:22 +01:00
parent 1b84d3b87e
commit c13ae77a8d
No known key found for this signature in database
30 changed files with 111 additions and 21 deletions

View file

@ -30,7 +30,7 @@
@Loc["ComposeNote"]<Icon Name="Icons.PaperPlaneRight"/>
</Initial>
<Loading>
@Loc["Sending"]<Icon Name="Icons.Spinner"/>
@Loc["Sending"]<LoadingSpinner />
</Loading>
<Success>
@Loc["Done"]<Icon Name="Icons.Check"/>

View file

@ -10,7 +10,7 @@
<div class="confirm @(Waiting ? "waiting" : "")">
@if (Waiting)
{
<Icon Name="Icons.Spinner" Size="3rem"/>
<LoadingSpinner Scale="1.5"/>
}
else
{

View file

@ -20,7 +20,7 @@
}
@if (_init == LoadState.Loading)
{
<div>Loading!</div>
<div class="loading"><LoadingSpinner Scale="2" /></div>
}
@if (_init == LoadState.Emtpy)
{

View file

@ -6,3 +6,10 @@
overflow-x: auto;
padding: 0.5rem;
}
.loading {
display: flex;
align-items: center;
justify-content: center;
padding-top: 25vh;
}

View file

@ -0,0 +1,5 @@
<svg class="animate-spin" viewBox="0 0 24 24" style="--scale: @Scale"></svg>
@code {
[Parameter] public double Scale { get; set; } = 1;
}

After

Width:  |  Height:  |  Size: 142 B

View file

@ -0,0 +1,25 @@
@keyframes spin {
to {
transform: rotate(360deg);
}
}
.animate-spin {
animation: spin 1s linear infinite;
margin-block: auto;
}
svg {
--scale: 1;
display: inline;
height: calc(1rem * var(--scale));
width: calc(1rem * var(--scale));
border-radius: 9999px;
border-width: calc(2px * var(--scale));
border-color: transparent;
background-color: transparent;
border-right-color: white;
border-top-color: white;
border-style: solid;
margin-right: 0.5rem;
}

View file

@ -26,7 +26,7 @@
}
@if (State is State.Loading)
{
<span>Loading</span>
<span class="loading"><LoadingSpinner Scale="1.5"/></span>
}
@if (State is State.Error)
{

View file

@ -0,0 +1,5 @@
.loading {
display: flex;
align-items: center;
justify-content: center;
}

View file

@ -26,7 +26,7 @@
}
@if (State is State.Loading)
{
<span>Loading</span>
<span class="loading"><LoadingSpinner Scale="1.5" /></span>
}
@if (State is State.Error)
{

View file

@ -0,0 +1,5 @@
.loading {
display: flex;
align-items: center;
justify-content: center;
}

View file

@ -16,7 +16,7 @@
@if (_state == State.Loading)
{
<div>Loading!</div>
<div class="loading"><LoadingSpinner Scale="2" /></div>
}
@if (_state == State.Error)

View file

@ -15,3 +15,11 @@
padding-right: 0.5rem;
width: 100%;
}
.loading {
display: flex;
align-items: center;
justify-content: center;
padding-top: 25vh;
margin: auto;
}

View file

@ -10,7 +10,7 @@
<div class="prompt @(Waiting ? "waiting" : "")">
@if (Waiting)
{
<Icon Name="Icons.Spinner" Size="3rem"/>
<LoadingSpinner Scale="1.5"/>
}
else
{

View file

@ -5,7 +5,7 @@
<div @ref="context.Ref.Current" class="@Class" style="@Style">
@if (_state is State.Loading or State.Init)
{
<Icon Name="Icons.Spinner"/>
<LoadingSpinner />
}
else
{

View file

@ -10,7 +10,7 @@
<div class="select @(Waiting ? "waiting" : "")">
@if (Waiting)
{
<Icon Name="Icons.Spinner" Size="3rem"/>
<LoadingSpinner Scale="1.5" />
}
else
{

View file

@ -16,7 +16,7 @@
break;
case HubConnectionState.Connecting:
<div class="state">
<svg class="animate-spin" viewBox="0 0 24 24"></svg> @Loc["Connecting"]
<LoadingSpinner/> @Loc["Connecting"]
</div>
break;
case HubConnectionState.Disconnected:
@ -26,7 +26,7 @@
break;
case HubConnectionState.Reconnecting:
<div class="state">
<svg class="animate-spin" viewBox="0 0 24 24"></svg> @Loc["Reconnecting"]
<LoadingSpinner /> @Loc["Reconnecting"]
</div>
break;
}

View file

@ -70,7 +70,7 @@
}
@if (_state == State.Loading)
{
<div>Loading</div>
<div class="loading"><LoadingSpinner Scale="2"/></div>
}
@if (_state == State.NotFound)
{

View file

@ -2,6 +2,13 @@
display: none;
}
.loading {
display: flex;
align-items: center;
justify-content: center;
padding-top: 25vh;
}
.drive-files {
display: flex;
flex-wrap: wrap;

View file

@ -31,7 +31,7 @@
@if (Loading)
{
<span>Loading!</span>
<span class="loading"><LoadingSpinner Scale="2"/></span>
}
@if (Failure)
{

View file

@ -26,6 +26,13 @@
z-index: +11;
}
.loading {
display: flex;
align-items: center;
justify-content: center;
padding-top: 25vh;
}
.backdrop {
opacity: 50%;
background-color: black;

View file

@ -66,7 +66,7 @@
@if (State is State.Loading)
{
<div class="loading">
<Icon Name="Icons.Spinner" Size="3rem"/>
<LoadingSpinner Scale="2" />
</div>
}

View file

@ -120,7 +120,7 @@
}
@if (_loading)
{
<div>loading</div>
<div class="loading"><LoadingSpinner Scale="2" /></div>
}
@if (_notFound)
{

View file

@ -4,6 +4,13 @@
overflow-x: clip;
}
.loading {
display: flex;
align-items: center;
justify-content: center;
padding-top: 25vh;
}
.header {
display: flex;
justify-content: space-between;

View file

@ -54,7 +54,7 @@
<StateButton @ref="@LoginButton" ExtraClasses="button" OnClick="Submit">
<Initial>@Loc["Register"]</Initial>
<Success>@Loc["Success!"]</Success>
<Loading>@Loc["Loading"]</Loading>
<Loading>@Loc["Loading"] <LoadingSpinner /></Loading>
<Failed>@Loc["Try again"]</Failed>
</StateButton>
</div>

View file

@ -64,7 +64,7 @@
<StateButton ExtraClasses="button" @ref="@SaveButton" OnClick="Submit">
<Initial>@Loc["Save changes"]</Initial>
<Success>@Loc["Saved"]</Success>
<Loading>@Loc["Loading"]<Icon Name="Icons.Spinner"/>
<Loading>@Loc["Loading"]<LoadingSpinner />
</Loading>
<Failed>@Loc["Error"]</Failed>
</StateButton>

View file

@ -166,7 +166,7 @@
<Initial><Icon Name="Icons.Plus"/><span>@Loc["Add Filter"]</span></Initial>
<Success><Icon Name="Icons.Plus"/><span>@Loc["Add Filter"]</span></Success>
<Loading>
<Icon Name="Icons.Spinner"/>
<LoadingSpinner/>
</Loading>
<Failed>
<Icon Name="Icons.X"/>@Loc["Error"]

View file

@ -151,7 +151,7 @@
<Icon Name="Icons.FloppyDisk"/>@Loc["Save"]
</Initial>
<Loading>
<Icon Name="Icons.Spinner"/>
<LoadingSpinner />
</Loading>
<Failed>
<Icon Name="Icons.X"/>@Loc["Error"]
@ -164,7 +164,7 @@
}
@if (State is State.Loading)
{
<div>Loading!</div>
<div class="loading"><LoadingSpinner Scale="2" /></div>
}
</div>

View file

@ -4,6 +4,13 @@
align-items: center;
}
.loading {
display: flex;
align-items: center;
justify-content: center;
padding-top: 25vh;
}
.button {
padding: 0.75rem;
margin: 0.2rem;

View file

@ -134,7 +134,7 @@
}
@if (_componentState == State.Loading)
{
<div>Loading</div>
<div class="loading"><LoadingSpinner Scale="2" /></div>
}
@if (_componentState == State.NotFound)
{

View file

@ -10,6 +10,13 @@
border-radius: 0.75rem;
}
.loading {
display: flex;
align-items: center;
justify-content: center;
padding-top: 25vh;
}
.descendants {
display: flex;
flex-direction: column;