From aef9560da07158bf65a4da9f04bb52c9b3a95fe6 Mon Sep 17 00:00:00 2001 From: "me@ow.nekobit.net" Date: Wed, 30 Mar 2022 19:26:53 +0000 Subject: [PATCH] Focus posts FossilOrigin-Name: 55e7905faa8d1e944ae99cb61c0fead89578002c32dd3145f0d384877baa7160 --- dist/treebird20.css | 20 +++++++++++++++++++- src/notifications.c | 2 +- src/status.c | 12 ++++++++---- src/status.h | 9 ++++++++- static/notification_compact.html | 2 +- static/status.html | 8 ++++---- 6 files changed, 41 insertions(+), 12 deletions(-) diff --git a/dist/treebird20.css b/dist/treebird20.css index 5cdf2a0..ce54071 100644 --- a/dist/treebird20.css +++ b/dist/treebird20.css @@ -285,6 +285,9 @@ ul li:first-child a.sidebarbtn .pfp-compact-td img { border-radius: 3px; + width: 24px; + height: 24px; + object-fit: cover; } .notification-compact @@ -301,6 +304,8 @@ ul li:first-child a.sidebarbtn font-size: 12px; padding-left: 2px; padding-right: 2px; + margin-top: 0; + font-weight: bold; } .notification-compact .notification-content @@ -325,6 +330,8 @@ ul li:first-child a.sidebarbtn { margin-left: 36px; width: 24px; + height: 24px; + object-fit: cover; } .notification-info .notification-user @@ -345,6 +352,12 @@ ul li:first-child a.sidebarbtn border-spacing: 0px; } +.status.focused +{ + background-color: #ffdddd; + border-left: 3px solid #aa0000; +} + .notification-info + .status { padding-top: 0; @@ -373,7 +386,9 @@ ul li:first-child a.sidebarbtn .pfp-td img { border-radius: 3px; - + width: 56px; + height: 56px; + object-fit: cover; } .status tr @@ -434,6 +449,8 @@ ul li:first-child a.sidebarbtn { margin: 2px 0 0 0; overflow-wrap: break-word; + width: 520px; + display: block; } .status .status-content p @@ -571,6 +588,7 @@ ul li:first-child a.sidebarbtn height: 100px; top: -8px; left: 150px; + object-fit: cover; margin-top: -108px; margin-left: -108px; background-position: center center; diff --git a/src/notifications.c b/src/notifications.c index 39fb68b..e6659df 100644 --- a/src/notifications.c +++ b/src/notifications.c @@ -38,7 +38,7 @@ char* construct_notification(struct mstdnt_notification* notif, int* size) if (notif->status) { // Construct status with notification_info - notif_html = construct_status(notif->status, &s, notif); + notif_html = construct_status(notif->status, &s, notif, 0); } else { notif_html = NULL; diff --git a/src/status.c b/src/status.c index f5b49c8..c940610 100644 --- a/src/status.c +++ b/src/status.c @@ -102,7 +102,8 @@ int try_interact_status(struct session* ssn, mastodont_t* api, char* id) char* construct_status(struct mstdnt_status* status, int* size, - struct mstdnt_notification* notif) + struct mstdnt_notification* notif, + uint8_t flags) { char* stat_html; @@ -131,6 +132,9 @@ char* construct_status(struct mstdnt_status* status, size_t s = easprintf(&stat_html, data_status_html, + status->id, + (flags & STATUS_FOCUSED) == STATUS_FOCUSED ? + "focused" : "", notif_info ? notif_info : "", status->account.avatar, status->account.display_name, /* Username */ @@ -156,8 +160,8 @@ char* construct_status(struct mstdnt_status* status, favourites_count ? favourites_count : "", config_url_prefix, status->id, - config_url_prefix, status->id); + if (size) *size = s; // Cleanup if (reply_count) free(reply_count); @@ -171,7 +175,7 @@ char* construct_status(struct mstdnt_status* status, static char* construct_status_voidwrap(void* passed, size_t index, int* res) { - return construct_status((struct mstdnt_status*)passed + index, res, NULL); + return construct_status((struct mstdnt_status*)passed + index, res, NULL, 0); } char* construct_statuses(struct mstdnt_status* statuses, size_t size, size_t* ret_size) @@ -222,7 +226,7 @@ void content_status(struct session* ssn, mastodont_t* api, char** data, int is_r before_html = construct_statuses(statuses_before, stat_before_len, NULL); // Current status - stat_html = construct_status(&status, NULL, NULL); + stat_html = construct_status(&status, NULL, NULL, STATUS_FOCUSED); if (is_reply) { stat_reply = reply_status(data[0], diff --git a/src/status.h b/src/status.h index 2bce945..490e15e 100644 --- a/src/status.h +++ b/src/status.h @@ -18,8 +18,15 @@ #ifndef STATUS_H #define STATUS_H +#include #include #include "session.h" + +// Flags +#define STATUS_NOOP 0 +#define STATUS_FOCUSED (1<<0) +#define STATUS_EMOJI_PICKER (1<<1) + int try_post_status(struct session* ssn, mastodont_t* api); int try_interact_status(struct session* ssn, mastodont_t* api, char* id); void content_status_create(struct session* ssn, mastodont_t* api, char** data); @@ -28,7 +35,7 @@ void content_status_create(struct session* ssn, mastodont_t* api, char** data); char* construct_post_box(char* reply_id, char* default_content, int* size); -char* construct_status(struct mstdnt_status* status, int* size, struct mstdnt_notification* notif); +char* construct_status(struct mstdnt_status* status, int* size, struct mstdnt_notification* notif, uint8_t flags); char* construct_statuses(struct mstdnt_status* statuses, size_t size, size_t* ret_size); // Status frontends diff --git a/static/notification_compact.html b/static/notification_compact.html index c46a30f..77e5b68 100644 --- a/static/notification_compact.html +++ b/static/notification_compact.html @@ -1,7 +1,7 @@
- +
diff --git a/static/status.html b/static/status.html index d07a6db..0b07ee3 100644 --- a/static/status.html +++ b/static/status.html @@ -1,8 +1,8 @@ - +
%s
- + @@ -53,9 +53,9 @@
-
+