Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -14,7 +14,7 @@ repos:
|
||||
hooks:
|
||||
- id: black
|
||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||
rev: 'v2.7.1' # Use the sha / tag you want to point at
|
||||
rev: 'v3.0.0-alpha.0' # Use the sha / tag you want to point at
|
||||
hooks:
|
||||
- id: prettier
|
||||
files: "^frontend/"
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
import { Swiper, SwiperSlide } from 'swiper/svelte';
|
||||
import 'swiper/css';
|
||||
import 'swiper/css/pagination';
|
||||
import { Pagination, EffectCoverflow } from 'swiper';
|
||||
import 'swiper/css/navigation';
|
||||
import { Pagination, EffectCoverflow, Keyboard, Mousewheel, Navigation } from 'swiper';
|
||||
import { QuizQuestionType } from '$lib/quiz_types.js';
|
||||
import { getLocalization } from '../i18n';
|
||||
import { alertModal } from '../stores';
|
||||
@@ -42,7 +43,7 @@
|
||||
plausible('Started Game', { props: { quiz_id: id } });
|
||||
window.location.assign(`/admin?token=${data.game_id}&pin=${data.game_pin}&connect=1`);
|
||||
};
|
||||
|
||||
/*
|
||||
const deleteQuiz = async (to_delete: string) => {
|
||||
if (!confirm('Do you really want to delete this quiz?')) {
|
||||
return;
|
||||
@@ -52,13 +53,16 @@
|
||||
});
|
||||
window.location.reload();
|
||||
};
|
||||
|
||||
*/
|
||||
</script>
|
||||
|
||||
<div class="w-screen p-8">
|
||||
<Swiper
|
||||
grabCursor={true}
|
||||
effect={'coverflow'}
|
||||
modules={[EffectCoverflow, Pagination]}
|
||||
modules={[EffectCoverflow, Pagination, Mousewheel, Navigation]}
|
||||
navigation={true}
|
||||
slidesPerView={1}
|
||||
mousewheel={true}
|
||||
centeredSlides={true}
|
||||
@@ -84,8 +88,10 @@
|
||||
pagination={{
|
||||
clickable: true
|
||||
}}
|
||||
keyboard={{ enabled: true }}
|
||||
grabCursor={true}
|
||||
modules={[Pagination]}
|
||||
navigation={true}
|
||||
modules={[Pagination, Keyboard, Navigation]}
|
||||
>
|
||||
<SwiperSlide>
|
||||
<div class="grid grid-cols-6 h-full">
|
||||
|
||||
@@ -43,13 +43,19 @@
|
||||
<nav
|
||||
class="w-screen px-4 lg:px-10 py-2 flex flex-col lg:flex-row lg:items-center fixed backdrop-blur-2xl bg-white/70 shadow-md z-30 top-0"
|
||||
>
|
||||
<section class="w-full lg:w-max flex justify-between">
|
||||
<section class="w-full lg:w-max grid grid-cols-3 lg:grid-cols-2">
|
||||
<a href="/" class="font-black tracking-tight text-xl text-black marck-script link-hover"
|
||||
>ClassQuiz</a
|
||||
>
|
||||
|
||||
<div class="flex justify-center">
|
||||
<a
|
||||
class="lg:pl-6 text-lg font-medium lg:px-4 text-gray-600 hover:text-green-600 link-hover"
|
||||
href="/play">{$t('words.play')}</a
|
||||
>
|
||||
</div>
|
||||
<div class="flex justify-end">
|
||||
<button
|
||||
class="lg:hidden"
|
||||
class="lg:hidden dark:text-black"
|
||||
id="open-menu"
|
||||
on:click={toggleMenu}
|
||||
class:hidden={!openMenu}
|
||||
@@ -74,7 +80,7 @@
|
||||
|
||||
<!-- Close menu -->
|
||||
<button
|
||||
class="hidden"
|
||||
class="hidden dark:text-black"
|
||||
id="close-menu"
|
||||
class:hidden={openMenu}
|
||||
on:click={toggleMenu}
|
||||
@@ -96,16 +102,11 @@
|
||||
<path d="M20 20L4 4m16 0L4 20" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<ul id="menu-items" class="lg:flex w-full flex-col lg:flex-row lg:pl-6" class:hidden={openMenu}>
|
||||
<ul id="menu-items" class="lg:flex w-full flex-col lg:flex-row" class:hidden={openMenu}>
|
||||
{#if $signedIn}
|
||||
<li class="py-2">
|
||||
<a
|
||||
class="text-lg font-medium lg:px-4 text-gray-600 hover:text-green-600 link-hover"
|
||||
href="/play">{$t('words.play')}</a
|
||||
>
|
||||
</li>
|
||||
<li class="py-2">
|
||||
<a
|
||||
class="text-lg font-medium lg:px-4 text-gray-600 hover:text-green-600 link-hover"
|
||||
@@ -131,12 +132,6 @@
|
||||
>
|
||||
</li>
|
||||
{:else}
|
||||
<li class="py-2">
|
||||
<a
|
||||
class="text-lg font-medium lg:px-4 text-gray-600 hover:text-green-600 link-hover"
|
||||
href="/play">{$t('words.play')}</a
|
||||
>
|
||||
</li>
|
||||
<li class="py-2">
|
||||
<a
|
||||
class="text-lg font-medium lg:px-4 text-gray-600 hover:text-green-600 link-hover"
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
|
||||
export const load = async ({ parent }) => {
|
||||
const { email } = await parent();
|
||||
if (email) {
|
||||
throw redirect(302, '/dashboard');
|
||||
}
|
||||
return {
|
||||
email
|
||||
};
|
||||
};
|
||||
@@ -1,5 +1,4 @@
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import { signedIn } from '$lib/stores';
|
||||
|
||||
export async function load({ parent }) {
|
||||
const { email } = await parent();
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import type { Question } from '$lib/quiz_types';
|
||||
import { getLocalization } from '$lib/i18n';
|
||||
import Footer from '$lib/footer.svelte';
|
||||
import { alertModal, navbarVisible, signedIn } from '$lib/stores';
|
||||
import { navbarVisible, signedIn } from '$lib/stores';
|
||||
import Spinner from '$lib/Spinner.svelte';
|
||||
import MiniSearch from 'minisearch';
|
||||
|
||||
@@ -45,19 +45,15 @@
|
||||
for (let i = 0; i < quizzes.length; i++) {
|
||||
id_to_position_map[quizzes[i].id] = i;
|
||||
}
|
||||
console.log(id_to_position_map);
|
||||
return quizzes_to_show;
|
||||
};
|
||||
|
||||
let suggestions = [];
|
||||
|
||||
const search = () => {
|
||||
console.log(search_term);
|
||||
if (search_term === '') {
|
||||
console.log('HELLO');
|
||||
quizzes_to_show = [];
|
||||
quizzes_to_show = quizzes;
|
||||
console.log(quizzes_to_show);
|
||||
quizzes_to_show = quizzes_to_show;
|
||||
} else {
|
||||
const res = minisearch.search(search_term);
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
resp_data_temp = resp_data_temp.replaceAll('<em>', '<mark>');
|
||||
resp_data_temp = resp_data_temp.replaceAll('</em>', '</mark>');
|
||||
resp_data = JSON.parse(resp_data_temp);
|
||||
console.log('Success!', resp_data);
|
||||
} else {
|
||||
console.error('Error!', res.status);
|
||||
}
|
||||
|
||||
@@ -89,13 +89,14 @@
|
||||
{$t('words.start')}
|
||||
</button>
|
||||
{:else}
|
||||
<div use:tippy={{ content: 'You need to be logged in to start a game' }}>
|
||||
<button
|
||||
class="px-4 py-2 leading-5 text-white transition-colors duration-200 transform bg-gray-700 rounded text-center hover:bg-gray-600 focus:outline-none cursor-not-allowed opacity-50"
|
||||
disabled
|
||||
use:tippy={{ content: 'You need to be logged in to start a game' }}
|
||||
>
|
||||
{$t('words.start')}
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="flex justify-center">
|
||||
|
||||
Reference in New Issue
Block a user