ssb: prettier.
This commit is contained in:
parent
58e9646fa6
commit
d4b421421d
@ -121,7 +121,7 @@ class TfElement extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
next_channel(delta) {
|
next_channel(delta) {
|
||||||
let channel_names = ['', '@', '🔐', ...this.channels.map(x => '#' + x)];
|
let channel_names = ['', '@', '🔐', ...this.channels.map((x) => '#' + x)];
|
||||||
let index = channel_names.indexOf(this.hash.substring(1));
|
let index = channel_names.indexOf(this.hash.substring(1));
|
||||||
index = index != -1 ? index + delta : 0;
|
index = index != -1 ? index + delta : 0;
|
||||||
tfrpc.rpc.setHash(
|
tfrpc.rpc.setHash(
|
||||||
@ -217,7 +217,7 @@ class TfElement extends LitElement {
|
|||||||
let new_cache = JSON.stringify(cache);
|
let new_cache = JSON.stringify(cache);
|
||||||
if (new_cache !== original_cache) {
|
if (new_cache !== original_cache) {
|
||||||
let start_time = new Date();
|
let start_time = new Date();
|
||||||
tfrpc.rpc.databaseSet('about', new_cache).then(function() {
|
tfrpc.rpc.databaseSet('about', new_cache).then(function () {
|
||||||
console.log('saving about took', (new Date() - start_time) / 1000);
|
console.log('saving about took', (new Date() - start_time) / 1000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -543,13 +543,15 @@ class TfElement extends LitElement {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
let contents = !this.loaded || this.loading
|
let contents =
|
||||||
? html`<div
|
!this.loaded || this.loading
|
||||||
|
? html`<div
|
||||||
class="w3-display-middle w3-panel w3-theme-l5 w3-card-4 w3-padding-large w3-round-xlarge w3-xlarge"
|
class="w3-display-middle w3-panel w3-theme-l5 w3-card-4 w3-padding-large w3-round-xlarge w3-xlarge"
|
||||||
>
|
>
|
||||||
<span class="w3-spin" style="display: inline-block">🦀</span> Loading...
|
<span class="w3-spin" style="display: inline-block">🦀</span>
|
||||||
|
Loading...
|
||||||
</div>`
|
</div>`
|
||||||
: this.render_tab();
|
: this.render_tab();
|
||||||
return html`
|
return html`
|
||||||
<div
|
<div
|
||||||
style="width: 100vw; min-height: 100vh; height: 100%"
|
style="width: 100vw; min-height: 100vh; height: 100%"
|
||||||
|
@ -202,18 +202,20 @@ class TfComposeElement extends LitElement {
|
|||||||
channel: this.channel,
|
channel: this.channel,
|
||||||
};
|
};
|
||||||
if (this.root || this.branch) {
|
if (this.root || this.branch) {
|
||||||
message.root = this.new_thread ? this.branch ?? this.root : this.root;
|
message.root = this.new_thread ? (this.branch ?? this.root) : this.root;
|
||||||
message.branch = this.branch;
|
message.branch = this.branch;
|
||||||
}
|
}
|
||||||
let reply = Object.fromEntries((await tfrpc.rpc.query(
|
let reply = Object.fromEntries(
|
||||||
`
|
(
|
||||||
|
await tfrpc.rpc.query(
|
||||||
|
`
|
||||||
SELECT messages.id, messages.author FROM messages
|
SELECT messages.id, messages.author FROM messages
|
||||||
JOIN json_each(?) AS refs ON messages.id = refs.value
|
JOIN json_each(?) AS refs ON messages.id = refs.value
|
||||||
`,
|
`,
|
||||||
[JSON.stringify([this.root, this.branch])])).map(row => [
|
[JSON.stringify([this.root, this.branch])]
|
||||||
row.id,
|
)
|
||||||
row.author,
|
).map((row) => [row.id, row.author])
|
||||||
]));
|
);
|
||||||
if (Object.keys(reply).length) {
|
if (Object.keys(reply).length) {
|
||||||
message.reply = reply;
|
message.reply = reply;
|
||||||
}
|
}
|
||||||
@ -485,9 +487,13 @@ class TfComposeElement extends LitElement {
|
|||||||
|
|
||||||
render_new_thread() {
|
render_new_thread() {
|
||||||
let self = this;
|
let self = this;
|
||||||
if (this.root !== undefined && this.branch !== undefined && this.root != this.branch) {
|
if (
|
||||||
|
this.root !== undefined &&
|
||||||
|
this.branch !== undefined &&
|
||||||
|
this.root != this.branch
|
||||||
|
) {
|
||||||
return html`
|
return html`
|
||||||
<input type="checkbox" class="w3-check w3-theme-d1" id="new_thread" @change=${() => self.new_thread = !self.new_thread} ?checked=${self.new_thread}></input>
|
<input type="checkbox" class="w3-check w3-theme-d1" id="new_thread" @change=${() => (self.new_thread = !self.new_thread)} ?checked=${self.new_thread}></input>
|
||||||
<label for="new_thread">New Thread</label>
|
<label for="new_thread">New Thread</label>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@ -586,8 +592,7 @@ class TfComposeElement extends LitElement {
|
|||||||
${Object.values(draft.mentions || {}).map((x) =>
|
${Object.values(draft.mentions || {}).map((x) =>
|
||||||
self.render_mention(x)
|
self.render_mention(x)
|
||||||
)}
|
)}
|
||||||
${this.render_attach_app()}
|
${this.render_attach_app()} ${this.render_content_warning()}
|
||||||
${this.render_content_warning()}
|
|
||||||
${this.render_new_thread()}
|
${this.render_new_thread()}
|
||||||
<button class="w3-button w3-theme-d1" id="submit" @click=${this.submit}>
|
<button class="w3-button w3-theme-d1" id="submit" @click=${this.submit}>
|
||||||
Submit
|
Submit
|
||||||
|
@ -216,13 +216,18 @@ class TfTabNewsElement extends LitElement {
|
|||||||
style=${this.hash == '#🔐' ? 'font-weight: bold' : undefined}
|
style=${this.hash == '#🔐' ? 'font-weight: bold' : undefined}
|
||||||
>🔐private ${this.unread_status('🔐')}</a
|
>🔐private ${this.unread_status('🔐')}</a
|
||||||
>
|
>
|
||||||
${Object.keys(this.drafts).sort().map(x => html`
|
${Object.keys(this.drafts)
|
||||||
<a
|
.sort()
|
||||||
href=${'#' + encodeURIComponent(x)}
|
.map(
|
||||||
class="w3-bar-item w3-button"
|
(x) => html`
|
||||||
style="text-wrap: nowrap; text-overflow: ellipsis">📝 ${this.drafts[x]?.text ?? x}</a
|
<a
|
||||||
>
|
href=${'#' + encodeURIComponent(x)}
|
||||||
`)}
|
class="w3-bar-item w3-button"
|
||||||
|
style="text-wrap: nowrap; text-overflow: ellipsis"
|
||||||
|
>📝 ${this.drafts[x]?.text ?? x}</a
|
||||||
|
>
|
||||||
|
`
|
||||||
|
)}
|
||||||
${this.channels.map(
|
${this.channels.map(
|
||||||
(x) => html`
|
(x) => html`
|
||||||
<a
|
<a
|
||||||
|
Loading…
Reference in New Issue
Block a user