diff --git a/dist/treebird20.css b/dist/treebird20.css index a2d6617..1955120 100644 --- a/dist/treebird20.css +++ b/dist/treebird20.css @@ -172,15 +172,29 @@ table.present th, table.present td margin-top: 5px; } -.error +.e-error { display: block; - border-radius: 4px; background-color: #fcb0b0; color: #000; border: 1px solid #bb1c1f; padding: 15px; + font-weight: bold; +} + +.error-pad +{ margin: 5px; + border-radius: 4px; +} + +.e-notice +{ + display: block; + background-color: #ddeeff; + color: #000; + border: 1px solid #66ccff; + padding: 15px; font-weight: bold; } @@ -191,7 +205,7 @@ table.present th, table.present td { background: linear-gradient(#fff, #f7f7f7); color: #000; - text-decoration: none; + text-decoration: none; } .sidebarbtn:hover, .btn:hover @@ -673,6 +687,7 @@ svg.in-reply-to-icon .account-note { word-break: break-all; + text-align: center; } .account-info @@ -681,7 +696,7 @@ svg.in-reply-to-icon color: #000; padding: 15px 50px; border-bottom: 1px solid #cacaca; - max-height: 200px; + max-height: 360px; overflow: auto; } @@ -986,27 +1001,51 @@ ul.large-list li a } /* Navigation */ -.navigation +.navigation, +.tabs { table-layout: fixed; - background-color: #eaeaea; + background-color: #f3f3f3; color: #000; width: 100%; border-spacing: 0px; box-shadow: 0px 1px 0px #dadada; } -.navigation .nav-btn +.navigation .nav-btn, +.tabs .tab-btn { display: block; padding: 8px !important; } -.navigation tr td:not(:last-child) +.tabs .tab-btn +{ + width: 100%; + border: 0; +} + +.tabs .tab-btn.focused +{ + border-bottom: 3px solid #aa0000; +} + +.tabs .tab-btn:hover, +.tabs .tab-btn:active +{ + border-bottom: 3px solid #600000; +} + +.navigation tr td:not(:last-child), +.tabs tr td:not(:last-child) { border-right: 1px solid #dadada; } +.ui-table tr td a +{ + text-decoration: none; +} /* MENUS */ diff --git a/src/account.c b/src/account.c index 4135ece..aa40ed7 100644 --- a/src/account.c +++ b/src/account.c @@ -58,6 +58,7 @@ char* construct_account_page(mastodont_t* api, char* statuses_html; char* follows_you = NULL; char* info_html = NULL; + char* is_blocked = NULL; char* result; // Load statuses html @@ -72,12 +73,17 @@ char* construct_account_page(mastodont_t* api, info_html = construct_account_info(acct, NULL); } - if (relationship) + if (relationship) + { if (MSTDNT_FLAG_ISSET(relationship->flags, MSTDNT_RELATIONSHIP_FOLLOWED_BY)) easprintf(&follows_you, FOLLOWS_YOU_HTML, "Follows you"); + + if (MSTDNT_FLAG_ISSET(relationship->flags, MSTDNT_RELATIONSHIP_BLOCKED_BY)) + is_blocked = construct_error("You are blocked by this user", E_NOTE, 0, NULL); + } result_size = easprintf(&result, data_account_html, - "", + is_blocked ? is_blocked : "", acct->header, follows_you ? follows_you : "", acct->display_name, @@ -104,6 +110,18 @@ char* construct_account_page(mastodont_t* api, !relationship ? "" : MSTDNT_FLAG_ISSET(relationship->flags, MSTDNT_RELATIONSHIP_FOLLOWING) ? "Following!" : "Follow", acct->avatar, info_html ? info_html : "", + config_url_prefix, + acct->acct, + "Statuses", + config_url_prefix, + acct->acct, + "Scrobbles", + config_url_prefix, + acct->acct, + "Media", + config_url_prefix, + acct->acct, + "Pinned", statuses_html); if (result_size == -1) @@ -113,6 +131,7 @@ char* construct_account_page(mastodont_t* api, if (cleanup) free(statuses_html); if (info_html) free(info_html); if (follows_you) free(follows_you); + if (is_blocked) free(is_blocked); return result; } @@ -132,7 +151,7 @@ void content_account(struct session* ssn, mastodont_t* api, char** data) mastodont_get_account_statuses(api, acct.id, NULL, &status_storage, &statuses, &status_len)) { - account_page = construct_error(status_storage.error, NULL); + account_page = construct_error(status_storage.error, E_ERROR, 1, NULL); } else { /* Not an error? */ diff --git a/src/error.c b/src/error.c index e0f5b90..532868b 100644 --- a/src/error.c +++ b/src/error.c @@ -25,10 +25,23 @@ #include "../static/error_404.chtml" #include "../static/error.chtml" -char* construct_error(char* error, size_t* size) +char* construct_error(char* error, enum error_type type, unsigned pad, size_t* size) { char* error_html; + char* class; + + switch (type) + { + case E_ERROR: + class = "error"; break; + case E_WARNING: + class = "warning"; break; + case E_NOTE: + class = "notice"; break; + } size_t s = easprintf(&error_html, data_error_html, + class, + pad ? "error-pad" : "", error); if (size) *size = s; return error_html; diff --git a/src/error.h b/src/error.h index 176e16c..17aa8f6 100644 --- a/src/error.h +++ b/src/error.h @@ -22,7 +22,14 @@ #include #include "session.h" -char* construct_error(char* message, size_t* size); +enum error_type +{ + E_ERROR, + E_WARNING, + E_NOTE +}; + +char* construct_error(char* error, enum error_type type, unsigned pad, size_t* size); void content_not_found(struct session* ssn, mastodont_t* api, char* path); #endif // ERROR_H diff --git a/src/lists.c b/src/lists.c index 3a29827..235c5f8 100644 --- a/src/lists.c +++ b/src/lists.c @@ -72,7 +72,7 @@ void content_lists(struct session* ssn, mastodont_t* api, char** data) if (mastodont_get_lists(api, &lists, &storage, &size_list)) { - lists_page = construct_error(storage.error, NULL); + lists_page = construct_error(storage.error, E_ERROR, 1, NULL); } else { lists_format = construct_lists(lists, size_list, NULL); diff --git a/src/login.c b/src/login.c index 859f606..b07c9af 100644 --- a/src/login.c +++ b/src/login.c @@ -52,7 +52,7 @@ void content_login(struct session* ssn, mastodont_t* api, char** data) if (mastodont_register_app(api, &args_app, &storage, &app) != 0) { - error = construct_error(oauth_store.error, NULL); + error = construct_error(oauth_store.error, E_ERROR, 1, NULL); } else { struct mstdnt_args args_token = { @@ -69,7 +69,7 @@ void content_login(struct session* ssn, mastodont_t* api, char** data) if (mastodont_obtain_oauth_token(api, &args_token, &oauth_store, &token) != 0) { - error = construct_error(oauth_store.error, NULL); + error = construct_error(oauth_store.error, E_ERROR, 1, NULL); } else { printf("Set-Cookie: access_token=%s; Path=/; Max-Age=31536000\r\n", token.access_token); diff --git a/src/notifications.c b/src/notifications.c index cd1d9b4..9d64986 100644 --- a/src/notifications.c +++ b/src/notifications.c @@ -185,7 +185,7 @@ void content_notifications(struct session* ssn, mastodont_t* api, char** data) mstdnt_cleanup_notifications(notifs, notifs_len); } else - notif_html = construct_error(storage.error, NULL); + notif_html = construct_error(storage.error, E_NOTE, 1, NULL); } diff --git a/src/status.c b/src/status.c index a48a5f9..4950ac1 100644 --- a/src/status.c +++ b/src/status.c @@ -327,7 +327,7 @@ void content_status(struct session* ssn, mastodont_t* api, char** data, int is_r // Get information if (mastodont_get_status(api, data[0], &status_storage, &status)) { - stat_html = construct_error("Status not found", NULL); + stat_html = construct_error("Status not found", E_ERROR, 1, NULL); } else { before_html = construct_statuses(api, statuses_before, stat_before_len, NULL); diff --git a/src/timeline.c b/src/timeline.c index 1081628..99d7711 100644 --- a/src/timeline.c +++ b/src/timeline.c @@ -56,7 +56,7 @@ void tl_public(struct session* ssn, mastodont_t* api, int local) if (mastodont_timeline_public(api, &args, &storage, &statuses, &status_count)) { - status_format = construct_error(storage.error, NULL); + status_format = construct_error(storage.error, E_ERROR, 1, NULL); } else { // Construct statuses into HTML diff --git a/static/account.html b/static/account.html index b81d772..dfbb46e 100644 --- a/static/account.html +++ b/static/account.html @@ -1,5 +1,5 @@ +%s
- %s
%s
@@ -44,6 +44,23 @@ %s + + + + + + + +
+ + + + + + + +
+ diff --git a/static/error.html b/static/error.html index eb5f005..7ad39fe 100644 --- a/static/error.html +++ b/static/error.html @@ -1 +1 @@ -%s +%s