60 lines
No EOL
1.8 KiB
Text
60 lines
No EOL
1.8 KiB
Text
@page "/drive"
|
|
@page "/drive/{Id}"
|
|
@using Iceshrimp.Frontend.Localization
|
|
@using Microsoft.AspNetCore.Components.Sections
|
|
@using Microsoft.Extensions.Localization
|
|
@using Iceshrimp.Assets.PhosphorIcons
|
|
@using Iceshrimp.Frontend.Core.Services
|
|
@using Iceshrimp.Shared.Schemas.Web
|
|
@inject ApiService Api;
|
|
@inject IStringLocalizer<Localization> Loc;
|
|
|
|
<SectionContent SectionName="top-bar">
|
|
<Icon Name="Icons.Cloud"></Icon>
|
|
@Loc["Drive"]
|
|
</SectionContent>
|
|
|
|
@if (Folder != null)
|
|
{
|
|
<ol class="drive-files">
|
|
@foreach (var el in Folder.Folders)
|
|
{
|
|
<li class="drive-entry">
|
|
<Icon Name="Icons.FolderOpen" Size="5em" Pack="IconStyle.Fill"/>
|
|
<span>@el.Name</span>
|
|
</li>
|
|
}
|
|
@foreach (var el in Folder.Files)
|
|
{
|
|
<li class="drive-entry">
|
|
@if (el.ContentType.StartsWith("image"))
|
|
{
|
|
<img class="thumbnail" src="@el.ThumbnailUrl"/>
|
|
}
|
|
else if (el.ContentType.StartsWith("audio"))
|
|
{
|
|
<Icon Name="Icons.FileAudio" Size="5em"/>
|
|
}
|
|
else if (el.ContentType.StartsWith("video"))
|
|
{
|
|
<Icon Name="Icons.FileVideo" Size="5em"/>
|
|
}
|
|
else
|
|
{
|
|
<Icon Name="Icons.File" Size="5em"/>
|
|
}
|
|
<span>@el.Filename</span>
|
|
</li>
|
|
}
|
|
</ol>
|
|
}
|
|
|
|
@code {
|
|
[Parameter] public string? Id { get; set; }
|
|
private DriveFolderResponse? Folder { get; set; } = null;
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
Folder = await Api.Drive.GetFolderAsync(Id);
|
|
}
|
|
} |