Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Commit

Permalink
a few ui tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
BrightonBTC committed Dec 19, 2022
1 parent 14a8320 commit 310fedc
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 5 deletions.
2 changes: 2 additions & 0 deletions bija/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ def store(self):
json.dumps(self.event_members),
json.dumps(self.event.to_json_object())
)
DB.add_profile_if_not_exists(self.event_pk)
DB.add_profile_if_not_exists(self.event.public_key)
if self.event.public_key == self.pubkey:
DB.set_note_liked(self.event_id)

Expand Down
12 changes: 11 additions & 1 deletion bija/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,17 @@ def profile_page():

EXECUTOR.submit(EVENT_HANDLER.subscribe_profile, k, timestamp_minus(TimePeriod.WEEK), list(t.ids))

metadata = {}
if profile.raw is not None and len(profile.raw) > 0:
raw = json.loads(profile.raw)
meta = json.loads(raw['content'])
for item in meta.keys():
if item not in ['name', 'picture', 'about', 'nip05']:
metadata[item] = meta[item]

return render_template("profile.html", page_id=page_id, title="Profile", threads=t.threads, last=t.last_ts,
latest=latest, profile=profile, is_me=is_me)
latest=latest, profile=profile, is_me=is_me, meta=metadata)



@app.route('/profile_feed', methods=['GET'])
Expand Down Expand Up @@ -307,6 +316,7 @@ def update_settings():
items[item[0]] = item[1].strip()
print(items)
DB.upd_settings_by_keys(items)
session['settings'] = DB.get_settings()
return render_template("upd.json", data=json.dumps({'success': 1}))


Expand Down
7 changes: 4 additions & 3 deletions bija/static/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ let updateProfile = function(profile){
document.querySelector("#profile").dataset.updated_ts = profile.updated_at
const name_els = document.querySelectorAll(".uname[data-pk='"+profile.public_key+"']");
for (const name_el of name_els) {
if(profile.nip05 != null && profile.name.length > 0){

if(profile.name != null && profile.name.length > 0){
const nm = name_el.querySelector('.name')
if(nm){
nm.innerText = profile.name
Expand Down Expand Up @@ -736,7 +737,7 @@ class bijaNotes{
if(like_n_el){
this.setLikeCountClickEvents(like_n_el, note.dataset.id)
}
if(cloudinary_cloud != null){
if(typeof cloudinary_cloud !== "undefined"){
const upload_form = note.querySelector('.reply-form')
setCloudUploads(upload_form)
}
Expand Down Expand Up @@ -1308,7 +1309,7 @@ window.addEventListener("load", function () {
});
}

if(cloudinary_cloud != null){
if(typeof cloudinary_cloud !== "undefined"){
const upload_form = document.querySelector('#new_post_form')
setCloudUploads(upload_form)
}
Expand Down
1 change: 1 addition & 0 deletions bija/static/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@ input.post-submit {
}
#profile .profile-item{
display:block;
overflow: hidden;
}
#profile.editing .profile-item{
display:none;
Expand Down
2 changes: 1 addition & 1 deletion bija/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8">
<link rel="stylesheet" href='/static/styles.css' />
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.js" integrity="sha512-q/dWJ3kcmjBLU4Qc47E4A9kTB4m3wuTY7vkFJDTZKjTs8jhyGQnaUrxa0Ytd0ssMZhbNua9hE+E7Qv1j+DyZwA==" crossorigin="anonymous"></script>
{%- if session['settings'] is not none and session['settings']['cloudinary_cloud'] is not none -%}
{%- if session['settings'] is not none and session['settings']['cloudinary_cloud'] is not none and session['settings']['cloudinary_cloud']|length > 0 -%}
<script>
const cloudinary_cloud = "{{ session['settings']['cloudinary_cloud'] }}";
const cloudinary_upload_preset = "{{ session['settings']['cloudinary_upload_preset'] }}";
Expand Down
3 changes: 3 additions & 0 deletions bija/templates/profile.header.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
<h1 class="profile-name">{{profile['name'] | ident_string(profile['public_key'], profile['nip05'], profile['nip05_validated']) | safe }}</h1>
<p class="sm pk">@{{profile['public_key'] | truncate(21, False, '...')}} <img src="/static/copy.svg" class="clipboard icon-sm" data-str="{{profile['public_key']}}"></p>
<pre class="profile-about">{{about| linkify| safe}}</pre>
{%- for item in meta: -%}
<p><span class="sm rnd pad-sm bg1"> {{ item }}</span><span class="sm pad-sm">{{ meta[item] }}</span></p>
{%- endfor -%}
</div>
{%- if is_me -%}
{%- if profile['name'] is not none -%}
Expand Down

0 comments on commit 310fedc

Please sign in to comment.