Skip to content

Commit

Permalink
fix: don't show other user notes if no note is set
Browse files Browse the repository at this point in the history
add: note clear button
  • Loading branch information
trisuaso committed Nov 19, 2024
1 parent f06a4e4 commit 00fadfe
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 135 deletions.
28 changes: 11 additions & 17 deletions crates/rainbeam/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2104,13 +2104,23 @@ nav:not(.legacy *)

#profile_box:not(.legacy *) #profile_card {
padding: 0.75rem !important;
flex-direction: row;
flex-direction: column;
justify-content: space-between;
height: auto !important;
min-height: 100% !important;
min-width: 50%;
}

#profile_box:not(.legacy *) .profile_card_section_2 {
width: 100% !important;

& button,
& a.button,
& .dropdown {
width: 100%;
}
}

#profile_box:not(.legacy *)
#profile_card
.profile_card_section_1
Expand Down Expand Up @@ -2152,26 +2162,10 @@ nav:not(.legacy *)
display: contents;
}

#profile_box:not(.legacy *)
#profile_card
.profile_card_section_2
button:not(.dropdown .inner *),
#profile_box:not(.legacy *) #profile_card .profile_card_section_2 a.button {
width: max-content !important;
border-radius: var(--circle);
}

#profile_box:not(.legacy *) #profile_card .profile_card_section_2 .icon {
display: block !important;
}

#profile_box:not(.legacy *)
#profile_card
.profile_card_section_2
.possible_text {
display: none;
}

