From 213e0d86f24fdfab277f152316660bd2b602f587 Mon Sep 17 00:00:00 2001 From: Doug Hoyte Date: Mon, 9 Dec 2024 14:16:37 -0500 Subject: [PATCH] wip --- src/apps/web/WebData.h | 36 ---------------------- src/apps/web/static/oddbean.css | 35 ++------------------- src/apps/web/tmpls/feed/communityInfo.tmpl | 19 ------------ src/apps/web/tmpls/feed/item.tmpl | 2 +- src/apps/web/tmpls/main.tmpl | 5 --- 5 files changed, 3 insertions(+), 94 deletions(-) delete mode 100644 src/apps/web/tmpls/feed/communityInfo.tmpl diff --git a/src/apps/web/WebData.h b/src/apps/web/WebData.h index 7c26dc7..afeb185 100644 --- a/src/apps/web/WebData.h +++ b/src/apps/web/WebData.h @@ -694,39 +694,3 @@ struct UserEvents { return tmpl::user::comments(ctx); } }; - - - -struct CommunitySpec { - tao::json::value raw; - std::string adminNpub; - std::string adminTopic; -}; - -inline CommunitySpec lookupCommunitySpec(lmdb::txn &txn, Decompressor &decomp, UserCache &userCache, std::string_view descriptor) { - CommunitySpec spec; - - size_t pos = descriptor.find("/"); - if (pos == std::string_view::npos) throw herr("bad descriptor"); - spec.adminNpub = std::string(descriptor.substr(0, pos)); - std::string authorPubkey = decodeBech32Simple(spec.adminNpub); - spec.adminTopic = descriptor.substr(pos + 1); - - tao::json::value filter = tao::json::value({ - { "authors", tao::json::value::array({ to_hex(authorPubkey) }) }, - { "kinds", tao::json::value::array({ uint64_t(33700) }) }, - { "#d", tao::json::value::array({ spec.adminTopic }) }, - }); - - bool found = false; - - foreachByFilter(txn, filter, [&](uint64_t levId){ - spec.raw = tao::json::from_string(getEventJson(txn, decomp, levId)); - found = true; - return false; - }); - - if (!found) throw herr("unable to find community"); - - return spec; -} diff --git a/src/apps/web/static/oddbean.css b/src/apps/web/static/oddbean.css index c4aaac7..01b6937 100644 --- a/src/apps/web/static/oddbean.css +++ b/src/apps/web/static/oddbean.css @@ -76,12 +76,6 @@ h2 { margin-left: 5px; } - .community-rules { - font-size: 70%; - color: darkmagenta; - margin-left: 5px; - } - .new-post-link { margin-left: 20px; } @@ -258,9 +252,9 @@ table.vert { } -/* communities */ +/* feeds */ -.community-item { +.feed-item { margin-bottom: 8px; overflow: hidden; @@ -284,31 +278,6 @@ table.vert { } } -.community-info { - h2 { - margin-bottom: 10px; - font-size: 110%; - font-weight: bold; - } - - > div { - padding-left: 5px; - margin-bottom: 25px; - } - - .desc { - white-space: pre-line; - } - - .algo { - white-space: pre; - font-family: monospace; - margin-top: 25px; - padding: 10px 10px 10px 10px; - background-color: lightgoldenrodyellow; - } -} - /* voting */ diff --git a/src/apps/web/tmpls/feed/communityInfo.tmpl b/src/apps/web/tmpls/feed/communityInfo.tmpl deleted file mode 100644 index 1673c1f..0000000 --- a/src/apps/web/tmpls/feed/communityInfo.tmpl +++ /dev/null @@ -1,19 +0,0 @@ -
-

Community: $(ctx.communitySpec.name)

- -
- Admin: $(ctx.communitySpec.adminUsername) ($(ctx.communitySpec.adminTopic)) -
- - -

Description

- -
$(ctx.communitySpec.desc)
- - -

Algo

- -
-
$(ctx.communitySpec.algo)
-
-
diff --git a/src/apps/web/tmpls/feed/item.tmpl b/src/apps/web/tmpls/feed/item.tmpl index 7957dd3..416ecb5 100644 --- a/src/apps/web/tmpls/feed/item.tmpl +++ b/src/apps/web/tmpls/feed/item.tmpl @@ -1,4 +1,4 @@ -
+
$(ctx.n).
diff --git a/src/apps/web/tmpls/main.tmpl b/src/apps/web/tmpls/main.tmpl index 94c06a6..0ac4fef 100644 --- a/src/apps/web/tmpls/main.tmpl +++ b/src/apps/web/tmpls/main.tmpl @@ -16,12 +16,7 @@ Oddbean - <> ?(ctx.communitySpec) - / $(ctx.communitySpec->name) - - - (algo) ?(ctx.communitySpec) new post