diff --git a/app/lib/express.js b/app/lib/express.js index 847c9aa..444fdde 100644 --- a/app/lib/express.js +++ b/app/lib/express.js @@ -562,11 +562,28 @@ router.post("/about", async (req, res) => { }); router.get("/communities", async (req, res) => { + if (isPhone(req)) { + return res.redirect(`/mobile/communities`); + } + const communities = await queries.getCommunities(ssbServer); res.render("communities/list", { communities }); }); +router.get("/mobile/communities", async (req, res) => { + const communities = await queries.getCommunities(ssbServer); + + if (!isPhone(req)) { + return res.redirect(`/communities`); + } + + res.render("mobile/communities/list", { + communities, + layout: "mobile/_layout", + }); +}); + const communityData = (req) => { const name = req.params.name; return queries.getCommunityMembers(ssbServer, name).then((members) => ({ @@ -578,6 +595,10 @@ const communityData = (req) => { router.get("/communities/:name", async (req, res) => { const name = req.params.name; + if (isPhone(req)) { + return res.redirect(`/mobile/communities/${name}`); + } + const [community, posts] = await Promise.all([ communityData(req), queries.getCommunityPosts(ssbServer, name), @@ -590,6 +611,22 @@ router.get("/communities/:name", async (req, res) => { }); }); +router.get("/mobile/communities/:name", async (req, res) => { + const name = req.params.name; + + if (!isPhone(req)) { + return res.redirect(`/communities/${name}`); + } + + const posts = await queries.getCommunityPosts(ssbServer, name); + + res.render("mobile/communities/community", { + community: { name }, + posts, + layout: "mobile/_layout", + }); +}); + router.get("/communities/:name/new", async (req, res) => { const community = await communityData(req); diff --git a/app/public/js/desktop.js b/app/public/js/desktop.js index b89dc9e..f349a03 100644 --- a/app/public/js/desktop.js +++ b/app/public/js/desktop.js @@ -80,7 +80,7 @@ composeButtons.forEach((composeButton) => { let url = composeButton.dataset.url; let body = "message=" + encodeURIComponent(messageInput.value); - if (parent.querySelector(".js-secret-recipients")) { + if (parent.querySelector(".js-recipients-list")) { const recipients = selectedRecipients(); if (recipients.length == 0) return; diff --git a/app/public/js/mobile.js b/app/public/js/mobile.js index 674cd38..52794e8 100644 --- a/app/public/js/mobile.js +++ b/app/public/js/mobile.js @@ -105,7 +105,7 @@ composeButtons.forEach((composeButton) => { let url = composeButton.dataset.url; let body = "message=" + encodeURIComponent(messageInput.value); - if (parent.querySelector(".js-secret-recipients")) { + if (parent.querySelector(".js-recipients-list")) { const recipients = selectedRecipients(); if (recipients.length == 0) return; diff --git a/app/public/mobile_style.css b/app/public/mobile_style.css index da7f3bf..a8eb114 100644 --- a/app/public/mobile_style.css +++ b/app/public/mobile_style.css @@ -95,6 +95,14 @@ nav a.selected { padding: 0; } +.secret-chat.no-secrets { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + align-content: center; +} + .secret-button { padding: 8px 14px; font-size: 16px; @@ -104,7 +112,14 @@ nav a.selected { margin-right: 12px; } -.new-secret-button { +a.compose-new-button { + display: flex; + align-items: center; + justify-content: center; + text-decoration: none; +} + +.compose-new-button { position: fixed; bottom: 95px; width: 65px; @@ -118,7 +133,7 @@ nav a.selected { color: #684510; } -.new-secret-button:hover { +.compose-new-button:hover { background: #fb1; } @@ -146,3 +161,11 @@ nav a.selected { border-bottom: none; height: 33px; } + +.community-topic-link { + padding: 10px; +} + +.friends-communities { + border-radius: 0; +} diff --git a/app/public/style.css b/app/public/style.css index 2615080..1b0e3f3 100644 --- a/app/public/style.css +++ b/app/public/style.css @@ -373,3 +373,11 @@ h2 { .community-topic-link:hover .community-topic-name { text-decoration: underline; } + +.community-topic-name { + width: calc(100% - 110px); +} + +.community-topic-replies { + width: 110px; +} diff --git a/app/views/communities/community.ejs b/app/views/communities/community.ejs index 3b1432d..aa70855 100644 --- a/app/views/communities/community.ejs +++ b/app/views/communities/community.ejs @@ -7,6 +7,6 @@
You don't have any friends yet 🙁
+Use the search or look in communities to find some
+ <% } %> -You don't have any friends yet 🙁
+Use the search or look in communities to find some
+ <% } %> -You don't have any friends 🙁
+Go add some to tell secrets
+ <% } %>You don't have any friends 🙁
+Go add some to tell secrets
+ <% } %>