From 9eeb9b6f39e85a748088ecb62fff049fdcb6a0fc Mon Sep 17 00:00:00 2001 From: "me@ow.nekobit.net" Date: Thu, 31 Mar 2022 19:35:14 +0000 Subject: [PATCH] Fix profile view, menus FossilOrigin-Name: e219385af346bfbdb070a7e17bf6fe5020d1dfddfae5077d83cb34db45ceb826 --- Makefile | 5 ++ dist/treebird20.css | 95 ++++++++++++++++++++++++++++++----- src/main.c | 3 ++ src/page_config.c | 52 +++++++++++++++---- src/page_config.h | 3 ++ static/account.html | 13 +++-- static/config.html | 47 ----------------- static/config_appearance.html | 30 +++++++++++ static/config_general.html | 22 ++++++++ static/status.html | 9 +++- 10 files changed, 204 insertions(+), 75 deletions(-) create mode 100644 static/config_appearance.html create mode 100644 static/config_general.html diff --git a/Makefile b/Makefile index 6e73bce..4873c03 100644 --- a/Makefile +++ b/Makefile @@ -76,6 +76,11 @@ $(PAGES_DIR)/follow_svg.chtml: $(PAGES_DIR)/follow_svg.html ./filec $< data_follow_svg_html > $@ $(PAGES_DIR)/notification_action.chtml: $(PAGES_DIR)/notification_action.html ./filec $< data_notification_action_html > $@ +$(PAGES_DIR)/config_general.chtml: $(PAGES_DIR)/config_general.html + ./filec $< data_config_general_html > $@ +$(PAGES_DIR)/config_appearance.chtml: $(PAGES_DIR)/config_appearance.html + ./filec $< data_config_appearance_html > $@ + $(MASTODONT_DIR): git clone $(MASTODONT_URL) || true diff --git a/dist/treebird20.css b/dist/treebird20.css index d3f399e..2b2a5bf 100644 --- a/dist/treebird20.css +++ b/dist/treebird20.css @@ -461,7 +461,6 @@ ul li:first-child a.sidebarbtn .status .poster-stats { - display: flex; /* To maintain compatibility while keeping it a flexbox, we have to * hardcode the width, sorry! Tables are just weird and I hate CSS */ max-width: 520px; @@ -494,8 +493,9 @@ ul li:first-child a.sidebarbtn { color: #808080; display: inline; + float: right; font-size: 12px; - margin: 3px 0 0 3px; + margin: 3px 3px 0 3px; } .status-interact @@ -578,6 +578,10 @@ ul li:first-child a.sidebarbtn **********************/ .header-btn { + display: inline-block; + padding: 8px 15px; + margin: 0; + background: inherit; text-decoration: none; color: #606060; font-size: 14px; @@ -602,27 +606,38 @@ ul li:first-child a.sidebarbtn .acct-banner { width: 100%; - display: flex; background-position: center center; background-repeat: no-repeat; background-size: cover; height: 256px; } -.acct-pfp +.account { position: relative; +} + +.account-info +{ + background: linear-gradient(#e4e4e4, #efefef); + color: #000; + padding: 2px 50px; + border-bottom: 1px solid #cacaca; +} + +.acct-pfp +{ + position: absolute; + display: inline; z-index: 100; border: 3px solid #cacaca; background-color: #fff; border-radius: 8px; width: 100px; height: 100px; - top: -8px; - left: 150px; + top: 190px; + left: 42px; object-fit: cover; - margin-top: -108px; - margin-left: -108px; background-position: center center; background-repeat: no-repeat; background-size: cover; @@ -630,7 +645,6 @@ ul li:first-child a.sidebarbtn .acct-header { - display: flex; z-index: 1; padding-left: 160px; background: linear-gradient(#fff, #f1f1f1); @@ -640,6 +654,7 @@ ul li:first-child a.sidebarbtn .acct-info-data { + display: inline-block; position: relative; left: 160px; top: 200px; @@ -663,11 +678,24 @@ ul li:first-child a.sidebarbtn text-shadow: 0px 0px 5px #000; } -.header-btn +.follow-btn { - display: inline-block; - padding: 8px 15px; - margin: 0; + margin-left: auto; + position: relative; + float: right; + top: 10px; + margin: 0px 15px 15px 0px; + padding: 5px 20px; + border-radius: 24px; + background: inherit; + box-shadow: inset 0px 2px 5px rgba(0, 0, 0, 0.2); +} + +.follow-btnm.active +{ + box-shadow: unset; + color: #fff; + background: linear-gradient(#aa0000, #600000); } /**************** @@ -904,3 +932,44 @@ ul.large-list li a border-right: 1px solid #dadada; } + +/* MENUS */ + +.menu-container:hover .menu +{ + position: absolute; + display: block; +} + +.menu +{ + z-index: 5; + display: none; + background: #fafafa; + border-radius: 4px; + box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.3); +} + +.menu ul +{ + margin: 0; + padding: 4px 0 4px 0; +} + +.menu ul li +{ + list-style-type: none; +} + +.menu .btn +{ + background: unset; + display: block; + padding: 6px 12px; +} + +.menu .btn:hover +{ + background-color: #eaeaea; + color: #000; +} diff --git a/src/main.c b/src/main.c index 46923db..5ad9ce3 100644 --- a/src/main.c +++ b/src/main.c @@ -67,7 +67,10 @@ int main(void) * Path handling * ******************/ struct path_info paths[] = { + { "/config/general", content_config_general }, + { "/config/appearance", content_config_appearance }, { "/config", content_config }, + /* { "/config/account", content_config_account }, */ { "/login", content_login }, { "/test", content_test }, { "/@:", content_account }, diff --git a/src/page_config.c b/src/page_config.c index 21ef7e0..6821608 100644 --- a/src/page_config.c +++ b/src/page_config.c @@ -31,7 +31,8 @@ // Pages #include "../static/index.chtml" -#include "../static/config.chtml" +#include "../static/config_general.chtml" +#include "../static/config_appearance.chtml" #include "../static/config_sidebar.chtml" enum config_category @@ -41,6 +42,17 @@ enum config_category CONFIG_CAT_ACCOUNT }; +static void load_config(struct session* ssn) +{ + if (ssn->post.theme) + { + ssn->config.theme = ssn->post.theme; + printf("Set-Cookie: %s=%s; HttpOnly; SameSite=Strict;", + "theme", ssn->post.theme); + ssn->config.changed = 1; + } +} + static char* construct_config_sidebar(enum config_category cat, size_t* size) { char* sidebar_html; @@ -58,21 +70,17 @@ static char* construct_config_sidebar(enum config_category cat, size_t* size) return sidebar_html; } -void content_config(struct session* ssn, mastodont_t* api, char** data) + +void content_config_general(struct session* ssn, mastodont_t* api, char** data) { char* sidebar_html = construct_config_sidebar(CONFIG_CAT_GENERAL, NULL); - if (ssn->post.theme) - { - ssn->config.theme = ssn->post.theme; - printf("Set-Cookie: %s=%s; HttpOnly; SameSite=Strict;", - "theme", ssn->post.theme); - ssn->config.changed = 1; - } + load_config(ssn); + struct base_page b = { .category = BASE_CAT_CONFIG, .locale = L10N_EN_US, - .content = data_config_html, + .content = data_config_general_html, .sidebar_left = sidebar_html }; @@ -80,3 +88,27 @@ void content_config(struct session* ssn, mastodont_t* api, char** data) // Cleanup free(sidebar_html); } + + +void content_config_appearance(struct session* ssn, mastodont_t* api, char** data) +{ + char* sidebar_html = construct_config_sidebar(CONFIG_CAT_APPEARANCE, NULL); + + load_config(ssn); + + struct base_page b = { + .category = BASE_CAT_CONFIG, + .locale = L10N_EN_US, + .content = data_config_appearance_html, + .sidebar_left = sidebar_html + }; + + render_base_page(&b, ssn, api); + // Cleanup + free(sidebar_html); +} + +void content_config(struct session* ssn, mastodont_t* api, char** data) +{ + +} diff --git a/src/page_config.h b/src/page_config.h index 59a3043..fe601b2 100644 --- a/src/page_config.h +++ b/src/page_config.h @@ -22,6 +22,9 @@ #include #include "session.h" +void content_config_appearance(struct session* ssn, mastodont_t* api, char** data); +void content_config_general(struct session* ssn, mastodont_t* api, char** data); +void content_config_account(struct session* ssn, mastodont_t* api, char** data); void content_config(struct session* ssn, mastodont_t* api, char** data); #endif // PAGE_CONFIG_H diff --git a/static/account.html b/static/account.html index 69f44eb..5fb2c39 100644 --- a/static/account.html +++ b/static/account.html @@ -7,25 +7,30 @@ - + + diff --git a/static/config.html b/static/config.html index 830e366..e69de29 100644 --- a/static/config.html +++ b/static/config.html @@ -1,47 +0,0 @@ -
-
-

General

-

JavaScript

-
    -
  • - - -
  • -
  • - - -
  • -
  • - - -
  • -
- - -

Appearance

-

Theme variant

-
    -
  • - - -
  • -
-

Color Scheme

-
    -
  • - - -
  • -
  • - - -
  • -
- - -
-
diff --git a/static/config_appearance.html b/static/config_appearance.html new file mode 100644 index 0000000..0508638 --- /dev/null +++ b/static/config_appearance.html @@ -0,0 +1,30 @@ +
+
+ +

Appearance

+

Theme variant

+
    +
  • + + +
  • +
+

Color Scheme

+
    +
  • + + +
  • +
  • + + +
  • +
+ + +
+
diff --git a/static/config_general.html b/static/config_general.html new file mode 100644 index 0000000..52515a3 --- /dev/null +++ b/static/config_general.html @@ -0,0 +1,22 @@ +
+
+

General

+

JavaScript

+
    +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
+ + +
+
diff --git a/static/status.html b/static/status.html index 0b07ee3..02fc001 100644 --- a/static/status.html +++ b/static/status.html @@ -11,8 +11,15 @@