Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -14,7 +14,7 @@ repos:
|
|||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
- 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:
|
hooks:
|
||||||
- id: prettier
|
- id: prettier
|
||||||
files: "^frontend/"
|
files: "^frontend/"
|
||||||
|
|||||||
@@ -7,7 +7,8 @@
|
|||||||
import { Swiper, SwiperSlide } from 'swiper/svelte';
|
import { Swiper, SwiperSlide } from 'swiper/svelte';
|
||||||
import 'swiper/css';
|
import 'swiper/css';
|
||||||
import 'swiper/css/pagination';
|
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 { QuizQuestionType } from '$lib/quiz_types.js';
|
||||||
import { getLocalization } from '../i18n';
|
import { getLocalization } from '../i18n';
|
||||||
import { alertModal } from '../stores';
|
import { alertModal } from '../stores';
|
||||||
@@ -42,7 +43,7 @@
|
|||||||
plausible('Started Game', { props: { quiz_id: id } });
|
plausible('Started Game', { props: { quiz_id: id } });
|
||||||
window.location.assign(`/admin?token=${data.game_id}&pin=${data.game_pin}&connect=1`);
|
window.location.assign(`/admin?token=${data.game_id}&pin=${data.game_pin}&connect=1`);
|
||||||
};
|
};
|
||||||
|
/*
|
||||||
const deleteQuiz = async (to_delete: string) => {
|
const deleteQuiz = async (to_delete: string) => {
|
||||||
if (!confirm('Do you really want to delete this quiz?')) {
|
if (!confirm('Do you really want to delete this quiz?')) {
|
||||||
return;
|
return;
|
||||||
@@ -52,13 +53,16 @@
|
|||||||
});
|
});
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
*/
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="w-screen p-8">
|
<div class="w-screen p-8">
|
||||||
<Swiper
|
<Swiper
|
||||||
grabCursor={true}
|
grabCursor={true}
|
||||||
effect={'coverflow'}
|
effect={'coverflow'}
|
||||||
modules={[EffectCoverflow, Pagination]}
|
modules={[EffectCoverflow, Pagination, Mousewheel, Navigation]}
|
||||||
|
navigation={true}
|
||||||
slidesPerView={1}
|
slidesPerView={1}
|
||||||
mousewheel={true}
|
mousewheel={true}
|
||||||
centeredSlides={true}
|
centeredSlides={true}
|
||||||
@@ -84,8 +88,10 @@
|
|||||||
pagination={{
|
pagination={{
|
||||||
clickable: true
|
clickable: true
|
||||||
}}
|
}}
|
||||||
|
keyboard={{ enabled: true }}
|
||||||
grabCursor={true}
|
grabCursor={true}
|
||||||
modules={[Pagination]}
|
navigation={true}
|
||||||
|
modules={[Pagination, Keyboard, Navigation]}
|
||||||
>
|
>
|
||||||
<SwiperSlide>
|
<SwiperSlide>
|
||||||
<div class="grid grid-cols-6 h-full">
|
<div class="grid grid-cols-6 h-full">
|
||||||
|
|||||||
@@ -43,13 +43,19 @@
|
|||||||
<nav
|
<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"
|
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"
|
<a href="/" class="font-black tracking-tight text-xl text-black marck-script link-hover"
|
||||||
>ClassQuiz</a
|
>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
|
<button
|
||||||
class="lg:hidden"
|
class="lg:hidden dark:text-black"
|
||||||
id="open-menu"
|
id="open-menu"
|
||||||
on:click={toggleMenu}
|
on:click={toggleMenu}
|
||||||
class:hidden={!openMenu}
|
class:hidden={!openMenu}
|
||||||
@@ -74,7 +80,7 @@
|
|||||||
|
|
||||||
<!-- Close menu -->
|
<!-- Close menu -->
|
||||||
<button
|
<button
|
||||||
class="hidden"
|
class="hidden dark:text-black"
|
||||||
id="close-menu"
|
id="close-menu"
|
||||||
class:hidden={openMenu}
|
class:hidden={openMenu}
|
||||||
on:click={toggleMenu}
|
on:click={toggleMenu}
|
||||||
@@ -96,16 +102,11 @@
|
|||||||
<path d="M20 20L4 4m16 0L4 20" />
|
<path d="M20 20L4 4m16 0L4 20" />
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
|
</div>
|
||||||
</section>
|
</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}
|
{#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">
|
<li class="py-2">
|
||||||
<a
|
<a
|
||||||
class="text-lg font-medium lg:px-4 text-gray-600 hover:text-green-600 link-hover"
|
class="text-lg font-medium lg:px-4 text-gray-600 hover:text-green-600 link-hover"
|
||||||
@@ -131,12 +132,6 @@
|
|||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
{:else}
|
{: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">
|
<li class="py-2">
|
||||||
<a
|
<a
|
||||||
class="text-lg font-medium lg:px-4 text-gray-600 hover:text-green-600 link-hover"
|
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 { redirect } from '@sveltejs/kit';
|
||||||
import { signedIn } from '$lib/stores';
|
|
||||||
|
|
||||||
export async function load({ parent }) {
|
export async function load({ parent }) {
|
||||||
const { email } = await parent();
|
const { email } = await parent();
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
import type { Question } from '$lib/quiz_types';
|
import type { Question } from '$lib/quiz_types';
|
||||||
import { getLocalization } from '$lib/i18n';
|
import { getLocalization } from '$lib/i18n';
|
||||||
import Footer from '$lib/footer.svelte';
|
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 Spinner from '$lib/Spinner.svelte';
|
||||||
import MiniSearch from 'minisearch';
|
import MiniSearch from 'minisearch';
|
||||||
|
|
||||||
@@ -45,19 +45,15 @@
|
|||||||
for (let i = 0; i < quizzes.length; i++) {
|
for (let i = 0; i < quizzes.length; i++) {
|
||||||
id_to_position_map[quizzes[i].id] = i;
|
id_to_position_map[quizzes[i].id] = i;
|
||||||
}
|
}
|
||||||
console.log(id_to_position_map);
|
|
||||||
return quizzes_to_show;
|
return quizzes_to_show;
|
||||||
};
|
};
|
||||||
|
|
||||||
let suggestions = [];
|
let suggestions = [];
|
||||||
|
|
||||||
const search = () => {
|
const search = () => {
|
||||||
console.log(search_term);
|
|
||||||
if (search_term === '') {
|
if (search_term === '') {
|
||||||
console.log('HELLO');
|
|
||||||
quizzes_to_show = [];
|
quizzes_to_show = [];
|
||||||
quizzes_to_show = quizzes;
|
quizzes_to_show = quizzes;
|
||||||
console.log(quizzes_to_show);
|
|
||||||
quizzes_to_show = quizzes_to_show;
|
quizzes_to_show = quizzes_to_show;
|
||||||
} else {
|
} else {
|
||||||
const res = minisearch.search(search_term);
|
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_temp = resp_data_temp.replaceAll('</em>', '</mark>');
|
resp_data_temp = resp_data_temp.replaceAll('</em>', '</mark>');
|
||||||
resp_data = JSON.parse(resp_data_temp);
|
resp_data = JSON.parse(resp_data_temp);
|
||||||
console.log('Success!', resp_data);
|
|
||||||
} else {
|
} else {
|
||||||
console.error('Error!', res.status);
|
console.error('Error!', res.status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,13 +89,14 @@
|
|||||||
{$t('words.start')}
|
{$t('words.start')}
|
||||||
</button>
|
</button>
|
||||||
{:else}
|
{:else}
|
||||||
|
<div use:tippy={{ content: 'You need to be logged in to start a game' }}>
|
||||||
<button
|
<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"
|
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
|
disabled
|
||||||
use:tippy={{ content: 'You need to be logged in to start a game' }}
|
|
||||||
>
|
>
|
||||||
{$t('words.start')}
|
{$t('words.start')}
|
||||||
</button>
|
</button>
|
||||||
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-center">
|
<div class="flex justify-center">
|
||||||
|
|||||||
Reference in New Issue
Block a user