Compare commits

..

1 Commits

9 changed files with 49 additions and 85 deletions

View File

@ -4,8 +4,7 @@
<script> <script>
const g_data = $data; const g_data = $data;
</script> </script>
<link rel="stylesheet" href="w3.css" /> <link rel="stylesheet" href="w3.css"></link>
<!-- prettier-ignore -->
<style> <style>
/* 2018 Valiant Poppy */ /* 2018 Valiant Poppy */
.w3-theme-l5 {color:#000 !important; background-color:#fbf3f3 !important} .w3-theme-l5 {color:#000 !important; background-color:#fbf3f3 !important}

View File

@ -42,27 +42,10 @@ window.addEventListener('load', function () {
} else if (description.type === 'textarea') { } else if (description.type === 'textarea') {
return html` return html`
<li class="w3-row"> <li class="w3-row">
<label class="w3-quarter" for=${'gs_' + key} style="font-weight: bold" <label class="w3-quarter" for=${'gs_' + key} style="font-weight: bold">${key}</label>
>${key}</label
>
<div class="w3-rest w3-padding">${description.description}</div> <div class="w3-rest w3-padding">${description.description}</div>
<textarea <textarea class="w3-input" style="vertical-align: top; resize: vertical" id=${'gs_' + key}>${description.value}</textarea>
class="w3-input" <button class="w3-button w3-right w3-quarter w3-theme-action" @click=${(e) => global_settings_set(key, e.srcElement.previousElementSibling.value)}>Set</button>
style="vertical-align: top; resize: vertical"
id=${'gs_' + key}
>
${description.value}</textarea
>
<button
class="w3-button w3-right w3-quarter w3-theme-action"
@click=${(e) =>
global_settings_set(
key,
e.srcElement.previousElementSibling.value
)}
>
Set
</button>
</li> </li>
`; `;
} else { } else {
@ -78,17 +61,13 @@ ${description.value}</textarea
} }
const user_template = (user, permissions) => html` const user_template = (user, permissions) => html`
<li class="w3-card w3-margin"> <li class="w3-card w3-margin">
<button <button class="w3-button w3-theme-action" @click=${(e) => delete_user(user)}>Delete</button>
class="w3-button w3-theme-action"
@click=${(e) => delete_user(user)}
>
Delete
</button>
${user}: ${permissions.map((x) => permission_template(x))} ${user}: ${permissions.map((x) => permission_template(x))}
</li> </li>
`; `;
const users_template = (users) => const users_template = (users) =>
html` <header class="w3-container w3-theme-l2"><h2>Users</h2></header> html`
<header class="w3-container w3-theme-l2"><h2>Users</h2></header>
<ul class="w3-ul"> <ul class="w3-ul">
${Object.entries(users).map((u) => user_template(u[0], u[1]))} ${Object.entries(users).map((u) => user_template(u[0], u[1]))}
</ul>`; </ul>`;

View File

@ -118,9 +118,7 @@ async function main() {
<ul class="w3-ul">` + <ul class="w3-ul">` +
ids ids
.map( .map(
( (id) => `<li style="overflow: hidden; text-wrap: nowrap; text-overflow: ellipsis">
id
) => `<li style="overflow: hidden; text-wrap: nowrap; text-overflow: ellipsis">
<button onclick="handler.export_id(event)" data-id="${id}" class="w3-button w3-theme">Export Identity</button> <button onclick="handler.export_id(event)" data-id="${id}" class="w3-button w3-theme">Export Identity</button>
<button onclick="handler.delete_id(event)" data-id="${id}" class="w3-button w3-theme">Delete Identity</button> <button onclick="handler.delete_id(event)" data-id="${id}" class="w3-button w3-theme">Delete Identity</button>
${id} ${id}

View File

@ -1,5 +1,5 @@
{ {
"type": "tildefriends-app", "type": "tildefriends-app",
"emoji": "🐌", "emoji": "🐌",
"previous": "&cN1BLgsD5fU8QzkNbtKR/Ie1fO3miBq8FVSpgNqFbrc=.sha256" "previous": "&raSj7ozmSDNGmB6TtjDk7oOiTc33ZN+RrBMASJ2F4cA=.sha256"
} }

View File

@ -340,20 +340,26 @@ class TfElement extends LitElement {
}; };
let tabs = html` let tabs = html`
<style>
@media only screen and (max-width: 650px) {
.hide-on-small-screens {
display: none;
}
}
</style>
<div class="w3-bar w3-theme-l1"> <div class="w3-bar w3-theme-l1">
${Object.entries(k_tabs).map( ${Object.entries(k_tabs).map(
([k, v]) => html` ([k, v]) => html`
<button <button
title=${v} title=${v}
class="w3-bar-item w3-padding w3-hover-theme tab ${self.tab == v class="w3-bar-item w3-padding-large w3-hover-theme tab ${self.tab ==
v
? 'w3-theme-l2' ? 'w3-theme-l2'
: 'w3-theme-l1'}" : 'w3-theme-l1'}"
@click=${() => self.set_tab(v)} @click=${() => self.set_tab(v)}
> >
${k} ${k}
<span class=${self.tab == v ? '' : 'w3-hide-small'} <span class="hide-on-small-screens">${v}</span>
>${v.charAt(0).toUpperCase() + v.substring(1)}</span
>
</button> </button>
` `
)} )}
@ -361,9 +367,7 @@ class TfElement extends LitElement {
`; `;
let contents = !this.loaded let contents = !this.loaded
? this.loading ? this.loading
? html`<div ? html`<div class="w3-panel w3-theme-l5 w3-card-4 w3-padding-large w3-round-xlarge">
class="w3-panel w3-theme-l5 w3-card-4 w3-padding-large w3-round-xlarge"
>
Loading... Loading...
</div> </div>
${this.render_tab()}` ${this.render_tab()}`

View File

@ -295,18 +295,14 @@ class TfComposeElement extends LitElement {
{ {
values: values, values: values,
selectTemplate: function (item) { selectTemplate: function (item) {
return item return item ? `[@${item.original.key}](${item.original.value})` : undefined;
? `[@${item.original.key}](${item.original.value})`
: undefined;
}, },
}, },
{ {
trigger: '&', trigger: '&',
values: this.autocomplete, values: this.autocomplete,
selectTemplate: function (item) { selectTemplate: function (item) {
return item return item ? `![${item.original.key}](${item.original.value})` : undefined;
? `![${item.original.key}](${item.original.value})`
: undefined;
}, },
}, },
], ],

View File

@ -247,7 +247,9 @@ ${JSON.stringify(mention, null, 2)}</pre
if (mentions.length) { if (mentions.length) {
let self = this; let self = this;
return html` return html`
<fieldset style="padding: 0.5em; border: 1px solid black"> <fieldset
style="padding: 0.5em; border: 1px solid black"
>
<legend>Mentions</legend> <legend>Mentions</legend>
${mentions.map((x) => self.render_mention(x))} ${mentions.map((x) => self.render_mention(x))}
</fieldset> </fieldset>

View File

@ -116,15 +116,9 @@ class TfTabConnectionsElement extends LitElement {
${connection.tunnel !== undefined ${connection.tunnel !== undefined
? '🚇' ? '🚇'
: html`(${connection.host}:${connection.port})`} : html`(${connection.host}:${connection.port})`}
<div> <div>${connection.requests.map(x => html`
${connection.requests.map( <span class="w3-tag w3-small">${x.request_number > 0 ? '🟩' : '🟥'} ${x.name}</span>
(x) => html` `)}</div>
<span class="w3-tag w3-small"
>${x.request_number > 0 ? '🟩' : '🟥'} ${x.name}</span
>
`
)}
</div>
<ul> <ul>
${this.connections ${this.connections
.filter((x) => x.tunnel === this.connections.indexOf(connection)) .filter((x) => x.tunnel === this.connections.indexOf(connection))
@ -193,16 +187,12 @@ class TfTabConnectionsElement extends LitElement {
${this.identities.map( ${this.identities.map(
(x) => (x) =>
html`<li class="w3-bar"> html`<li class="w3-bar">
${x == this.server_identity ${x == this.server_identity ?
? html`<span class="w3-tag w3-medium w3-round w3-theme-l1" html`<span class="w3-tag w3-medium w3-round w3-theme-l1">🖥 local server</span>` :
>🖥 local server</span undefined}
>` ${this.my_identities.indexOf(x) != -1 ?
: undefined} html`<span class="w3-tag w3-medium w3-round w3-theme-d1">😎 you</span>` :
${this.my_identities.indexOf(x) != -1 undefined}
? html`<span class="w3-tag w3-medium w3-round w3-theme-d1"
>😎 you</span
>`
: undefined}
<tf-user id=${x} .users=${this.users}></tf-user> <tf-user id=${x} .users=${this.users}></tf-user>
</li>` </li>`
)} )}

View File

@ -115,16 +115,12 @@ class TfTabNewsElement extends LitElement {
></tf-profile>` ></tf-profile>`
: undefined; : undefined;
let edit_profile; let edit_profile;
if ( if (!this.loading &&
!this.loading &&
this.users[this.whoami]?.name === undefined && this.users[this.whoami]?.name === undefined &&
this.hash.substring(1) != this.whoami this.hash.substring(1) != this.whoami) {
) { edit_profile = html`
edit_profile = html` <div <div class="w3-panel w3-padding w3-round w3-card-4 w3-theme-l3">
class="w3-panel w3-padding w3-round w3-card-4 w3-theme-l3" Follow your identity link ☝️ above to edit your profile and set your name.
>
Follow your identity link ☝️ above to edit your profile and set your
name.
</div>`; </div>`;
} }
return html` return html`