Notifications (compact)

FossilOrigin-Name: f582fe922169ff4c8bc4ce57f8d1a82ffe201041b4bb63d037f16dbb081c3a25
This commit is contained in:
me@ow.nekobit.net 2022-03-20 06:59:50 +00:00
parent d1d0e1e9fe
commit cdd8ec2e76
5 changed files with 70 additions and 11 deletions

35
dist/treebird20.css vendored
View file

@ -195,6 +195,39 @@ ul li:first-child a.sidebarbtn
border-left: 1px solid #cacaca;
}
/****************************
* Notifications *
***************************/
.notification
{
border-bottom: 1px solid #dadada;
}
.pfp-compact-td img
{
border-radius: 3px;
}
.notification-compact .notification-info
{
font-size: 12px;
padding-left: 2px;
padding-right: 2px;
}
.notification-compact .notification-content
{
color: #808080;
font-size: 12px;
padding: 2px 0 2px 0;
}
.notification-compact .notification-stats
{
color: #500000;
font-size: 10px;
}
/***************************
* Statuses *
**************************/
@ -244,7 +277,7 @@ ul li:first-child a.sidebarbtn
margin: 0 5px 0px;
min-width: 0;
width: auto;
padding: 5px 5px 0 5px;
padding: 0 5px 0 5px;
display: flex;
}

View file

@ -59,14 +59,14 @@ void render_base_page(struct base_page* page, mastodont_t* api)
.max_id = NULL,
.min_id = NULL,
.since_id = NULL,
.offset = 2,
.limit = 15,
.offset = 0,
.limit = 20,
};
mastodont_get_notifications(api, &args, &storage, &notifs, &notifs_len);
sidebar_str = construct_notifications_compact(notifs, notifs_len, NULL);
if (mastodont_get_notifications(api, &args, &storage, &notifs, &notifs_len) == 0)
sidebar_str = construct_notifications_compact(notifs, notifs_len, NULL);
//mstdnt_cleanup_notifications(notifs, notifs_len);
mstdnt_cleanup_notifications(notifs, notifs_len);
}
char* data;

View file

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include "notifications.h"
#include "base_page.h"
#include "string_helpers.h"
@ -36,12 +37,24 @@ char* construct_notification(struct mstdnt_notification* notif, int* size)
char* construct_notification_compact(struct mstdnt_notification* notif, int* size)
{
char* notif_html;
char* notif_stats;
easprintf(&notif_stats, "%d - %d - %d",
notif->status->replies_count,
notif->status->reblogs_count,
notif->status->favourites_count);
size_t s = easprintf(&notif_html, data_notification_compact_html,
notif->id);
notif->account->avatar,
notif->account->display_name,
"interacted",
notif->status->content,
notif_stats);
if (size) *size = s;
if (notif_stats) free(notif_stats);
return notif_html;
}

View file

@ -1 +1,14 @@
%s<br>
<table class="notification-compact notification ui-table">
<tr>
<td class="pfp-compact-td">
<img src="%s" width="24">
</td>
<td>
<div class="notification-info">
<span class="username">%s</span> <span class="action">%s</span>
</div>
<div class="notification-content">%s</div>
<div class="notification-stats">%s</div>
</td>
</tr>
</table>

View file

@ -1,3 +1,3 @@
<ul class="notifications-container">
<div class="notifications-container">
</ul>
</div>