Finished new Editor

This commit is contained in:
Mawoka
2022-06-16 21:02:39 +02:00
parent d4bfe9138f
commit 4c1f6280f4
3 changed files with 51 additions and 44 deletions
+5 -1
View File
@@ -72,7 +72,11 @@
<div class="col-span-5 flex flex-col"> <div class="col-span-5 flex flex-col">
<div class="h-10 w-full bg-white mb-10 flex align-middle justify-center rounded-br-lg"> <div class="h-10 w-full bg-white mb-10 flex align-middle justify-center rounded-br-lg">
{#if schemaInvalid} {#if schemaInvalid}
<p class="text-center w-full text-red-600 h-full">{yupErrorMessage}</p> <p class="text-center w-full text-red-600 h-full mt-0.5 font-semibold">
{yupErrorMessage}
</p>
{:else}
<p class="text-center w-full text-black h-full align-bottom mt-0.5">{data.title}</p>
{/if} {/if}
<button <button
class="pr-2 align-middle bg-purple-400 pl-2 ml-auto whitespace-nowrap disabled:opacity-60 rounded-br-lg" class="pr-2 align-middle bg-purple-400 pl-2 ml-auto whitespace-nowrap disabled:opacity-60 rounded-br-lg"
+43 -41
View File
@@ -75,47 +75,49 @@
class="bg-transparent resize-none w-full rounded text-sm" class="bg-transparent resize-none w-full rounded text-sm"
/> />
</div> </div>
<button <div class="w-full flex justify-center">
type="button" <button
on:click={() => { type="button"
data.public = !data.public; on:click={() => {
}} data.public = !data.public;
class="text-center w-full" }}
> class="text-center"
{#if data.public} >
<svg {#if data.public}
class="w-5 h-5 inline-block" <svg
fill="none" class="w-5 h-5 inline-block"
stroke="currentColor" fill="none"
viewBox="0 0 24 24" stroke="currentColor"
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
> xmlns="http://www.w3.org/2000/svg"
<path >
stroke-linecap="round" <path
stroke-linejoin="round" stroke-linecap="round"
stroke-width="2" stroke-linejoin="round"
d="M3.055 11H5a2 2 0 012 2v1a2 2 0 002 2 2 2 0 012 2v2.945M8 3.935V5.5A2.5 2.5 0 0010.5 8h.5a2 2 0 012 2 2 2 0 104 0 2 2 0 012-2h1.064M15 20.488V18a2 2 0 012-2h3.064M21 12a9 9 0 11-18 0 9 9 0 0118 0z" stroke-width="2"
/> d="M3.055 11H5a2 2 0 012 2v1a2 2 0 002 2 2 2 0 012 2v2.945M8 3.935V5.5A2.5 2.5 0 0010.5 8h.5a2 2 0 012 2 2 2 0 104 0 2 2 0 012-2h1.064M15 20.488V18a2 2 0 012-2h3.064M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
</svg> />
<span>Public</span> </svg>
{:else} <span>Public</span>
<svg {:else}
class="w-5 h-5 inline-block" <svg
fill="none" class="w-5 h-5 inline-block"
stroke="currentColor" fill="none"
viewBox="0 0 24 24" stroke="currentColor"
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
> xmlns="http://www.w3.org/2000/svg"
<path >
stroke-linecap="round" <path
stroke-linejoin="round" stroke-linecap="round"
stroke-width="2" stroke-linejoin="round"
d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21" stroke-width="2"
/> d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"
</svg> />
<span>Private</span> </svg>
{/if} <span>Private</span>
</button> {/if}
</button>
</div>
</div> </div>
{#each data.questions as question, index} {#each data.questions as question, index}
<div <div
+3 -2
View File
@@ -2,17 +2,18 @@
import { signedIn } from '$lib/stores'; import { signedIn } from '$lib/stores';
export async function load({ url, session }) { export async function load({ url, session }) {
const quiz_id = url.searchParams.get('quiz_id');
if (!session.authenticated) { if (!session.authenticated) {
return { return {
status: 302, status: 302,
redirect: '/account/login?returnTo=/edit' redirect: `/account/login?returnTo=/edit?quiz_id=${quiz_id}`
}; };
} }
if (session.authenticated) { if (session.authenticated) {
signedIn.set(true); signedIn.set(true);
} }
const quiz_id = url.searchParams.get('quiz_id');
if (quiz_id === null) { if (quiz_id === null) {
return { return {
status: 404 status: 404