#profile_box:not(.legacy *) .profile_card_section_3:not(:has(*)) {
/* remove empty section */
display: none;
Expand Down
1 change: 1 addition & 0 deletions crates/rainbeam/static/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@
.then(async () => {
page += 1;
await load_partial();
app.lucide();
})
.catch(() => {
console.log("partial stuck");
Expand Down
2 changes: 1 addition & 1 deletion crates/rainbeam/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
<b class="title">Social</b>

<a
href="/@{{ profile.username }}/friends/requests"
href="/@{{ profile.username }}/friends"
title="My friends"
>
<i class="icon" data-lucide="book-user"></i>
Expand Down
129 changes: 31 additions & 98 deletions crates/rainbeam/templates/circle/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,10 @@ <h4 class="no-margin username" style="font-weight: normal; opacity: 50%">{{ circ
class="button primary bold"
style="flex: 1 0 auto"
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 16 16"
width="16"
height="16"
aria-label="Plus symbol"
class="icon"
>
<path
d="M7.75 2a.75.75 0 0 1 .75.75V7h4.25a.75.75 0 0 1 0 1.5H8.5v4.25a.75.75 0 0 1-1.5 0V8.5H2.75a.75.75 0 0 1 0-1.5H7V2.75A.75.75 0 0 1 7.75 2Z"
></path>
</svg>
<i
class="icon dropdown-arrow"
data-lucide="plus"
></i>
Post
</a>
{% endif %}
Expand All @@ -176,18 +168,10 @@ <h4 class="no-margin username" style="font-weight: normal; opacity: 50%">{{ circ
class="w-full"
>
Actions
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 16 16"
width="16"
height="16"
aria-label="Chevron down symbol"
<i
class="icon dropdown-arrow"
>
<path
d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"
></path>
</svg>
data-lucide="chevron-down"
></i>
</button>

<div
Expand All @@ -199,38 +183,19 @@ <h4 class="no-margin username" style="font-weight: normal; opacity: 50%">{{ circ
href="#"
onclick="trigger('app:copy_text', ['{{ circle.id }}'])"
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 16 16"
width="16"
height="16"
aria-label="Copy symbol"
class="icon"
>
<path
d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"
></path>
<path
d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"
></path>
</svg>
<i
class="icon dropdown-arrow"
data-lucide="copy"
></i>
Copy ID
</a>
<a
href="javascript:trigger('reports:bootstrap', ['circles', '{{ circle.id }}'])"
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 16 16"
width="16"
height="16"
aria-label="Report symbol"
class="icon"
>
<path
d="M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"
></path>
</svg>
<i
class="icon dropdown-arrow"
data-lucide="flag"
></i>
Report
</a>

Expand All @@ -239,18 +204,10 @@ <h4 class="no-margin username" style="font-weight: normal; opacity: 50%">{{ circ
href="javascript:delete_circle_as_owner()"
class="red"
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 16 16"
width="16"
height="16"
aria-label="Trash symbol"
class="icon"
>
<path
d="M11 1.75V3h2.25a.75.75 0 0 1 0 1.5H2.75a.75.75 0 0 1 0-1.5H5V1.75C5 .784 5.784 0 6.75 0h2.5C10.216 0 11 .784 11 1.75ZM4.496 6.675l.66 6.6a.25.25 0 0 0 .249.225h5.19a.25.25 0 0 0 .249-.225l.66-6.6a.75.75 0 0 1 1.492.149l-.66 6.6A1.748 1.748 0 0 1 10.595 15h-5.19a1.75 1.75 0 0 1-1.741-1.575l-.66-6.6a.75.75 0 1 1 1.492-.15ZM6.5 1.75V3h3V1.75a.25.25 0 0 0-.25-.25h-2.5a.25.25 0 0 0-.25.25Z"
></path>
</svg>
<i
class="icon dropdown-arrow"
data-lucide="trash"
></i>
Delete
</a>

Expand Down Expand Up @@ -328,18 +285,10 @@ <h4 class="no-margin username" style="font-weight: normal; opacity: 50%">{{ circ
href="javascript:delete_circle()"
class="red"
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 16 16"
width="16"
height="16"
aria-label="Trash symbol"
class="icon"
>
<path
d="M11 1.75V3h2.25a.75.75 0 0 1 0 1.5H2.75a.75.75 0 0 1 0-1.5H5V1.75C5 .784 5.784 0 6.75 0h2.5C10.216 0 11 .784 11 1.75ZM4.496 6.675l.66 6.6a.25.25 0 0 0 .249.225h5.19a.25.25 0 0 0 .249-.225l.66-6.6a.75.75 0 0 1 1.492.149l-.66 6.6A1.748 1.748 0 0 1 10.595 15h-5.19a1.75 1.75 0 0 1-1.741-1.575l-.66-6.6a.75.75 0 1 1 1.492-.15ZM6.5 1.75V3h3V1.75a.25.25 0 0 0-.25-.25h-2.5a.25.25 0 0 0-.25.25Z"
></path>
</svg>
<i
class="icon dropdown-arrow"
data-lucide="trash"
></i>
Delete
</a>

Expand Down Expand Up @@ -385,18 +334,10 @@ <h4 class="no-margin username" style="font-weight: normal; opacity: 50%">{{ circ
class="w-full"
>
Actions
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 16 16"
width="16"
height="16"
aria-label="Chevron down symbol"
class="icon"
>
<path
d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"
></path>
</svg>
<i
class="icon dropdown-arrow"
data-lucide="chevron-down"
></i>
</button>

<div
Expand All @@ -407,18 +348,10 @@ <h4 class="no-margin username" style="font-weight: normal; opacity: 50%">{{ circ
<a
href="javascript:trigger('reports:bootstrap', ['circles', '{{ circle.id }}'])"
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 16 16"
width="16"
height="16"
aria-label="Report symbol"
class="icon"
>
<path
d="M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"
></path>
</svg>
<i
class="icon dropdown-arrow"
data-lucide="flag"
></i>
Report
</a>
</div>
Expand Down
19 changes: 15 additions & 4 deletions crates/rainbeam/templates/components/user_note.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% if let Some(profile) = profile %} {% if
user.metadata.exists("sparkler:status_note") | (profile.id == user.id) %}
user.metadata.exists("sparkler:status_note") | (profile.id == user.id) %} {% if
let Some(note) = user.metadata.kv.get("sparkler:status_note") %} {% if
!note.is_empty() | (profile.id == user.id) %}
<button
class="status_note primary {% if use_static == true %}static{% endif %}"
title="View note"
Expand Down Expand Up @@ -43,6 +45,17 @@
</button>

<div class="inner shadow-md w-content" exclude="dropdown">
{% if profile.id == user.id %}
<a
href="/settings?note_clear"
target="_blank"
class="red"
>
<i class="icon" data-lucide="trash"></i>
Clear
</a>
{% endif %}

<b class="title">Actions</b>

<a href="/@{{ user.username }}">
Expand Down Expand Up @@ -81,9 +94,7 @@
</div>

<hr class="flipped" />
{% if let Some(note) = user.metadata.kv.get("sparkler:status_note") %}
<span>{{ shared::ui::render_markdown(note)|safe }}</span>
{% endif %}
</div>
</dialog>
{% endif %} {% endif %}
{% endif %} {% endif %} {% endif %} {% endif %}
13 changes: 1 addition & 12 deletions crates/rainbeam/templates/profile/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -376,18 +376,7 @@ <h4 class="no-margin username" style="font-weight: normal; opacity: 50%">{{ othe
class="w-full"
>
<span class="possible_text">Actions</span>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 16 16"
width="16"
height="16"
aria-label="Chevron down symbol"
class="icon dropdown-arrow"
>
<path
d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"
></path>
</svg>
<i class="icon dropdown-arrow" data-lucide="chevron-down"></i>
</button>

<div
Expand Down
20 changes: 18 additions & 2 deletions crates/rainbeam/templates/settings/account.html
Original file line number Diff line number Diff line change
Expand Up @@ -327,11 +327,27 @@ <h4 class="title">Blocks</h4>

<script>
(() => {
setTimeout(() => {
setTimeout(async () => {
if (window.location.search === "?note") {
document.getElementById("set_note_dialog").showModal();
} else if (window.location.search === "?note_clear") {
if (
!(await trigger("app:confirm", [
"Are you sure you would like to clear your current status?",
]))
) {
window.close();
return;
}

// clear values
update_kv("sparkler:status_note", "");
update_kv("sparkler:status_emoji", "");

// save
globalThis.save_settings().then(() => window.close());
}
}, 100);
}, 250);

globalThis.block_dialog = function () {
// show confirmation
Expand Down
2 changes: 1 addition & 1 deletion crates/rainbeam/templates/settings/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
crate::routing::pages::clean_metadata_raw(other.metadata) %} {% include
"components/theming.html" %} {% endif %}
<style>
label:not(.checkbox_container *),
label:not(.checkbox_container *):not(dialog *),
.setting {
text-transform: uppercase;
opacity: 75%;
Expand Down

0 comments on commit 00fadfe

Please sign in to comment.