Přesunuto na GitHub https://github.com/ksp/kurz
https://ksp.mff.cuni.cz/kurz
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.7 KiB
62 lines
1.7 KiB
<script lang="ts">
|
|
import { grabAssignment } from "./ksp-task-grabber";
|
|
import type { TaskAssignmentData } from "./ksp-task-grabber";
|
|
import type { TasksFile, TaskDescriptor } from "./task-loader";
|
|
import TaskDisplay from "./TaskDisplay.svelte";
|
|
|
|
// export let tasks: TasksFile;
|
|
let selectedTask: TaskDescriptor | null = null
|
|
|
|
let heightClass: "collapsed" | "full" | "preview" = "collapsed"
|
|
|
|
export function preSelect(task: TaskDescriptor) {
|
|
if (heightClass != "full") {
|
|
selectedTask = task
|
|
heightClass = "preview"
|
|
}
|
|
}
|
|
|
|
export function unPreselect(task: TaskDescriptor) {
|
|
setTimeout(() => {
|
|
if (selectedTask && task.id == selectedTask.id && heightClass != "full") {
|
|
heightClass = "collapsed"
|
|
}
|
|
}, 10);
|
|
}
|
|
|
|
export function select(task: TaskDescriptor) {
|
|
selectedTask = task
|
|
heightClass = "full"
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
.panel {
|
|
position: absolute;
|
|
width: 100%;
|
|
background-color: #222;
|
|
overflow: hidden;
|
|
padding: 0 100px 0 100px;
|
|
box-sizing: border-box;
|
|
z-index: 120;
|
|
}
|
|
.panel.collapsed:not(:hover) {
|
|
display: none;
|
|
}
|
|
.panel.preview, .panel:not(.full):hover {
|
|
height: 100px;
|
|
}
|
|
.panel.full {
|
|
min-height: 100%;
|
|
}
|
|
.closeButton { display: none }
|
|
.panel.full .closeButton { display: inherit }
|
|
</style>
|
|
|
|
<div class="panel {heightClass}"
|
|
on:click={() => selectedTask && select(selectedTask)}>
|
|
<TaskDisplay taskId={selectedTask?.id} />
|
|
<button type=button class="closeButton" on:click|stopPropagation={() => heightClass = "collapsed"}>
|
|
Zavřít
|
|
</button>
|
|
</div>
|
|
|