You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
2.1 KiB
Vue

<template>
<header>
<h1>Story Baobab</h1>
2 years ago
<div class="intro">
Drag and drop images and video to sketch a print-friendly storyboard.
</div>
</header>
<main>
2 years ago
<div class="insert-scene">
<input v-model="title" placeholder="Title">
<button @click="add">Add Scene</button>
</div>
<div class="load-scene">
2 years ago
<label > Open
<input type="file" multiple @change="load">
2 years ago
</label>
</div>
2 years ago
<SceneEntry v-for="scene in scenes" :title="scene.title" :series="scene.series"/>
</main>
</template>
<script setup>
import SceneEntry from './components/SceneEntry.vue'
import {ref} from 'vue'
const scenes = ref([])
const title = ref('')
const add = () => {
scenes.value.push({
title: title.value,
series: []
})
title.value = ""
}
const load = (e) => {
let files = e.target.files
Promise.all(files.forEach(async (file) =>{
const reader = new FileReader()
reader.readAsText(file)
reader.onloadend = (e) => {
if (e.target.readyState == FileReader.DONE) {
try {
let scene = JSON.parse(reader.result)
// convert base64 to blob to avoid DOM lag during drag and drop
// bc base64 bloat the html document so much!
scenes.value.push(scene)
} catch (e) {
console.log(e)
}
}
}
})
)
}
</script>
2 years ago
<style>
header {
margin: 32px;
}
2 years ago
header h1 {
margin: 0;
}
main {
margin: 32px;
}
2 years ago
.insert-scene {
display: inline-flex;
gap: 8px;
padding: 16px;
background-color: #F3F3F3;
}
2 years ago
.load-scene {
display: inline-flex;
gap: 8px;
padding: 16px;
}
.load-scene input {
position: absolute;
top: -10000px;
}
.load-scene label {
background-color: #fff;
border: 1px solid currentColor;
padding: 8px;
border-radius: 50%;
cursor: pointer;
}
.load-scene label:hover {
background-color: #393939;
border-color: #393939;
color: #fff;
}
2 years ago
@media print {
2 years ago
header, .insert-scene, .load-scene, .add-shot {
2 years ago
display: none
}
}
</style>