diff --git a/esbuildconf.js b/esbuildconf.js index 43e48a8..a59d41d 100644 --- a/esbuildconf.js +++ b/esbuildconf.js @@ -9,7 +9,6 @@ export const options = { 'src/main.js', 'src/main.css', 'src/index.html', - 'src/assets/bubble.svg', 'src/assets/comment.svg', 'src/assets/heart-fill.svg', 'src/assets/star.svg', diff --git a/src/assets/bubble.svg b/src/assets/bubble.svg deleted file mode 100644 index 9b9d947..0000000 --- a/src/assets/bubble.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/cards.css b/src/cards.css index 2e2c6d1..7968801 100644 --- a/src/cards.css +++ b/src/cards.css @@ -29,7 +29,7 @@ height: var(--profileimg-size); margin-right: 1rem; /* padding-top: .5ch; */ - max-width: var(--profileimg-size); + max-height: var(--profileimg-size); max-width: var(--profileimg-size); outline: .5rem solid var(--bgcolor); overflow: hidden; @@ -37,11 +37,15 @@ z-index: 2; } +.mbox-img canvas, +.mbox-img img { + display: block; +} + .mbox-updated-contact .mbox-img, .mbox-recommend-server .mbox-img { - --profileimg-size: 4.5ch; - margin-left: 3ch; - margin-right: 3.5ch; + --profileimg-size: 2rem; + margin-left: 2rem; } .mbox-body { @@ -58,9 +62,7 @@ margin-top: 0; } .mbox-header time, -.mbox-username, -.mbox-updated-contact, -.mbox mbox-recommend-server { +.mbox-username { color: var(--color-accent); } @@ -71,7 +73,6 @@ .mbox-updated-contact .mbox-body, .mbox-recommend-server .mbox-body { display: block; - flex-basis: 100%; font-size: var(--font-small); overflow: scroll; } diff --git a/src/main.js b/src/main.js index 25ffeae..273f3e4 100644 --- a/src/main.js +++ b/src/main.js @@ -301,7 +301,7 @@ function renderUpdateContact(evt, relay) { } function renderRecommendServer(evt, relay) { - const {img, time, userName} = getMetadata(evt, relay); + const {img, name, time, userName} = getMetadata(evt, relay); const body = elem('div', {className: 'mbox-body', title: dateTime.format(time)}, [ elem('header', {className: 'mbox-header'}, [ elem('small', {}, [ @@ -310,7 +310,9 @@ function renderRecommendServer(evt, relay) { ]), ` recommends server: ${evt.content}`, ]); - return rendernArticle([elem('div', {className: 'mbox-img'}, [img]), body], {className: 'mbox-recommend-server', data: {relay: evt.content}}); + return rendernArticle([elem('div', {className: 'mbox-img'}, [ + (name && img) ? img : elemCanvas(userName)]), body + ], {className: 'mbox-recommend-server', data: {relay: evt.content}}); } function rendernArticle(content, props = {}) { @@ -388,7 +390,7 @@ const getHost = (url) => { function getMetadata(evt, relay) { const host = getHost(relay); const user = userList.find(user => user.pubkey === evt.pubkey); - const userImg = user?.picture || 'assets/bubble.svg'; + const userImg = user?.picture; const name = user?.metadata[relay]?.name; const userName = name || evt.pubkey.slice(0, 8); const userAbout = user?.metadata[relay]?.about || '';