🚸 Added redirectTo to not redirect to /overview every time

This commit is contained in:
Mawoka
2022-04-15 10:46:56 +02:00
parent e581437f36
commit 95ca55dcdd
10 changed files with 223 additions and 179 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
<script>
import '@fontsource/marck-script/index.css';
import { getLocalization } from '$lib/i18n';
import { signedIn } from '$lib/stores';
import { signedIn, pathname } from '$lib/stores';
const { t } = getLocalization();
@@ -127,7 +127,7 @@
<li class="py-2">
<a
class="text-lg font-medium lg:px-4 text-gray-600 hover:text-green-600 link-hover"
href="/account/login">{$t('words.login')}</a
href="/account/login?returnTo={$pathname}">{$t('words.login')}</a
>
</li>
<li class="py-2">
+1
View File
@@ -2,3 +2,4 @@ import { writable } from 'svelte/store';
export const navbarVisible = writable(true);
export const signedIn = writable(false);
export const pathname = writable('/');
+42 -25
View File
@@ -1,10 +1,27 @@
<script context='module' lang='ts'>
import { signedIn } from '$lib/stores';
export async function load({ url, session }) {
if (session.authenticated) {
signedIn.set(true);
}
return {};
}
</script>
<script>
import '../app.css';
import Navbar from '$lib/navbar.svelte';
import { navbarVisible } from '$lib/stores';
import { navbarVisible, pathname } from '$lib/stores';
import * as Sentry from '@sentry/browser';
import { BrowserTracing } from '@sentry/tracing';
import { initLocalizationContext } from '$lib/i18n';
import { browser } from '$app/env';
if (browser) {
pathname.set(window.location.pathname)
}
initLocalizationContext();
@@ -24,37 +41,37 @@
{#if $navbarVisible}
<Navbar />
<div class="pt-16 h-screen">
<div class='pt-16 h-screen'>
<slot />
</div>
{:else}
<slot />
{/if}
<style lang="scss">
:global(body) {
// height: 100%;
// width: 100%;
background: linear-gradient(to right, #009444, #39b54a, #8dc63f) repeat-y;
background-size: cover;
/*background: linear-gradient(-225deg, #231557 0%, #44107A 29%, #FF1361 67%, #FFF800 100%); */
/*background: linear-gradient(-225deg, #22E1FF 0%, #1D8FE1 48%, #625EB1 100%); */
color: black;
<style lang='scss'>
:global(body) {
// height: 100%;
// width: 100%;
background: linear-gradient(to right, #009444, #39b54a, #8dc63f) repeat-y;
background-size: cover;
/*background: linear-gradient(-225deg, #231557 0%, #44107A 29%, #FF1361 67%, #FFF800 100%); */
/*background: linear-gradient(-225deg, #22E1FF 0%, #1D8FE1 48%, #625EB1 100%); */
color: black;
// background-size: 400% 400%;
// background-size: 400% 400%;
//animation: background_animation 5s ease infinite;
}
//animation: background_animation 5s ease infinite;
}
@keyframes background_animation {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
@keyframes background_animation {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
</style>
+105 -101
View File
@@ -1,22 +1,25 @@
<script context="module" lang="ts">
<script context='module' lang='ts'>
export async function load({ session, url }) {
const verified = url.searchParams.get('verified');
const returnTo = url.searchParams.get('returnTo') !== null ? url.searchParams.get('returnTo') : '/overview';
console.log(returnTo);
if (session.authenticated) {
return {
status: 302,
redirect: '/overview'
redirect: returnTo
};
}
return {
status: 200,
props: {
verified: verified !== null
verified: verified !== null,
returnTo: returnTo
}
};
}
</script>
<script lang="ts">
<script lang='ts'>
import * as Sentry from '@sentry/browser';
import { navbarVisible } from '$lib/stores';
import { browser } from '$app/env';
@@ -29,6 +32,7 @@
navbarVisible.set(true);
export let verified: boolean;
export let returnTo: string;
let loginData = {
email: '',
@@ -102,119 +106,119 @@
<svelte:head>
<title>ClassQuiz - Login</title>
</svelte:head>
<div class="flex items-center justify-center h-full px-4">
<div class='flex items-center justify-center h-full px-4'>
<div>
{#if verified}
<div
class="flex items-center justify-center p-4 text-green-700 border-2 border-current rounded-lg bg-white"
role="alert"
class='flex items-center justify-center p-4 text-green-700 border-2 border-current rounded-lg bg-white'
role='alert'
>
<svg
width="24"
height="24"
viewBox="0 0 24 24"
class="w-6 h-6"
fill="none"
xmlns="http://www.w3.org/2000/svg"
width='24'
height='24'
viewBox='0 0 24 24'
class='w-6 h-6'
fill='none'
xmlns='http://www.w3.org/2000/svg'
>
<path
d="M10.2426 16.3137L6 12.071L7.41421 10.6568L10.2426 13.4853L15.8995 7.8284L17.3137 9.24262L10.2426 16.3137Z"
fill="currentColor"
d='M10.2426 16.3137L6 12.071L7.41421 10.6568L10.2426 13.4853L15.8995 7.8284L17.3137 9.24262L10.2426 16.3137Z'
fill='currentColor'
/>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M1 12C1 5.92487 5.92487 1 12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12ZM12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21Z"
fill="currentColor"
fill-rule='evenodd'
clip-rule='evenodd'
d='M1 12C1 5.92487 5.92487 1 12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12ZM12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21Z'
fill='currentColor'
/>
</svg>
<h3 class="ml-3 text-sm font-medium">
<h3 class='ml-3 text-sm font-medium'>
You've successfully confirmed your email address.
</h3>
</div>
{/if}
<span class="p-4" />
<span class='p-4' />
<div
class="w-full max-w-sm mx-auto overflow-hidden bg-white rounded-lg shadow-md dark:bg-gray-800"
class='w-full max-w-sm mx-auto overflow-hidden bg-white rounded-lg shadow-md dark:bg-gray-800'
>
<div class="px-6 py-4">
<h2 class="text-3xl font-bold text-center text-gray-700 dark:text-white">
<div class='px-6 py-4'>
<h2 class='text-3xl font-bold text-center text-gray-700 dark:text-white'>
ClassQuiz
</h2>
<h3 class="mt-1 text-xl font-medium text-center text-gray-600 dark:text-gray-200">
<h3 class='mt-1 text-xl font-medium text-center text-gray-600 dark:text-gray-200'>
{$t('login_page.welcome_back')}
</h3>
<p class="mt-1 text-center text-gray-500 dark:text-gray-400">
<p class='mt-1 text-center text-gray-500 dark:text-gray-400'>
{$t('login_page.login_or_create_account')}
</p>
<form on:submit|preventDefault={login}>
<div class="w-full mt-4">
<div class="dark:bg-gray-800 bg-white p-4 rounded-lg">
<div class="relative bg-inherit w-full">
<div class='w-full mt-4'>
<div class='dark:bg-gray-800 bg-white p-4 rounded-lg'>
<div class='relative bg-inherit w-full'>
<input
id="email"
id='email'
bind:value={loginData.email}
name="email"
type="email"
class="w-full peer bg-transparent h-10 rounded-lg text-gray-700 dark:text-white placeholder-transparent ring-2 px-2 ring-gray-500 focus:ring-sky-600 focus:outline-none focus:border-rose-600"
name='email'
type='email'
class='w-full peer bg-transparent h-10 rounded-lg text-gray-700 dark:text-white placeholder-transparent ring-2 px-2 ring-gray-500 focus:ring-sky-600 focus:outline-none focus:border-rose-600'
placeholder={$t('words.email')}
/>
<label
for="email"
class="absolute cursor-text left-0 -top-3 text-sm text-gray-700 dark:text-white bg-inherit mx-1 px-1 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-2 peer-focus:-top-3 peer-focus:text-sky-600 peer-focus:text-sm transition-all"
for='email'
class='absolute cursor-text left-0 -top-3 text-sm text-gray-700 dark:text-white bg-inherit mx-1 px-1 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-2 peer-focus:-top-3 peer-focus:text-sky-600 peer-focus:text-sm transition-all'
>
{$t('words.email')}
</label>
</div>
</div>
<div class="dark:bg-gray-800 bg-white p-4 rounded-lg">
<div class="relative bg-inherit w-full">
<div class='dark:bg-gray-800 bg-white p-4 rounded-lg'>
<div class='relative bg-inherit w-full'>
<input
id="password"
name="password"
type="password"
id='password'
name='password'
type='password'
bind:value={loginData.password}
class="w-full peer bg-transparent h-10 rounded-lg text-gray-700 dark:text-white placeholder-transparent ring-2 px-2 ring-gray-500 focus:ring-sky-600 focus:outline-none focus:border-rose-600"
class='w-full peer bg-transparent h-10 rounded-lg text-gray-700 dark:text-white placeholder-transparent ring-2 px-2 ring-gray-500 focus:ring-sky-600 focus:outline-none focus:border-rose-600'
placeholder={$t('words.password')}
/>
<label
for="password"
class="absolute cursor-text left-0 -top-3 text-sm text-gray-500 bg-inherit mx-1 px-1 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-2 peer-focus:-top-3 peer-focus:text-sky-600 peer-focus:text-sm transition-all"
for='password'
class='absolute cursor-text left-0 -top-3 text-sm text-gray-500 bg-inherit mx-1 px-1 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-2 peer-focus:-top-3 peer-focus:text-sky-600 peer-focus:text-sm transition-all'
>
{$t('words.password')}
</label>
</div>
</div>
<div class="flex items-center justify-between mt-4">
<div class='flex items-center justify-between mt-4'>
<a
href="/account/reset-password"
class="text-sm text-gray-600 dark:text-gray-200 hover:text-gray-500"
>{$t('register_page.forgot_password?')}</a
href='/account/reset-password'
class='text-sm text-gray-600 dark:text-gray-200 hover:text-gray-500'
>{$t('register_page.forgot_password?')}</a
>
<button
class="px-4 py-2 leading-5 text-white transition-colors duration-200 transform bg-gray-700 rounded hover:bg-gray-600 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
class='px-4 py-2 leading-5 text-white transition-colors duration-200 transform bg-gray-700 rounded hover:bg-gray-600 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50'
disabled={!inputValid}
type="submit"
type='submit'
>
{#if isSubmitting}
<svg
class="h-4 w-4 animate-spin mx-auto my-20"
viewBox="3 3 18 18"
class='h-4 w-4 animate-spin mx-auto my-20'
viewBox='3 3 18 18'
>
<path
class="fill-black"
d="M12 5C8.13401 5 5 8.13401 5 12C5 15.866 8.13401 19 12 19C15.866 19 19 15.866 19 12C19 8.13401 15.866 5 12 5ZM3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12Z"
class='fill-black'
d='M12 5C8.13401 5 5 8.13401 5 12C5 15.866 8.13401 19 12 19C15.866 19 19 15.866 19 12C19 8.13401 15.866 5 12 5ZM3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12Z'
/>
<path
class="fill-blue-100"
d="M16.9497 7.05015C14.2161 4.31648 9.78392 4.31648 7.05025 7.05015C6.65973 7.44067 6.02656 7.44067 5.63604 7.05015C5.24551 6.65962 5.24551 6.02646 5.63604 5.63593C9.15076 2.12121 14.8492 2.12121 18.364 5.63593C18.7545 6.02646 18.7545 6.65962 18.364 7.05015C17.9734 7.44067 17.3403 7.44067 16.9497 7.05015Z"
class='fill-blue-100'
d='M16.9497 7.05015C14.2161 4.31648 9.78392 4.31648 7.05025 7.05015C6.65973 7.44067 6.02656 7.44067 5.63604 7.05015C5.24551 6.65962 5.24551 6.02646 5.63604 5.63593C9.15076 2.12121 14.8492 2.12121 18.364 5.63593C18.7545 6.02646 18.7545 6.65962 18.364 7.05015C17.9734 7.44067 17.3403 7.44067 16.9497 7.05015Z'
/>
</svg>
{:else}
@@ -227,16 +231,16 @@
</div>
<div
class="flex items-center justify-center py-4 text-center bg-gray-50 dark:bg-gray-700"
class='flex items-center justify-center py-4 text-center bg-gray-50 dark:bg-gray-700'
>
<span class="text-sm text-gray-600 dark:text-gray-200"
>{$t('login_page.already_have_account')}
<span class='text-sm text-gray-600 dark:text-gray-200'
>{$t('login_page.already_have_account')}
</span>
<a
href="/account/register"
class="mx-2 text-sm font-bold text-blue-500 dark:text-blue-400 hover:underline"
>{$t('words.register')}</a
href='/account/register'
class='mx-2 text-sm font-bold text-blue-500 dark:text-blue-400 hover:underline'
>{$t('words.register')}</a
>
</div>
</div>
@@ -244,14 +248,14 @@
</div>
<Footer />
<div
class="fixed z-10 inset-0 overflow-y-auto"
aria-labelledby="modal-title"
role="dialog"
aria-modal="true"
class='fixed z-10 inset-0 overflow-y-auto'
aria-labelledby='modal-title'
role='dialog'
aria-modal='true'
class:hidden={!responseData.open}
>
<div
class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0"
class='flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0'
>
<!--
Background overlay, show/hide based on modal state.
@@ -264,13 +268,13 @@
To: "opacity-0"
-->
<div
class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"
aria-hidden="true"
class='fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity'
aria-hidden='true'
/>
<!-- This element is to trick the browser into centering the modal contents. -->
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true"
>&#8203;</span
<span class='hidden sm:inline-block sm:align-middle sm:h-screen' aria-hidden='true'
>&#8203;</span
>
<!--
@@ -284,49 +288,49 @@
To: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
-->
<div
class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full"
class='inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full'
>
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
<div class="sm:flex sm:items-start">
<div class='bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4'>
<div class='sm:flex sm:items-start'>
<div
class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10"
class='mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10'
>
<!-- Heroicon name: outline/exclamation -->
{#if responseData.data === '404' || responseData.data === 'error'}
<svg
class="h-6 w-6 text-red-600"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
aria-hidden="true"
class='h-6 w-6 text-red-600'
xmlns='http://www.w3.org/2000/svg'
fill='none'
viewBox='0 0 24 24'
stroke='currentColor'
aria-hidden='true'
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
stroke-linecap='round'
stroke-linejoin='round'
stroke-width='2'
d='M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z'
/>
</svg>
{:else}
<svg
class="w-6 h-6 text-green-600"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
class='w-6 h-6 text-green-600'
fill='none'
stroke='currentColor'
viewBox='0 0 24 24'
xmlns='http://www.w3.org/2000/svg'
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
stroke-linecap='round'
stroke-linejoin='round'
stroke-width='2'
d='M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z'
/>
</svg>
{/if}
</div>
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
<h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-title">
<div class='mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left'>
<h3 class='text-lg leading-6 font-medium text-gray-900' id='modal-title'>
{#if responseData.data === 'magic'}
{$t('login_page.modal.success.success_check_mail')}
{:else if responseData.data === 'password'}
@@ -339,8 +343,8 @@
You stupid Mawoka!
{/if}
</h3>
<div class="mt-2">
<p class="text-sm text-gray-500">
<div class='mt-2'>
<p class='text-sm text-gray-500'>
{#if responseData.data === 'magic'}
{$t('login_page.modal.success.description.success_check_mail')}
{:else if responseData.data === 'password'}
@@ -357,17 +361,17 @@
</div>
</div>
</div>
<div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
<div class='bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse'>
<button
type="button"
type='button'
on:click={() => {
responseData.open = false;
if (responseData.data === 'magic' || responseData.data === 'password') {
reloadWindow();
}
}}
class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"
>{$t('words.close')}
class='mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm'
>{$t('words.close')}
</button>
</div>
</div>
+1 -1
View File
@@ -5,7 +5,7 @@
if (!session.authenticated) {
return {
status: 302,
redirect: '/account/login'
redirect: '/account/login?returnTO=/create'
};
}
if (session.authenticated) {
+1 -1
View File
@@ -4,7 +4,7 @@
if (!session.authenticated) {
return {
status: 302,
redirect: '/account/login'
redirect: '/account/login?returnTo=/edit'
};
}
+10
View File
@@ -1,3 +1,13 @@
<script context='module' lang='ts'>
import { signedIn } from '$lib/stores';
export async function load({ url, session }) {
if (session.authenticated) {
signedIn.set(true);
}
return {};
}
</script>
<script lang="ts">
const getData = async () => {
const response = await fetch('/api/v1/search/', {
+1 -1
View File
@@ -4,7 +4,7 @@
if (!session.authenticated) {
return {
status: 302,
redirect: '/account/login'
redirect: '/account/login?returnTo=/import'
};
} else {
if (session.authenticated) {
+1 -1
View File
@@ -3,7 +3,7 @@
if (!session.authenticated) {
return {
status: 302,
redirect: '/account/login'
redirect: '/account/login?returnTo=/overview'
};
}
return {
+59 -47
View File
@@ -1,4 +1,16 @@
<script lang="ts">
<script context='module' lang='ts'>
import { signedIn } from '$lib/stores';
export async function load({ url, session }) {
if (session.authenticated) {
signedIn.set(true);
}
return {};
}
</script>
<script lang='ts'>
let search_term = '';
let resp_data = null;
@@ -27,39 +39,39 @@
</script>
<div>
<div class="flex justify-center">
<div class="mb-3 xl:w-96">
<div class='flex justify-center'>
<div class='mb-3 xl:w-96'>
<form
class="input-group relative flex items-stretch flex-row w-full mb-4"
class='input-group relative flex items-stretch flex-row w-full mb-4'
on:submit|preventDefault={submit}
>
<input
type="search"
class="form-control relative flex-auto min-w-0 block w-full px-3 py-1.5 text-base font-normal text-gray-700 bg-white bg-clip-padding border border-solid border-gray-300 rounded transition ease-in-out m-0 focus:text-gray-700 focus:bg-white focus:border-blue-600 focus:outline-none"
placeholder="Search"
aria-label="Search"
aria-describedby="button-addon2"
type='search'
class='form-control relative flex-auto min-w-0 block w-full px-3 py-1.5 text-base font-normal text-gray-700 bg-white bg-clip-padding border border-solid border-gray-300 rounded transition ease-in-out m-0 focus:text-gray-700 focus:bg-white focus:border-blue-600 focus:outline-none'
placeholder='Search'
aria-label='Search'
aria-describedby='button-addon2'
bind:value={search_term}
/>
<button
class="inline-block px-6 py-2.5 bg-blue-600 text-white font-medium text-xs leading-tight uppercase rounded shadow-md hover:bg-blue-700 hover:shadow-lg focus:bg-blue-700 focus:shadow-lg focus:outline-none focus:ring-0 active:bg-blue-800 active:shadow-lg transition duration-150 ease-in-out flex items-center disabled:opacity-50 disabled:cursor-not-allowed"
id="button-addon2"
class='inline-block px-6 py-2.5 bg-blue-600 text-white font-medium text-xs leading-tight uppercase rounded shadow-md hover:bg-blue-700 hover:shadow-lg focus:bg-blue-700 focus:shadow-lg focus:outline-none focus:ring-0 active:bg-blue-800 active:shadow-lg transition duration-150 ease-in-out flex items-center disabled:opacity-50 disabled:cursor-not-allowed'
id='button-addon2'
disabled={search_term.length <= 2}
type="submit"
type='submit'
>
<svg
aria-hidden="true"
focusable="false"
data-prefix="fas"
data-icon="search"
class="w-4"
role="img"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 512 512"
aria-hidden='true'
focusable='false'
data-prefix='fas'
data-icon='search'
class='w-4'
role='img'
xmlns='http://www.w3.org/2000/svg'
viewBox='0 0 512 512'
>
<path
fill="currentColor"
d="M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"
fill='currentColor'
d='M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z'
/>
</svg>
</button>
@@ -70,24 +82,24 @@
{#if resp_data}
{#if resp_data.hits.length !== 0}
<div class="grid grid-cols-3">
<div class='grid grid-cols-3'>
{#each resp_data.hits as quiz}
<div class="flex justify-center">
<a href="/view/{quiz.id}" class="h-max w-fit">
<div class="max-w-md py-4 px-8 bg-white shadow-lg rounded-lg my-20">
<div class='flex justify-center'>
<a href='/view/{quiz.id}' class='h-max w-fit'>
<div class='max-w-md py-4 px-8 bg-white shadow-lg rounded-lg my-20'>
<!-- <div class='flex justify-center md:justify-end -mt-16'>
<img class='w-20 h-20 object-cover rounded-full border-2 border-indigo-500'
src='https://images.unsplash.com/photo-1499714608240-22fc6ad53fb2?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=334&q=80'>
</div>-->
<div>
<h2 class="text-gray-800 text-3xl font-semibold">
<h2 class='text-gray-800 text-3xl font-semibold'>
{@html quiz._formatted.title}
</h2>
<p class="mt-2 text-gray-600">
<p class='mt-2 text-gray-600'>
{@html quiz._formatted.description}
</p>
</div>
<div class="flex mt-4">
<div class='flex mt-4'>
<span>Made by {@html quiz._formatted.user}</span>
</div>
</div>
@@ -96,30 +108,30 @@
{/each}
</div>
{:else}
<div class="flex justify-center">
<h1 class="text-4xl">There is nothing here...</h1>
<div class='flex justify-center'>
<h1 class='text-4xl'>There is nothing here...</h1>
</div>
<div class="flex justify-center">
<div class='flex justify-center'>
<p>
Not finding what you are looking for? Search on <a
class="underline"
href="https://create.kahoot.it/search?query={search_term}&tags=test&filter=filter%3D1"
target="_blank">KAHOOT!</a
>
and <a href="/import" class="underline">Import</a> it!
class='underline'
href='https://create.kahoot.it/search?query={search_term}&tags=test&filter=filter%3D1'
target='_blank'>KAHOOT!</a
>
and <a href='/import' class='underline'>Import</a> it!
</p>
</div>
{/if}
{/if}
<style lang="scss">
/* eslint-disable-next-line css-unused-selector */
mark {
background-color: #ff0;
border-radius: 0.2em;
color: #000;
font-style: normal;
font-weight: bold;
padding: 0 0.2em;
}
<style lang='scss'>
/* eslint-disable-next-line css-unused-selector */
mark {
background-color: #ff0;
border-radius: 0.2em;
color: #000;
font-style: normal;
font-weight: bold;
padding: 0 0.2em;
}
</style>