you can now UPLAD IMAGES AND VIDS!!! in the quetions of kahootlone/quizzlet

This commit is contained in:
RezHackXYZ 2025-05-31 18:13:50 +05:30
parent 5f53e923d0
commit de7e3da139
29 changed files with 158 additions and 96 deletions

View file

@ -26,7 +26,7 @@
--border-color-checked: {AnswersSymbolAndColorScheme[index].SelectedBorderColor};
--border-color-hover: {AnswersSymbolAndColorScheme[index].HoverBorderColor};
"
class="w-full cursor-pointer rounded-lg border-[5px] border-[var(--border-color)] bg-[var(--bg-color)] pt-1 pr-2 pb-1 pl-2 text-center text-3xl transition-all peer-checked:border-[var(--border-color-checked)] peer-checked:border-[var(--border-color-checked)] peer-checked:bg-[var(--bg-color-checked)] hover:border-[var(--border-color-hover)]"
class="w-full cursor-pointer rounded-lg border-[5px] border-[var(--border-color)] bg-[var(--bg-color)] pt-1 pr-2 pb-1 pl-2 text-center text-3xl transition-all peer-checked:border-[var(--border-color-checked)] peer-checked:bg-[var(--bg-color-checked)] hover:border-[var(--border-color-hover)]"
>
<i class="nf {AnswersSymbolAndColorScheme[index].Symbol}"></i>
{answer}

View file

@ -5,7 +5,7 @@
import SelectFirst from "./buttons/SelectFirst.svelte";
import Wait from "./text/wait.svelte";
import SubmitAwnser from "./buttons/submitAwnser.svelte";
import { CurrentQuestion, Selected } from "../../logic/HostsData.svelte.js";
import { CurrentQuestion, Selected, questions } from "../../logic/HostsData.svelte.js";
</script>
<div class="bg-grey-900 flex h-full items-center justify-center">
@ -15,6 +15,25 @@
<ProgressBar />
{#if CurrentQuestion.v != null}
<Question />
{#if questions.v.media != null}
<div class="mb-3 flex items-center justify-center">
{#if questions.v.media.match(/\.(mp4|webm|ogg|mov|avi|mkv)$/i)}
<video
src={questions.v.media}
class="max-h-[300px] max-w-[500px] rounded-lg"
controls
/>
{:else}
<img
src={questions.v.media}
class="max-h-[300px] max-w-[500px] rounded-lg"
alt="Question media"
/>
{/if}
</div>
{/if}
<Awnsers />
{#if Selected.v != null}
<SubmitAwnser />

View file

@ -11,7 +11,7 @@ import { supabase } from "$lib/supabase.js";
export async function NewStatus(NewStatus, gamePin) {
if (NewStatus == "completed") {
window.location.replace("/results?gamepin" + gamePin + "&playerID=" + playerid.v);
window.location.replace("/kahootclone/results?gamepin=" + gamePin + "&playerID=" + playerid.v);
return;
}
@ -20,7 +20,7 @@ export async function NewStatus(NewStatus, gamePin) {
const { data: questionsData } = await supabase
.from("questions")
.select("id,questionstext,correctanswer")
.select("*")
.eq("gameid", Number(gamePin))
.order("id", { ascending: true });
@ -37,6 +37,7 @@ export async function NewStatus(NewStatus, gamePin) {
correctAnswer: questionsData[CurrentQuestion.v].correctanswer,
answers: answers.map((answer) => answer.content),
questionid: questionsData[CurrentQuestion.v].id,
media: questionsData[CurrentQuestion.v].media || null,
};
isWait.v = false;