forked from mirrors/treebird
Tabs and blocked message
FossilOrigin-Name: 252a9d37f97358e4b6d3e7a571784b3be0647461d6aa256e992a3c8f7e67942f
This commit is contained in:
parent
77fd533943
commit
c00cf74f6d
11 changed files with 116 additions and 21 deletions
55
dist/treebird20.css
vendored
55
dist/treebird20.css
vendored
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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? */
|
||||
|
|
15
src/error.c
15
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;
|
||||
|
|
|
@ -22,7 +22,14 @@
|
|||
#include <stddef.h>
|
||||
#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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
%s
|
||||
<div class="account">
|
||||
%s
|
||||
<div class="acct-banner" style="background-image:url('%s');">
|
||||
%s
|
||||
<div class="acct-info-data">
|
||||
|
@ -44,6 +44,23 @@
|
|||
|
||||
%s
|
||||
|
||||
<table class="tabs ui-table">
|
||||
<tr>
|
||||
<td>
|
||||
<a href="%s/@%s/statuses"><input class="tab-btn btn focused" type="button" value="%s"></a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="%s/@%s/scrobbles"><input class="tab-btn btn" type="button" value="%s"></a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="%s/@%s/media"><input class="tab-btn btn" type="button" value="%s"></a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="%s/@%s/pinned"><input class="tab-btn btn" type="button" value="%s"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="account-content">
|
||||
%s
|
||||
</div>
|
||||
|
|
|
@ -1 +1 @@
|
|||
<span class="error">%s</span>
|
||||
<span class="e-%s %s">%s</span>
|
||||
|
|
Loading…
Reference in a new issue