mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 12:50:01 +00:00
web/FilenamePreview: finish the component
This commit is contained in:
parent
518f634385
commit
94853f0b7b
3 changed files with 84 additions and 11 deletions
|
@ -63,7 +63,7 @@
|
||||||
"metadata.filename.basic": "basic",
|
"metadata.filename.basic": "basic",
|
||||||
"metadata.filename.pretty": "pretty",
|
"metadata.filename.pretty": "pretty",
|
||||||
"metadata.filename.nerdy": "nerdy",
|
"metadata.filename.nerdy": "nerdy",
|
||||||
"metadata.filename.description": "filename style using which cobalt files will be downloaded. this description is temporary as there's no dynamic preview component yet.",
|
"metadata.filename.description": "filename style will only be used for files processed or proxied by cobalt. some services don't support filename styles.",
|
||||||
|
|
||||||
"metadata.filename.preview.video": "Video Title",
|
"metadata.filename.preview.video": "Video Title",
|
||||||
"metadata.filename.preview.audio": "Audio Title - Audio Author",
|
"metadata.filename.preview.audio": "Audio Title - Audio Author",
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
import settings from "$lib/state/settings";
|
import settings from "$lib/state/settings";
|
||||||
import { t } from "$lib/i18n/translations";
|
import { t } from "$lib/i18n/translations";
|
||||||
|
|
||||||
|
import IconMovie from "@tabler/icons-svelte/IconMovie.svelte";
|
||||||
|
import IconMusic from "@tabler/icons-svelte/IconMusic.svelte";
|
||||||
|
|
||||||
let videoFilePreview: string;
|
let videoFilePreview: string;
|
||||||
let audioFilePreview: string;
|
let audioFilePreview: string;
|
||||||
|
|
||||||
|
@ -66,18 +69,86 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="filename-preview">
|
<div id="filename-preview">
|
||||||
<div id="filename-preview-video">
|
<div id="filename-preview-video" class="filename-preview-item">
|
||||||
{videoFilePreview}.{youtubeVideoExt}
|
<div class="item-icon">
|
||||||
|
<IconMovie />
|
||||||
|
</div>
|
||||||
|
<div class="item-text">
|
||||||
|
<div class="preview">{`${videoFilePreview}.${youtubeVideoExt}`}</div>
|
||||||
|
<div class="subtext description">video file preview</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="filename-preview-audio" class="filename-preview-item">
|
||||||
|
<div class="item-icon">
|
||||||
|
<IconMusic />
|
||||||
|
</div>
|
||||||
|
<div class="item-text">
|
||||||
|
<div class="preview">{`${audioFilePreview}.${audioFormat}`}</div>
|
||||||
|
<div class="subtext description">audio file preview</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="filename-preview-audio">
|
|
||||||
{audioFilePreview}.{audioFormat}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
#filename-preview {
|
#filename-preview {
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
padding: 0 var(--padding);
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
background: var(--button);
|
||||||
|
box-shadow: var(--button-box-shadow);
|
||||||
|
border-radius: var(--border-radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
.filename-preview-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-start;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 8px var(--padding);
|
||||||
|
}
|
||||||
|
|
||||||
|
.filename-preview-item:first-child {
|
||||||
|
border-bottom: 1.5px var(--button-stroke) solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-icon {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 4px;
|
||||||
|
border-radius: 6px;
|
||||||
|
background-color: var(--gray);
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-icon :global(svg) {
|
||||||
|
stroke: var(--white);
|
||||||
|
stroke-width: 1.5px;
|
||||||
|
height: 22px;
|
||||||
|
width: 22px;
|
||||||
|
will-change: transform;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-text {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
font-size: 14px;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-text .preview {
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-text .description {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 750px) {
|
||||||
|
.item-text {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -11,10 +11,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<SettingsCategory sectionId="filename" title={$t("settings.metadata.filename")}>
|
<SettingsCategory sectionId="filename" title={$t("settings.metadata.filename")}>
|
||||||
<Switcher
|
<Switcher big={true}>
|
||||||
big={true}
|
|
||||||
description={$t("settings.metadata.filename.description")}
|
|
||||||
>
|
|
||||||
{#each filenameStyleOptions as value}
|
{#each filenameStyleOptions as value}
|
||||||
<SettingsButton
|
<SettingsButton
|
||||||
settingContext="save"
|
settingContext="save"
|
||||||
|
@ -25,7 +22,12 @@
|
||||||
</SettingsButton>
|
</SettingsButton>
|
||||||
{/each}
|
{/each}
|
||||||
</Switcher>
|
</Switcher>
|
||||||
|
|
||||||
<FilenamePreview />
|
<FilenamePreview />
|
||||||
|
|
||||||
|
<div class="subtext">
|
||||||
|
{$t("settings.metadata.filename.description")}
|
||||||
|
</div>
|
||||||
</SettingsCategory>
|
</SettingsCategory>
|
||||||
|
|
||||||
<SettingsCategory
|
<SettingsCategory
|
||||||
|
|
Loading…
Reference in a new issue