frontend: containers refactor
This commit is contained in:
parent
5be65229f4
commit
09c0f12692
11 changed files with 126 additions and 72 deletions
9
frontend/src/lib/components/containers/files.svelte
Normal file
9
frontend/src/lib/components/containers/files.svelte
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<script>
|
||||||
|
import File from '$lib/components/file.svelte';
|
||||||
|
import AddButton from '$lib/components/add_button.svelte';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="input rounded">
|
||||||
|
<File />
|
||||||
|
<AddButton type="file"/>
|
||||||
|
</div>
|
25
frontend/src/lib/components/containers/images.svelte
Normal file
25
frontend/src/lib/components/containers/images.svelte
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import Image from "../image.svelte";
|
||||||
|
|
||||||
|
let { value = $bindable([]) } = $props();
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="img-conatiner rounded">
|
||||||
|
<Image />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* Горизонтальный список */
|
||||||
|
.img-conatiner {
|
||||||
|
display: flex;
|
||||||
|
overflow-x: scroll;
|
||||||
|
align-content: center;
|
||||||
|
padding: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.img-conatiner :global(*) {
|
||||||
|
margin: 0;
|
||||||
|
margin-right: 0.5rem;
|
||||||
|
}
|
||||||
|
</style>
|
39
frontend/src/lib/components/containers/marks.svelte
Normal file
39
frontend/src/lib/components/containers/marks.svelte
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import Mark from "../mark.svelte";
|
||||||
|
import AddButton from "../add_button.svelte";
|
||||||
|
|
||||||
|
let { value = $bindable([]), label = "" } = $props();
|
||||||
|
let items: string[] = $state([]);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="marks-container input rounded">
|
||||||
|
<p>{label}</p>
|
||||||
|
|
||||||
|
{#each items as item}
|
||||||
|
<Mark text={item}/>
|
||||||
|
{/each}
|
||||||
|
<AddButton handler={() => {
|
||||||
|
items.push("");
|
||||||
|
value = items;
|
||||||
|
}} />
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* Горизонтальный список */
|
||||||
|
.marks-container {
|
||||||
|
display: flex;
|
||||||
|
overflow-x: scroll;
|
||||||
|
align-content: center;
|
||||||
|
padding: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.marks-container :global(*) {
|
||||||
|
margin: 0;
|
||||||
|
margin-right: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.marks-container p {
|
||||||
|
align-content: center;
|
||||||
|
}
|
||||||
|
</style>
|
8
frontend/src/lib/components/containers/queue.svelte
Normal file
8
frontend/src/lib/components/containers/queue.svelte
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<script>
|
||||||
|
import QueueItem from '$lib/components/queue_item.svelte';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="input rounded">
|
||||||
|
<QueueItem date="28.11.24" name="Fate/Stay Night (Судьба/Ночь схватки)"/>
|
||||||
|
<QueueItem date="30.11.24" name="Fate/Hollow Ataraxia (Судьба/Святая атараксия)"/>
|
||||||
|
</div>
|
|
@ -1,10 +1,21 @@
|
||||||
<!-- Кнопка "Создать" -->
|
<!-- Кнопка "Создать" -->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
let { onclick } = $props();
|
let { data = $bindable() } = $props();
|
||||||
|
|
||||||
|
function send_json() {
|
||||||
|
fetch('http://127.0.0.1:8000/new', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Access-Control-Allow-Origin': "<origin>"
|
||||||
|
},
|
||||||
|
body: JSON.stringify(data)
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="create">
|
<div class="create">
|
||||||
<button class="rounded" id="create" {onclick}>Создать</button>
|
<button class="rounded" id="create" onclick={send_json}>Создать</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
<script lang="ts">
|
|
||||||
import HorisontalItem from "./horisontal_item.svelte";
|
|
||||||
import AddButton from "./add_button.svelte";
|
|
||||||
import Image from "./image.svelte";
|
|
||||||
|
|
||||||
let { value = $bindable([]), label = "", type = "text" } = $props();
|
|
||||||
let items: string[] = $state([]);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div class="horisontal-bar {type == "text" ? "input" : ""} rounded">
|
|
||||||
<p>{label}</p>
|
|
||||||
{#if type == "text"}
|
|
||||||
{#each items as item}
|
|
||||||
<HorisontalItem text={item}/>
|
|
||||||
{/each}
|
|
||||||
<AddButton handler={() => {
|
|
||||||
items.push("");
|
|
||||||
value = items;
|
|
||||||
}} />
|
|
||||||
{:else if type == "image"}
|
|
||||||
<Image />
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
/* Горизонтальный список */
|
|
||||||
:global(.horisontal-bar) {
|
|
||||||
display: flex;
|
|
||||||
overflow-x: scroll;
|
|
||||||
align-content: center;
|
|
||||||
padding: 0.5rem;
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -22,6 +22,7 @@
|
||||||
.imgbutton img {
|
.imgbutton img {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
|
margin: 0;
|
||||||
width: 2rem;
|
width: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<div>
|
<div>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
class="dyn-input rounded"
|
class="dyn-input rounded"
|
||||||
style="width: {text.length}ch;"
|
style="width: {text.length}ch;margin:0;"
|
||||||
bind:value={text}
|
bind:value={text}
|
||||||
oninput={autocomplete}>
|
oninput={autocomplete}>
|
||||||
{#if compl_data}
|
{#if compl_data}
|
|
@ -7,7 +7,7 @@
|
||||||
let { date, name } = $props();
|
let { date, name } = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="queue-item horisontal-bar rounded">
|
<div class="queue-item rounded">
|
||||||
<p>{date}</p>
|
<p>{date}</p>
|
||||||
<p class="ellipsis">{name}</p>
|
<p class="ellipsis">{name}</p>
|
||||||
<ImgButton style="edit" name="Изменить" image={edit_btn}/>
|
<ImgButton style="edit" name="Изменить" image={edit_btn}/>
|
||||||
|
@ -19,9 +19,12 @@
|
||||||
.queue-item {
|
.queue-item {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
display: flex;
|
||||||
|
align-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.queue-item p {
|
.queue-item p {
|
||||||
|
align-content: center;
|
||||||
margin: 0.5rem;
|
margin: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,19 +48,26 @@ button {
|
||||||
|
|
||||||
/* Поле с заполняемыми полями */
|
/* Поле с заполняемыми полями */
|
||||||
.fields {
|
.fields {
|
||||||
width: 100%;
|
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
border-bottom-left-radius: 0;
|
border-bottom-left-radius: 0;
|
||||||
border-bottom-right-radius: 0;
|
border-bottom-right-radius: 0;
|
||||||
|
padding: 1rem;
|
||||||
padding-bottom: 5rem;
|
padding-bottom: 5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Отступ между полями */
|
/* Отступ между полями */
|
||||||
.fields * {
|
.fields .input {
|
||||||
margin: 1rem;
|
margin: 0;
|
||||||
margin-bottom: 0;
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.horisontal-bar {
|
||||||
|
display: flex;
|
||||||
|
align-content: center;
|
||||||
|
padding-left: 0.5rem;
|
||||||
|
padding-right: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.horisontal-bar * {
|
.horisontal-bar * {
|
||||||
|
@ -70,6 +77,7 @@ button {
|
||||||
|
|
||||||
.horisontal-bar p {
|
.horisontal-bar p {
|
||||||
align-content: center;
|
align-content: center;
|
||||||
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Текст с троеточием в конце */
|
/* Текст с троеточием в конце */
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
<script>
|
<script>
|
||||||
import favicon from '$lib/assets/favicon.svg';
|
import favicon from '$lib/assets/favicon.svg';
|
||||||
import Image from '$lib/components/image.svelte';
|
|
||||||
import HorisontalBar from '$lib/components/horisontal_bar.svelte';
|
|
||||||
import CreateButton from '$lib/components/create_button.svelte';
|
|
||||||
import Calendar from '$lib/components/calendar.svelte';
|
import Calendar from '$lib/components/calendar.svelte';
|
||||||
import QueueItem from '$lib/components/queue_item.svelte';
|
import CreateButton from '$lib/components/create_button.svelte';
|
||||||
import AddButton from '$lib/components/add_button.svelte';
|
import Image from '$lib/components/image.svelte';
|
||||||
import File from '$lib/components/file.svelte';
|
|
||||||
|
import FileContainer from '$lib/components/containers/files.svelte';
|
||||||
|
import QueueContainer from '$lib/components/containers/queue.svelte';
|
||||||
|
import MarksContainer from '$lib/components/containers/marks.svelte';
|
||||||
|
import ImageContainer from '$lib/components/containers/images.svelte';
|
||||||
|
|
||||||
let { children } = $props();
|
let { children } = $props();
|
||||||
|
|
||||||
|
@ -18,17 +19,6 @@
|
||||||
tags: [],
|
tags: [],
|
||||||
badges: []
|
badges: []
|
||||||
})
|
})
|
||||||
|
|
||||||
function send_json() {
|
|
||||||
fetch('http://127.0.0.1:8000/new', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Access-Control-Allow-Origin': "<origin>"
|
|
||||||
},
|
|
||||||
body: JSON.stringify(page_data)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
|
@ -59,12 +49,12 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<HorisontalBar label="Жанры" bind:value={page_data["genres"]}/>
|
<MarksContainer label="Жанры" bind:value={page_data["genres"]}/>
|
||||||
<HorisontalBar label="Теги" bind:value={page_data["tags"]}/>
|
<MarksContainer label="Теги" bind:value={page_data["tags"]}/>
|
||||||
<HorisontalBar label="Баджи" bind:value={page_data["badges"]}/>
|
<MarksContainer label="Баджи" bind:value={page_data["badges"]}/>
|
||||||
|
|
||||||
<p>Скриншоты</p>
|
<p>Скриншоты</p>
|
||||||
<HorisontalBar type="image" />
|
<ImageContainer />
|
||||||
|
|
||||||
<!-- Календарь с датой -->
|
<!-- Календарь с датой -->
|
||||||
<p>Дата публикации</p>
|
<p>Дата публикации</p>
|
||||||
|
@ -72,21 +62,15 @@
|
||||||
|
|
||||||
<!-- Файлы -->
|
<!-- Файлы -->
|
||||||
<p>Файлы</p>
|
<p>Файлы</p>
|
||||||
<div class="input rounded">
|
<FileContainer />
|
||||||
<File />
|
|
||||||
<AddButton type="file"/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Очередь публикации -->
|
<!-- Очередь публикации -->
|
||||||
<p>Очередь публикации</p>
|
<p>Очередь публикации</p>
|
||||||
<div class="input rounded">
|
<QueueContainer />
|
||||||
<QueueItem date="28.11.24" name="Fate/Stay Night (Судьба/Ночь схватки)"/>
|
|
||||||
<QueueItem date="30.11.24" name="Fate/Hollow Ataraxia (Судьба/Святая атараксия)"/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<CreateButton onclick={send_json}/>
|
<CreateButton bind:data={page_data}/>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@import '$lib/css/global.css';
|
@import '$lib/css/global.css';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue