Add "View on original instance" link

This commit is contained in:
blankie 2023-11-24 10:55:02 +11:00
parent 452ac756e6
commit 8b443062eb
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
2 changed files with 6 additions and 2 deletions

View File

@ -143,11 +143,11 @@ svg {
.user_page-profile {
width: 7.5em;
height: 7.5em;
margin-right: 0.5em;
}
.user_page-main_header span {
margin-top: auto;
margin-bottom: auto;
margin-left: 0.5em;
}
/* https://stackoverflow.com/a/7354648 */

View File

@ -93,6 +93,10 @@ static inline Element user_header(const httplib::Request& req, const std::string
user_links.nodes.push_back(user_link_field(req, account, i));
}
Node view_on_original = !account.same_server
? Element("span", {" (", Element("a", {{"href", get_origin(req) + '/' + account.server + "/@" + account.username}}, {"View on original instance"}), ")"})
: Node("");
Element header("header", {
Element("a", {{"href", account.header}}, {
Element("img", {{"class", "user_page-header"}, {"alt", "User header"}, {"src", account.header}}, {}),
@ -102,7 +106,7 @@ static inline Element user_header(const httplib::Request& req, const std::string
Element("img", {{"class", "user_page-profile"}, {"alt", "User profile picture"}, {"src", account.avatar}}, {}),
}),
Element("span", {
Element("b", {preprocess_html(req, account.emojis, account.display_name)}), " (", account.acct(), ")",
Element("b", {preprocess_html(req, account.emojis, account.display_name)}), " (", account.acct(), ")", view_on_original,
Element("br"),
Element("br"), Element("b", {"Joined: "}), short_time(account.created_at),
Element("br"),