diff --git a/src/routes/Modal.svelte b/src/routes/Modal.svelte index 0083f57..c4b3fb5 100644 --- a/src/routes/Modal.svelte +++ b/src/routes/Modal.svelte @@ -41,7 +41,7 @@ .modal-content { background: rgb(199, 195, 195); - padding: 20px; + padding: 30px; border-radius: 8px; position: relative; } diff --git a/src/routes/mainpage.svelte b/src/routes/mainpage.svelte index bfa8ae3..735eb3f 100644 --- a/src/routes/mainpage.svelte +++ b/src/routes/mainpage.svelte @@ -3,10 +3,68 @@ import PocketBase from "pocketbase"; import { PocketBase_URL } from "../utils/api/index"; import { onMount } from "svelte"; - import { currentUserEmail } from "../store.js"; + import Modal from "./Modal.svelte"; + import { currentUserEmail, currentchannelid ,currentnoticeid } from "../store.js"; const pb = new PocketBase(PocketBase_URL); let username = ""; + let records = []; + let showModal = false; + let showModal2 = false; + let showModal3 = false; + let showModal4 = false; + + async function checkchan() { + try { + const userEmail = $currentUserEmail; + const response = await pb.collection("users_channels").getFullList({ + sort: "-created", + filter: `useremail="${userEmail}"`, + }); + records = response; + } catch (error) { + alert("fail to find"); + } + } + + let recordsNotice = []; + async function checkNotice() { + try { + const userEmail = $currentUserEmail; + const response = await pb.collection("notices").getFullList({ + sort: "-created", + filter: `useremail="${userEmail}"`, + }); + recordsNotice = response; + } catch (error) { + alert("fail to find"); + } + } + + function check(id) { + currentnoticeid.set(id); + push("/checknotice"); + } + + function toggleModal() { + showModal = !showModal; + } + function toggleModal2(){ + showModal2 = !showModal2; + } + function toggleModal3(){ + showModal3 = !showModal3; + } + function toggleModal4(){ + showModal4 = !showModal4; + } + + + function jumpnew(id) { + currentchannelid.set(id); + push("/chantemplate"); + } + async function checkUser() { try { const userEmail = $currentUserEmail; @@ -21,6 +79,8 @@ } onMount(() => { checkUser(); + checkchan(); + checkNotice(); }); let src = "userPicture.jpeg"; @@ -37,20 +97,78 @@
{username}
+