99 lines
3.9 KiB
Plaintext
99 lines
3.9 KiB
Plaintext
package web
|
||
|
||
import "github.com/invopop/ctxi18n/i18n"
|
||
import "net/http"
|
||
import "dwelling-files/pkg/files"
|
||
import "dwelling-files/pkg/utils"
|
||
import "strconv"
|
||
|
||
|
||
templ Index(currentPath, progVer string, stat *files.DirStat, entries *[]files.DirEntry, r *http.Request) {
|
||
<!doctype html>
|
||
<html lang={ i18n.GetLocale(ctx).Code().String() }>
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||
<meta name="theme-color" content="#cd2682" />
|
||
<meta name="color-scheme" content="light dark" />
|
||
|
||
<title>Arav's dwelling / { i18n.T(ctx, "title") }</title>
|
||
|
||
<meta name="description" content={ i18n.T(ctx, "description") } />
|
||
<meta name="keywords" content={ i18n.T(ctx, "keywords") } />
|
||
|
||
<link rel="icon" href="/assets/img/favicon.svg" sizes="any" type="image/svg+xml"/>
|
||
<link rel="stylesheet" href="/assets/css/main.css" />
|
||
<script src="/assets/js/main.js" defer></script>
|
||
</head>
|
||
<body>
|
||
<header>
|
||
<svg width="360" viewBox="0 -36 360 66">
|
||
<text y="7" textLength="360" lengthAdjust="spacingAndGlyphs">Arav's dwelling</text>
|
||
<text y="25" textLength="360" lengthAdjust="spacingAndGlyphs">Welcome to my sacred place, wanderer</text>
|
||
</svg>
|
||
<nav>
|
||
<a href={ templ.SafeURL(utils.MainSite(r.Host)) }>{ i18n.T(ctx, "back-home") }</a>
|
||
<h1>{ i18n.T(ctx, "title") }</h1>
|
||
</nav>
|
||
</header>
|
||
<main>
|
||
<section>
|
||
<span>@templ.Raw(currentPath)</span>
|
||
<p>{ i18n.T(ctx, "stats.files") }: { strconv.FormatInt(stat.Files, 10) } ({ stat.FilesSize }); { i18n.T(ctx, "stats.directories") }: { strconv.FormatInt(stat.Directories, 10) }.</p>
|
||
<input type="text" name="filter" placeholder={ i18n.T(ctx, "stats.filter") } class="hidden">
|
||
</section>
|
||
<section>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>{ i18n.T(ctx, "table.name") }</th>
|
||
<th>{ i18n.T(ctx, "table.date") }</th>
|
||
<th>{ i18n.T(ctx, "table.size") }</th>
|
||
</tr>
|
||
<tr tabindex="0">
|
||
<td><a href="../">../</a></td>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
for i, entry := range *entries {
|
||
<tr tabindex={ strconv.FormatInt(int64(i)+1, 10) }>
|
||
<td><a href={ templ.SafeURL(entry.Link) }>{ entry.Name }</a></td>
|
||
<td>{ utils.ToClientTimezone(entry.Datetime, r).Format(files.FileDateFormat) }</td>
|
||
<td>{ entry.Size }</td>
|
||
</tr>
|
||
}
|
||
</tbody>
|
||
</table>
|
||
</section>
|
||
<section>
|
||
<span>@templ.Raw(currentPath)</span>
|
||
</section>
|
||
<noscript>
|
||
<section>
|
||
<p>{ i18n.T(ctx, "no-script-explain") }</p>
|
||
</section>
|
||
</noscript>
|
||
<section id="instruction" class="hidden">
|
||
<p>{ i18n.T(ctx, "instruction") }</p>
|
||
</section>
|
||
</main>
|
||
<footer>
|
||
<a href="?lang=ru">рус</a>
|
||
<a href="?lang=en">eng</a>
|
||
<br/>
|
||
v{ progVer } 2017—2024 { i18n.T(ctx, "footer.author") } <<a href="mailto:me@arav.su">me@arav.su</a>> <a href={ templ.SafeURL(utils.MainSite(r.Host) + "/privacy") }>{ i18n.T(ctx, "footer.privacy") }</a>
|
||
</footer>
|
||
<div id="overlay">
|
||
<button name="prev">❰</button>
|
||
<div></div>
|
||
<span></span>
|
||
<span class="c-autoplay">
|
||
<input id="c-autoplay" type="checkbox" name="autoplay">
|
||
<label for="c-autoplay">{ i18n.T(ctx, "autoplay") }</label>
|
||
</span>
|
||
<button name="next">❱</button>
|
||
</div>
|
||
</body>
|
||
</html>
|
||
} |