diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-10-03 16:30:13 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-10-05 17:36:50 +0200 |
commit | f972745ac092a1657d40d9fb01f7c68508a7c416 (patch) | |
tree | cf4d51b2d496f397f16aa5d1eedcc6219dc239b5 /views | |
parent | d214832a193a06f20612fcfb3e64f86562235b70 (diff) | |
download | server-f972745ac092a1657d40d9fb01f7c68508a7c416.tar.gz |
Add contact list with friends and blacklisted users.
Diffstat (limited to 'views')
-rw-r--r-- | views/contacts.pug | 54 | ||||
-rw-r--r-- | views/header.pug | 1 | ||||
-rw-r--r-- | views/join.pug | 6 | ||||
-rw-r--r-- | views/message_send.pug | 4 | ||||
-rw-r--r-- | views/user.pug | 12 |
5 files changed, 75 insertions, 2 deletions
diff --git a/views/contacts.pug b/views/contacts.pug new file mode 100644 index 0000000..62840f9 --- /dev/null +++ b/views/contacts.pug @@ -0,0 +1,54 @@ +//- vim:ts=4:sw=4: +doctype html +html + head + include head + title Contacts + style. + table { min-width: 400px } + td a.red { text-decoration: none; color: brown; font-size: 14px; margin-left: 8px; } + td a.blue { text-decoration: none; color: black; font-size: 16px; margin-left: 8px; } + td a.blue:hover { color: blue; } + body + include header + article + + h1 Friends & Enemies + + table + thead + tr + th Friends + th Last seen + th + tbody + each who in friends + tr + td + a(href="/user/"+who.name)= who.name + td= who.atime + td.r + a.blue(href="/message/send/"+who.name) 📝 + a.red(href="/contact/remove/"+who.name) ❌ + else + tr + td Nobody + + if enemies.length > 0 + p + + table + thead + tr + th Blacklist + th + tbody + each who in enemies + tr + td + a(href="/user/"+who.name)= who.name + td.r + a.red(href="/contact/remove/"+who.name) ❌ + else + tr + td Nobody diff --git a/views/header.pug b/views/header.pug index a0e9707..61f5250 100644 --- a/views/header.pug +++ b/views/header.pug @@ -10,6 +10,7 @@ header a(href="/games/active") Games (#{user.active}) else a(href="/games/active") Games + a(href="/contacts") Friends if user.unread > 0 a(href="/inbox") Inbox (#{user.unread}) else diff --git a/views/join.pug b/views/join.pug index 7a929d1..ab53ddc 100644 --- a/views/join.pug +++ b/views/join.pug @@ -10,17 +10,21 @@ html style. table { min-width: 0; } th,td { border: 1px solid black; } - td a.red { text-decoration: none; color: brown; font-size: 14px; float: right; } + td a.red { text-decoration: none; color: brown; font-size: 15px; float: right; } td a { text-decoration: underline; color: blue; } th { white-space: nowrap; background-color: gainsboro; } td { width: 180px; background-color: white; } #message { background-color: whitesmoke; } .hide { display: none; } + td.enemy { background-color: #f66 } + td.enemy::before { content: "\1f6ab "; color: #000; font-size: 15px; } script. let game = !{ JSON.stringify(game) } let roles = !{ JSON.stringify(roles) } let players = !{ JSON.stringify(players) } let user_id = !{ user.user_id } + let whitelist = !{ JSON.stringify(whitelist) } + let blacklist = !{ JSON.stringify(blacklist) } let ready = !{ ready } script(src="/join.js") body diff --git a/views/message_send.pug b/views/message_send.pug index c573ef6..48e7b64 100644 --- a/views/message_send.pug +++ b/views/message_send.pug @@ -33,7 +33,11 @@ html value=to_name onpress="return next(event,'#subject')" autofocus=(to_name === "") + list="friends" ) + datalist(id="friends") + each who in friends + option= who p Subject: br diff --git a/views/user.pug b/views/user.pug index 4c26716..545d1ab 100644 --- a/views/user.pug +++ b/views/user.pug @@ -25,9 +25,19 @@ html p Member since #{who.ctime}. p Last seen #{who.atime}. - if user + + if user && (who.user_id !== user.user_id) p a(href="/message/send/"+who.name) Send message + br + if relation > 0 + a(href="/contact/remove-user/"+who.name) Remove from friends + else if relation < 0 + a(href="/contact/remove-user/"+who.name) Remove from blacklist + else + a(href="/contact/add-friend/"+who.name) Add to friends + br + a(href="/contact/add-enemy/"+who.name) Blacklist user if open_games.length > 0 h2 Open |