Account page

FossilOrigin-Name: ac401de0a31c87a9c1f72bbf3af3ad385d93729b60b63e37315ee1797a7c91b0
This commit is contained in:
me@ow.nekobit.net 2022-02-09 21:53:21 +00:00
parent 4fe3cabab5
commit 4754712b2f
8 changed files with 228 additions and 7 deletions

View file

@ -32,6 +32,8 @@ $(PAGES_DIR)/status.chtml: $(PAGES_DIR)/status.html
./filec $< data_status_html > $@
$(PAGES_DIR)/config.chtml: $(PAGES_DIR)/config.html
./filec $< data_config_html > $@
$(PAGES_DIR)/account.chtml: $(PAGES_DIR)/account.html
./filec $< data_account_html > $@
$(MASTODONT_DIR):
git clone $(MASTODONT_URL) || true

103
dist/ratfe.css vendored
View file

@ -102,13 +102,14 @@ div#content aside
/*************************************************
* BUTTONS *
*************************************************/
input[type=button], input[type=submit], .sidebarbtn
input[type=button], input[type=submit], .sidebarbtn, .btn
{
background: linear-gradient(#fff, #f1f1f1);
color: #000;
text-decoration: none;
}
input[type=button]:hover, input[type=submit]:hover, .sidebarbtn:hover
input[type=button]:hover, input[type=submit]:hover, .sidebarbtn:hover, .btn:hover
{
background: linear-gradient(#aa0000, #600000);
border-color: #400000;
@ -116,7 +117,7 @@ input[type=button]:hover, input[type=submit]:hover, .sidebarbtn:hover
cursor: pointer;
}
input[type=button]:active, input[type=submit]:active, .sidebarbtn:active
input[type=button]:active, input[type=submit]:active, .sidebarbtn:active, .btn:active
{
background: linear-gradient(#600000, #aa0000);
border-color: #400000;
@ -141,7 +142,6 @@ input[type=button], input[type=submit]
border-bottom: 1px solid #dadada;
display: block;
padding: 8px 8px 8px 16px;
text-decoration: none;
}
ul li:first-child a.sidebarbtn
@ -283,3 +283,98 @@ ul li:first-child a.sidebarbtn
list-style-type: none;
padding-left: 15px;
}
/**********************
* Profiles *
**********************/
.header-btn
{
text-decoration: none;
color: #606060;
font-size: 14px;
}
.header-btn .btn-content
{
color: #000;
}
.btn.header-btn:hover span
{
color: #fff;
}
.header-btn span
{
display: block;
text-align: center;
}
.acct-banner
{
width: 100%;
display: flex;
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
height: 256px;
align-items: end;
}
.acct-pfp
{
position: relative;
z-index: 1;
border: 3px solid #cacaca;
background-color: #fff;
border-radius: 8px;
width: 100px;
height: 100px;
top: 38px;
left: 150px;
margin-top: -108px;
margin-left: -108px;
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
}
.acct-header
{
display: flex;
padding-left: 160px;
background: linear-gradient(#fff, #f1f1f1);
border-bottom: 1px solid #cacaca;
background-color: #e8e8e8;
}
.acct-info-data
{
position: relative;
left: 160px;
top: -10px;
text-shadow: 0px 2px 5px rgba(0, 0, 0, 0.4);
}
.acct-displayname
{
font-size: 26px;
display: block;
color: #fff;
}
.acct-username
{
font-size: 14px;
color: #cacaca;
display: block;
}
.header-btn
{
display: inline-block;
padding: 8px 15px;
margin: 0;
}

BIN
dist/static.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

66
src/account.c Normal file
View file

@ -0,0 +1,66 @@
/*
* RatFE - Lightweight frontend for Pleroma
* Copyright (C) 2022 Nekobit
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include <stdio.h>
#include "base_page.h"
#include "../config.h"
#include "account.h"
#include "easprintf.h"
// Files
#include "../static/index.chtml"
#include "../static/account.chtml"
char* construct_account_page(struct mstdnt_account* acct, size_t* res_size)
{
int result_size;
char* result;
result_size = easprintf(&result, data_account_html,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL);
if (result_size == -1)
result = NULL;
if (res_size) *res_size = result_size;
return result;
}
void content_account(mastodont_t* api)
{
char* account_page;
account_page = construct_account_page(NULL, NULL);
struct base_page b = {
.locale = L10N_EN_US,
.content = account_page,
.sidebar_right = NULL
};
/* Output */
render_base_page(&b);
}

26
src/account.h Normal file
View file

@ -0,0 +1,26 @@
/*
* RatFE - Lightweight frontend for Pleroma
* Copyright (C) 2022 Nekobit
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef ACCOUNT_H
#define ACCOUNT_H
#include <mastodont.h>
char* construct_account_page(struct mstdnt_account* acct, size_t* res_size);
void content_account(mastodont_t* api);
#endif // ACCOUNT_H

View file

@ -40,7 +40,7 @@ void content_index(mastodont_t* api)
status_format = "Error in malloc!";
struct base_page b = {
.locale = L10N_ES_ES,
.locale = L10N_EN_US,
.content = status_format,
.sidebar_right = NULL
};

View file

@ -20,7 +20,7 @@
#include <stdlib.h>
#include "path.h"
#include "index.h"
#include "account.h"
void handle_paths(mastodont_t* api, struct path_info* paths, size_t paths_len)
{
char* path = getenv("PATH_INFO");
@ -31,7 +31,7 @@ void handle_paths(mastodont_t* api, struct path_info* paths, size_t paths_len)
}
else if (path[1] == '@')
{ // Account path
content_index(api);
content_account(api);
}
else
{ // Generic path

32
static/account.html Normal file
View file

@ -0,0 +1,32 @@
<div class="account">
<div class="acct-banner" style="background-image:url('/%s');">
<div class="acct-info-data">
<span class="acct-displayname">%s</span>
<span class="acct-username">%s</span>
</div>
</div>
<div class="acct-pfp" style="background-image:url('/%s');">
</div>
<div class="acct-header">
<a href="#" class="header-btn">
<span class="btn-header">%s</span>
<span class="btn-content">%d</span>
</a>
<a href="#" class="btn header-btn">
<span class="btn-header">%s</span>
<span class="btn-content">%d</span>
</a>
<a href="#" class="btn header-btn">
<span class="btn-header">%s</span>
<span class="btn-content">%d</span>
</a>
</div>
</div>
<div class="account-content">
%s
</div>