web: show profile picture in post box on desktop
This commit is contained in:
parent
0616d963d5
commit
781f99e845
4 changed files with 14 additions and 16 deletions
|
@ -1,5 +1,9 @@
|
||||||
@media (max-width: 800px){
|
@media (max-width: 800px){
|
||||||
:root {
|
:root {
|
||||||
|
/* TODO font size should not be controlled by CSS:
|
||||||
|
* Instead I would prefer user settings. The main reason is the font is
|
||||||
|
* too small on my desktop when I use the app in column mode.
|
||||||
|
*/
|
||||||
--fsSmall: 10px;
|
--fsSmall: 10px;
|
||||||
--fsNormal: 14px;
|
--fsNormal: 14px;
|
||||||
--fsReduced: 12px;
|
--fsReduced: 12px;
|
||||||
|
@ -26,9 +30,4 @@
|
||||||
height: 44px;
|
height: 44px;
|
||||||
font-size: 2.2em;
|
font-size: 2.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Post Tools */
|
|
||||||
#newpost > :first-child {
|
|
||||||
width: 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
// This is our main entry.
|
// This is our main entry.
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/API/Window/DOMContentLoaded_event
|
// https://developer.mozilla.org/en-US/docs/Web/API/Window/DOMContentLoaded_event
|
||||||
addEventListener('DOMContentLoaded', (ev) => {
|
addEventListener('DOMContentLoaded', (ev) => {
|
||||||
|
// TODO fix race condition where profile doesn't load fast enough.
|
||||||
damus_web_init();
|
damus_web_init();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -129,7 +129,6 @@ async function damus_web_init()
|
||||||
|
|
||||||
if (!model.done_init) {
|
if (!model.done_init) {
|
||||||
model.loading = false
|
model.loading = false
|
||||||
|
|
||||||
send_initial_filters(ids.account, model.pubkey, relay)
|
send_initial_filters(ids.account, model.pubkey, relay)
|
||||||
} else {
|
} else {
|
||||||
send_home_filters(ids, model, relay)
|
send_home_filters(ids, model, relay)
|
||||||
|
@ -514,8 +513,13 @@ function handle_profiles_loaded(profiles_id, model, relay) {
|
||||||
// stop asking for profiles
|
// stop asking for profiles
|
||||||
model.pool.unsubscribe(profiles_id, relay)
|
model.pool.unsubscribe(profiles_id, relay)
|
||||||
model.realtime = true
|
model.realtime = true
|
||||||
|
|
||||||
redraw_events(model)
|
redraw_events(model)
|
||||||
|
redraw_my_pfp(model)
|
||||||
|
}
|
||||||
|
|
||||||
|
function redraw_my_pfp(model) {
|
||||||
|
const html = render_pfp(model.pubkey, model.profiles[model.pubkey]);
|
||||||
|
document.querySelector(".my-userpic").innerHTML = html;
|
||||||
}
|
}
|
||||||
|
|
||||||
function debounce(f, interval) {
|
function debounce(f, interval) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ function render_home_view(model) {
|
||||||
<label>Home</label>
|
<label>Home</label>
|
||||||
</header>
|
</header>
|
||||||
<div id="newpost">
|
<div id="newpost">
|
||||||
<div><!-- empty to accomodate profile pic --></div>
|
<div class="my-userpic vertical-hide"><!-- To be loaded. --></div>
|
||||||
<div>
|
<div>
|
||||||
<textarea placeholder="What's up?" oninput="post_input_changed(this)" class="post-input" id="post-input"></textarea>
|
<textarea placeholder="What's up?" oninput="post_input_changed(this)" class="post-input" id="post-input"></textarea>
|
||||||
<div class="post-tools">
|
<div class="post-tools">
|
||||||
|
@ -128,12 +128,6 @@ function render_boost(model, ev, opts) {
|
||||||
profile: model.profiles[ev.pubkey]
|
profile: model.profiles[ev.pubkey]
|
||||||
}
|
}
|
||||||
return render_event(model, ev.json_content, opts)
|
return render_event(model, ev.json_content, opts)
|
||||||
//return `
|
|
||||||
//<div class="boost">
|
|
||||||
//<div class="boost-text">Reposted by ${render_name_plain(ev.pubkey, profile)}</div>
|
|
||||||
//${render_event(model, ev.json_content, opts)}
|
|
||||||
//</div>
|
|
||||||
//`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function render_comment_body(model, ev, opts) {
|
function render_comment_body(model, ev, opts) {
|
||||||
|
@ -228,7 +222,7 @@ function render_event(model, ev, opts={}) {
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
function render_pfp(pk, profile, size="normal") {
|
function render_pfp(pk, profile) {
|
||||||
const name = render_name_plain(pk, profile)
|
const name = render_name_plain(pk, profile)
|
||||||
return `<img class="pfp" title="${name}" onerror="this.onerror=null;this.src='${robohash(pk)}';" src="${get_picture(pk, profile)}">`
|
return `<img class="pfp" title="${name}" onerror="this.onerror=null;this.src='${robohash(pk)}';" src="${get_picture(pk, profile)}">`
|
||||||
}
|
}
|
||||||
|
@ -263,7 +257,7 @@ function render_reaction(model, reaction) {
|
||||||
if (reaction.content === "+" || reaction.content === "")
|
if (reaction.content === "+" || reaction.content === "")
|
||||||
emoji = "❤️"
|
emoji = "❤️"
|
||||||
|
|
||||||
return render_pfp(reaction.pubkey, profile, "small")
|
return render_pfp(reaction.pubkey, profile)
|
||||||
}
|
}
|
||||||
|
|
||||||
function render_action_bar(ev, can_delete) {
|
function render_action_bar(ev, can_delete) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue