Focus posts

FossilOrigin-Name: 55e7905faa8d1e944ae99cb61c0fead89578002c32dd3145f0d384877baa7160
This commit is contained in:
me@ow.nekobit.net 2022-03-30 19:26:53 +00:00
parent 321f4ddf71
commit aef9560da0
6 changed files with 41 additions and 12 deletions

20
dist/treebird20.css vendored
View file

@ -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;

View file

@ -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;

View file

@ -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],

View file

@ -18,8 +18,15 @@
#ifndef STATUS_H
#define STATUS_H
#include <stdint.h>
#include <mastodont.h>
#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

View file

@ -1,7 +1,7 @@
<table class="notification-compact notification ui-table">
<tr>
<td class="pfp-compact-td">
<img src="%s" width="24">
<img src="%s">
</td>
<td>
<div class="notification-info">

View file

@ -1,8 +1,8 @@
<table class="status ui-table">
<table id="id-%s" class="status %s ui-table">
%s
<tr>
<td class="pfp-td">
<img src="%s" width="56">
<img src="%s">
</td>
<td class="status-info">
<table class="ui-table">
@ -53,9 +53,9 @@
</form>
</td>
<td>
<form action="%s/status/%s" method="post">
<form action="%s/status/%s#id-%s" method="post">
<label class="pointer">
<svg class="%s" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3h6v6M14 10l6.1-6.1M9 21H3v-6M10 14l-6.1 6.1"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3h6v6M14 10l6.1-6.1M9 21H3v-6M10 14l-6.1 6.1"/></svg>
<input class="hidden" type="submit">
</label>
</form>