ssb: Make a message % context menu with some new options to begin to declutter the message view itself.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 29m42s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 29m42s
This commit is contained in:
parent
40cf519492
commit
e574758340
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"type": "tildefriends-app",
|
"type": "tildefriends-app",
|
||||||
"emoji": "🦀",
|
"emoji": "🦀",
|
||||||
"previous": "&BNj/9Tct9Iw03fAx0TSjCI5Cm1EizcmTj6JZm3bZpB4=.sha256"
|
"previous": "&R0bGxjJq3G2eJzuKfUrQP4ioSn75QlwvaS39Q9LzMto=.sha256"
|
||||||
}
|
}
|
||||||
|
@ -371,62 +371,34 @@ class TfMessageElement extends LitElement {
|
|||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
render_raw_button() {
|
copy_id(event) {
|
||||||
|
navigator.clipboard.writeText(this.message?.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
render_menu() {
|
||||||
let content = this.get_content();
|
let content = this.get_content();
|
||||||
let raw_button;
|
let formats = [
|
||||||
switch (this.format) {
|
['message', 'Message'],
|
||||||
case 'raw':
|
];
|
||||||
if (content?.type == 'post' || content?.type == 'blog') {
|
if (content?.type == 'post' || content?.type == 'blog') {
|
||||||
raw_button = html`<button
|
formats.push(['md', 'Markdown']);
|
||||||
class="w3-button w3-theme-d1"
|
|
||||||
@click=${() => (this.format = 'md')}
|
|
||||||
>
|
|
||||||
Markdown
|
|
||||||
</button>`;
|
|
||||||
} else {
|
|
||||||
raw_button = html`<button
|
|
||||||
class="w3-button w3-theme-d1"
|
|
||||||
@click=${() => (this.format = 'message')}
|
|
||||||
>
|
|
||||||
Message
|
|
||||||
</button>`;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'md':
|
|
||||||
raw_button = html`<button
|
|
||||||
class="w3-button w3-theme-d1"
|
|
||||||
@click=${() => (this.format = 'message')}
|
|
||||||
>
|
|
||||||
Message
|
|
||||||
</button>`;
|
|
||||||
break;
|
|
||||||
case 'decrypted':
|
|
||||||
raw_button = html`<button
|
|
||||||
class="w3-button w3-theme-d1"
|
|
||||||
@click=${() => (this.format = 'raw')}
|
|
||||||
>
|
|
||||||
Raw
|
|
||||||
</button>`;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (this.message.decrypted) {
|
|
||||||
raw_button = html`<button
|
|
||||||
class="w3-button w3-theme-d1"
|
|
||||||
@click=${() => (this.format = 'decrypted')}
|
|
||||||
>
|
|
||||||
Decrypted
|
|
||||||
</button>`;
|
|
||||||
} else {
|
|
||||||
raw_button = html`<button
|
|
||||||
class="w3-button w3-theme-d1"
|
|
||||||
@click=${() => (this.format = 'raw')}
|
|
||||||
>
|
|
||||||
Raw
|
|
||||||
</button>`;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return raw_button;
|
if (this.message?.decrypted) {
|
||||||
|
formats.push(['decrypted', 'Decrypted']);
|
||||||
|
}
|
||||||
|
formats.push(['raw', 'Raw']);
|
||||||
|
return html`
|
||||||
|
<div class="w3-bar-item w3-right w3-dropdown-hover">
|
||||||
|
<button class="w3-button w3-theme-d1">%</button>
|
||||||
|
<div class="w3-dropdown-content w3-bar-block w3-card-4 w3-theme-l1" style="right: 48px">
|
||||||
|
<a target="_top" class="w3-button w3-bar-item" href=${'#' + encodeURIComponent(this.message?.id)}>${this.message?.id}</a>
|
||||||
|
<button class="w3-button w3-bar-item w3-border-bottom" @click=${this.copy_id}>Copy ID</button>
|
||||||
|
${formats.map(([format, name]) => (html`
|
||||||
|
<button class="w3-button w3-bar-item" style=${format == this.format ? 'font-weight: bold' : ''} @click=${() => (this.format = format)}>${name}</button>
|
||||||
|
`))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
render_header() {
|
render_header() {
|
||||||
@ -441,11 +413,8 @@ class TfMessageElement extends LitElement {
|
|||||||
<tf-user id=${this.message.author} .users=${this.users}></tf-user>
|
<tf-user id=${this.message.author} .users=${this.users}></tf-user>
|
||||||
</span>
|
</span>
|
||||||
${is_encrypted}
|
${is_encrypted}
|
||||||
<span class="w3-bar-item w3-right">${this.render_raw_button()}</span>
|
${this.render_menu()}
|
||||||
<span class="w3-bar-item w3-right" style="text-wrap: nowrap"
|
<span class="w3-bar-item w3-right" style="text-wrap: nowrap"
|
||||||
><a target="_top" href=${'#' + encodeURIComponent(this.message.id)}
|
|
||||||
>%</a
|
|
||||||
>
|
|
||||||
${new Date(this.message.timestamp).toLocaleString()}</span
|
${new Date(this.message.timestamp).toLocaleString()}</span
|
||||||
>
|
>
|
||||||
</header>
|
</header>
|
||||||
|
@ -285,7 +285,7 @@ class TfTabNewsElement extends LitElement {
|
|||||||
return cache(html`
|
return cache(html`
|
||||||
${this.render_sidebar()}
|
${this.render_sidebar()}
|
||||||
<div
|
<div
|
||||||
style="margin-left: 2in; padding: 0px; top: 0; max-height: 100%; overflow: auto"
|
style="margin-left: 2in; padding: 0px; top: 0; max-height: 100%; overflow: auto; contain: layout"
|
||||||
id="main"
|
id="main"
|
||||||
class="w3-main"
|
class="w3-main"
|
||||||
>
|
>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user