From 578af9b2bec81fb52f22b00f3a7c6b3ad6cab96c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=8C=E8=97=A4=E3=81=B2=E3=81=A8=E3=82=8A?= <118675237+babuzeer@users.noreply.github.com> Date: Wed, 13 Mar 2024 13:10:32 +0800 Subject: [PATCH] style: recover the background color (#59) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --------- Co-authored-by: sheeplin <1270610465@qq.com> Co-authored-by: My Go! <118411001+Clear1oveE@users.noreply.github.com> --- src/app.css | 1 + src/routes/chantemplate.svelte | 83 ++++++++++++++++++++++++++-------- src/routes/checknotice.svelte | 59 ++++++++++++++++-------- src/routes/selectTags.svelte | 1 + 4 files changed, 107 insertions(+), 37 deletions(-) diff --git a/src/app.css b/src/app.css index b87aec7..ebb3618 100644 --- a/src/app.css +++ b/src/app.css @@ -41,6 +41,7 @@ h1 { } #app { + width: 100%; max-width: 1280px; margin: 0 auto; padding: 2rem; diff --git a/src/routes/chantemplate.svelte b/src/routes/chantemplate.svelte index 31568e6..fd22f98 100644 --- a/src/routes/chantemplate.svelte +++ b/src/routes/chantemplate.svelte @@ -8,14 +8,17 @@ const pb = new PocketBase(PocketBase_URL); let records = []; + let tags = []; async function noticedisplay() { try { const channel = $currentchannelid; - const response = await pb.collection("notices").getFullList({ + const responses = await pb.collection("notices").getFullList({ sort: "-created", filter: `channelid="${channel}"`, }); - records = response; + const names = responses.map((response) => response.tag); + tags = [...new Set(names)]; + records = responses; } catch (error) { alert("fail to find"); } @@ -37,30 +40,59 @@ -{#each records as record} -
check(record.id)} - on:keypress - > -
{record.tittle}
-
#{record.tag}
-
from:{record.useremail}
+
+
+ {#each records as record} +
check(record.id)} + on:keypress + > + {record.tittle} +
#{record.tag} from:{record.username}
+
+ {record.body.length > 10 + ? `${record.body.substring(0, 10)}...` + : record.body} +
+
+ {/each}
-{/each} +
+

Tags

+ {#each tags as tag} +
{tag}
+ {/each} +
+
diff --git a/src/routes/checknotice.svelte b/src/routes/checknotice.svelte index 424f7f1..336c05c 100644 --- a/src/routes/checknotice.svelte +++ b/src/routes/checknotice.svelte @@ -1,7 +1,7 @@ - -
- {#each records as record} -
-
{record.tittle}
-
- {record.year}.{record.month}.{record.day} - - / #{record.tag} -
from: {record.username}
-
-
{record.body}
-
- {/each} + +{#each records as record} +
+
{record.tittle}
+
+ {record.year}.{record.month}.{record.day}/#{record.tag}/from:{record.username} +
+
{record.body}
+ +
@@ -76,8 +91,12 @@ } .record { - border-bottom: 1px solid #eee; /* 每条记录之间用细线分隔,清晰区分 */ - padding: 15px 0; /* 增加记录内的上下边距 */ + width: auto; + border: 1px solid #ccc; + padding: 15px; + margin: 10px 0; + background-color: #f9f9f9; + } .tittle { @@ -98,4 +117,8 @@ line-height: 1.6; /* 增加行高,提高阅读舒适度 */ color: #444; /* 正文颜色,深于元数据,浅于标题 */ } + + .but { + color: black; /* 设置字体颜色为黑色 */ + } diff --git a/src/routes/selectTags.svelte b/src/routes/selectTags.svelte index 5adc04c..15297cb 100644 --- a/src/routes/selectTags.svelte +++ b/src/routes/selectTags.svelte @@ -73,6 +73,7 @@ day: check.day, useremail: userEmail, noticeid: check.id, + username: check.username, }; await pb.collection("todolist").create(newRecord); alert("添加成功!");