From 398e74acd1747104317aaf4ca7d947e776eabb88 Mon Sep 17 00:00:00 2001 From: Xeltica Date: Fri, 24 Jul 2020 12:39:34 +0900 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E7=9F=A5=E3=82=92=E8=A6=8B=E3=82=8C?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=20&=20=E3=83=87=E3=82=B6?= =?UTF-8?q?=E3=82=A4=E3=83=B3=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router.ts | 13 +++++++++++++ src/views/_components.pug | 18 +++++++++++++++++- src/views/notifications.pug | 33 +++++++++++++++++++++++++++++++++ src/views/settings.pug | 3 +++ src/views/timeline.pug | 21 +++++---------------- 5 files changed, 71 insertions(+), 17 deletions(-) create mode 100644 src/views/notifications.pug diff --git a/src/router.ts b/src/router.ts index 14a24dc..95a60c6 100644 --- a/src/router.ts +++ b/src/router.ts @@ -89,6 +89,19 @@ router.get('/gtl', async ctx => { } }); +router.get('/notifications', async ctx => { + const token = ctx.cookies.get('i'); + const host = ctx.cookies.get('host'); + if (!token || !host) { + await die(ctx, 'ログインしてください'); + return; + } + + const notifications = await api(host, 'i/notifications', { i: token }); + await ctx.render('notifications', { notifications }); + +}); + router.get('/renote', async ctx => { const token = ctx.cookies.get('i'); const host = ctx.cookies.get('host'); diff --git a/src/views/_components.pug b/src/views/_components.pug index 2dd6f03..3485095 100644 --- a/src/views/_components.pug +++ b/src/views/_components.pug @@ -55,4 +55,20 @@ mixin post-form(url, placeholder, buttonText) form(action=url, method="post") textarea(name="text", placeholder=placeholder style="max-width: 100%; min-width: 100%; height: 6em; margin-bottom: 8px") button(type="submit")= buttonText - block \ No newline at end of file + block + +mixin nav() + div + |[ + a(href="/") ホーム + |] [ + a(href="/ltl") ローカル + |] [ + a(href="/stl") ソーシャル + |] [ + a(href="/gtl") グローバル + |] [ + a(href="/notifications") 通知 + |] [ + a(href="/settings") 設定 + |] \ No newline at end of file diff --git a/src/views/notifications.pug b/src/views/notifications.pug new file mode 100644 index 0000000..9c62a6e --- /dev/null +++ b/src/views/notifications.pug @@ -0,0 +1,33 @@ +extends _base + +block header + +nav + +block content + h2 通知 + .notifications + each val in notifications + .notification + hr + case val.type + when 'follow' + p !{getUserName(val.user)} さんにフォローされました + when 'mention' + when 'reply' + when 'renote' + when 'quote' + +note(val.note) + when 'reaction' + p !{getUserName(val.user)} さんが !{val.reaction} とリアクションしました + +sub-note(val.note) + when 'pollVote' + p !{getUserName(val.user)} さんが投票しました + +sub-note(val.note) + when 'receiveFollowRequest' + p !{getUserName(val.user)} さんからフォローリクエストされました + when 'followRequestAccepted' + p !{getUserName(val.user)} さんへのフォローが承認されました + when 'groupInvited' + when 'app' + default + p !{val.type} 通知(未実装) \ No newline at end of file diff --git a/src/views/settings.pug b/src/views/settings.pug index 62a48e8..c5d6e4a 100644 --- a/src/views/settings.pug +++ b/src/views/settings.pug @@ -1,5 +1,8 @@ extends _base +block header + +nav + block content h2 設定 h3 ユーザー diff --git a/src/views/timeline.pug b/src/views/timeline.pug index b7ec129..8ecedd1 100644 --- a/src/views/timeline.pug +++ b/src/views/timeline.pug @@ -1,5 +1,8 @@ extends _base +block header + +nav + block content +avatar(user) p: b=getUserName(user) @@ -7,21 +10,7 @@ block content span(style="color: gray")= getAcct(user) +post-form("/action/create-note", "今なにしてる?", "ノート") hr - div - |[ - a(href="/") ホーム - |] [ - a(href="/ltl") ローカル - |] [ - a(href="/stl") ソーシャル - |] [ - a(href="/gtl") グローバル - |] [ - a(href="/notifications") 通知 - |] [ - a(href="/settings") 設定 - |] h2= timelineName each note in timeline - +note(note) - hr \ No newline at end of file + hr + +note(note) \ No newline at end of file