Skip to content

Commit

Permalink
add recommed channel (#72)
Browse files Browse the repository at this point in the history
* feat: add notices to a new collection

the new collection named todolist, and there are small changes about
how the pages look like.

* feat: add notices to a new collection

* style: update npm and run format

* style: run npm format again

* style: channel and notice style

* feat: useremail is added automatically

* ci: format-check

* css: pass the lint

* style: recover the background color

* feat : update the saveChange

* feat: update the title of login and doorpage

* feat: update the format of saveChanges

* feat: update the checknotice

* feat: uodate checknotice format

* feat: fix notice

* feat: add inforpage

* feat: add recommed channel

* feat: fix style

---------

Co-authored-by: 独 后藤 <[email protected]>
Co-authored-by: sheeplin <[email protected]>
Co-authored-by: 後藤ひとり <[email protected]>
  • Loading branch information
4 people authored Mar 16, 2024
1 parent 81e7d45 commit f7c9333
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/routes/infoPage.svelte
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
<script>
import PocketBase from "pocketbase";
import { PocketBase_URL } from "../utils/api/index";
import { currentUserEmail } from "../store.js";
//import { push } from "svelte-spa-router";
import { currentUserEmail, originChannelID } from "../store.js";
import { push } from "svelte-spa-router";
import { onMount } from "svelte";
const pb = new PocketBase(PocketBase_URL);
let isFind = false;
let myChannel = [];
let recChannel = [];
async function checkIsJoined() {
try {
const userEmail = $currentUserEmail;
const response = await pb.collection("channels").getFullList({
const response = await pb.collection("users_channels").getFullList({
sort: "-created",
filter: `useremail="${userEmail}"`,
});
const records = await pb.collection("channels").getFullList();
recChannel = records;
myChannel = response;
if (myChannel != null) {
isFind = true;
Expand All @@ -23,6 +26,11 @@
alert("fail to find");
}
}
function jumpnew(origin) {
//currentchannelid.set(id);
originChannelID.set(origin);
push("/chantemplate");
}
onMount(() => {
checkIsJoined();
Expand All @@ -35,14 +43,21 @@
<div class="blockTitle">My channels</div>
{#if isFind}
{#each myChannel.slice(0, 5) as mychannel}
<div class="channel">{mychannel.channelName}</div>
<button class="channel" on:click={() => jumpnew(mychannel.originid)}
>{mychannel.channelname}</button
>
{/each}
{:else}
<p style="color:black">您还没有加入频道,快去加入一个吧!</p>
{/if}
</div>
<div class="bottom">
<div class="blockTitle">Recommended channels</div>
{#each recChannel.slice(0, 5) as mychannel}
<button class="channel" on:click={() => jumpnew(mychannel.id)}
>{mychannel.channelName}</button
>
{/each}
</div>
</div>

Expand Down Expand Up @@ -113,6 +128,7 @@
padding: 10px; /* 内边距 */
}
.channel {
display: block;
color: black; /* 设置文本颜色 */
margin-bottom: 10px; /* 设置记录之间的间隔 */
font-size: large;
Expand Down

0 comments on commit f7c9333

Please sign in to comment.