Date: Sat, 11 Mar 2023 21:33:55 +0800
Subject: [PATCH 43/76] Make account info load wayyyy faster on Profile page
---
src/components/account-sheet.jsx | 8 ++++++++
src/pages/account-statuses.jsx | 12 ++++++------
src/utils/states.js | 1 +
3 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/src/components/account-sheet.jsx b/src/components/account-sheet.jsx
index 78b89aba..e615b23d 100644
--- a/src/components/account-sheet.jsx
+++ b/src/components/account-sheet.jsx
@@ -1,6 +1,8 @@
+import { useEffect } from 'preact/hooks';
import { useHotkeys } from 'react-hotkeys-hook';
import { api } from '../utils/api';
+import states from '../utils/states';
import AccountInfo from './account-info';
@@ -10,6 +12,12 @@ function AccountSheet({ account, instance: propInstance, onClose }) {
const escRef = useHotkeys('esc', onClose, [onClose]);
+ useEffect(() => {
+ if (!isString) {
+ states.accounts[`${account.id}@${instance}`] = account;
+ }
+ }, [account]);
+
return (
(
+ const TimelineStart = useMemo(() => {
+ const cachedAccount = snapStates.accounts[`${id}@${instance}`];
+ return (
masto.v1.accounts.fetch(id)}
authenticated={authenticated}
standalone
/>
- ),
- [id, instance, authenticated],
- );
+ );
+ }, [id, instance, authenticated]);
return (
Date: Sat, 11 Mar 2023 21:38:58 +0800
Subject: [PATCH 44/76] Don't know why I add this since the beginning
Probably some UI experiment that I forgot to remove lol
---
src/app.css | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/app.css b/src/app.css
index 12c43776..76b74334 100644
--- a/src/app.css
+++ b/src/app.css
@@ -74,8 +74,6 @@ a[href^='http'][rel*='nofollow']:visited:not(:has(div)) {
margin: auto;
width: var(--main-width);
max-width: 100%;
- border-left: 1px solid rgba(0, 0, 0, 0.1);
- border-right: 1px solid rgba(0, 0, 0, 0.1);
background-color: var(--bg-color);
}
.deck.contained {
From 95d919bd5af4c9bd754b484f000b4cd62b70b178 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Sat, 11 Mar 2023 22:07:20 +0800
Subject: [PATCH 45/76] More caching, but still not enough
---
src/components/account-info.jsx | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/components/account-info.jsx b/src/components/account-info.jsx
index c4b478a5..73b1be9f 100644
--- a/src/components/account-info.jsx
+++ b/src/components/account-info.jsx
@@ -36,6 +36,7 @@ function AccountInfo({
(async () => {
try {
const info = await fetchAccount();
+ states.accounts[`${info.id}@${instance}`] = info;
setInfo(info);
setUIState('default');
} catch (e) {
From c6957f696763cb236370f91603ec6ebb4fdbca3a Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Sun, 12 Mar 2023 10:34:58 +0800
Subject: [PATCH 46/76] Disable Posts link on Account statuses page
---
src/components/account-info.jsx | 34 +++++++++++++++++++++------------
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/src/components/account-info.jsx b/src/components/account-info.jsx
index 73b1be9f..82002287 100644
--- a/src/components/account-info.jsx
+++ b/src/components/account-info.jsx
@@ -227,18 +227,28 @@ function AccountInfo({
)}
- {
- hideAllModals();
- }}
- >
- Posts
-
-
- {shortenNumber(statusesCount)}
- {' '}
-
+ {standalone ? (
+
+ Posts
+
+
+ {shortenNumber(statusesCount)}
+ {' '}
+
+ ) : (
+ {
+ hideAllModals();
+ }}
+ >
+ Posts
+
+
+ {shortenNumber(statusesCount)}
+ {' '}
+
+ )}
Following
From 13201260d64fd1b454f313f3101f189f6bb3e6f7 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Sun, 12 Mar 2023 19:23:42 +0800
Subject: [PATCH 47/76] =?UTF-8?q?Fix=20weird=20bug=E2=80=A6=20I=20don't=20?=
=?UTF-8?q?even=20know=20why=20url=20is=20undefined?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/status.jsx | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/components/status.jsx b/src/components/status.jsx
index cafa0b8e..af1c9ae6 100644
--- a/src/components/status.jsx
+++ b/src/components/status.jsx
@@ -1565,6 +1565,7 @@ function _unfurlMastodonLink(instance, url) {
}
function nicePostURL(url) {
+ if (!url) return;
const urlObj = new URL(url);
const { host, pathname } = urlObj;
const path = pathname.replace(/\/$/, '');
From 0d29043358128130973d2d80ae1755a963c3e0b5 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Mon, 13 Mar 2023 10:07:22 +0800
Subject: [PATCH 48/76] Better profile document.title
---
src/pages/account-statuses.jsx | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/pages/account-statuses.jsx b/src/pages/account-statuses.jsx
index de7e9858..def1a03e 100644
--- a/src/pages/account-statuses.jsx
+++ b/src/pages/account-statuses.jsx
@@ -57,7 +57,9 @@ function AccountStatuses() {
const [account, setAccount] = useState();
useTitle(
- `${account?.acct ? '@' + account.acct : 'Posts'}`,
+ `${account?.displayName ? account.displayName + ' ' : ''}@${
+ account?.acct ? account.acct : 'Account posts'
+ }`,
'/:instance?/a/:id',
);
useEffect(() => {
From f65c8a9bfc1b8428a3133bb38fcf670c6ef704b9 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Mon, 13 Mar 2023 10:10:02 +0800
Subject: [PATCH 49/76] Experiment default links to text color, except mentions
and those that are "processed" by Mastodon
Only apply to links in statuses
---
src/components/status.css | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/components/status.css b/src/components/status.css
index cd040375..08b80e91 100644
--- a/src/components/status.css
+++ b/src/components/status.css
@@ -251,6 +251,9 @@
filter: none;
image-rendering: auto;
}
+.status .content a:not(.mention):not(:has(span)) {
+ color: inherit;
+}
.timeline-deck .status .content {
max-height: 50vh;
From cd6c14c1d9b064bd74d47696becddcb7e85a3853 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Mon, 13 Mar 2023 10:10:21 +0800
Subject: [PATCH 50/76] Embrace non-circle avatars
---
src/components/account-info.css | 8 +++++---
src/components/account-info.jsx | 14 +++++++++++++-
src/components/avatar.css | 6 ++++++
src/components/avatar.jsx | 15 ++++++++++++++-
4 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/src/components/account-info.css b/src/components/account-info.css
index 40afca88..c8222709 100644
--- a/src/components/account-info.css
+++ b/src/components/account-info.css
@@ -58,8 +58,10 @@
8px 0 24px var(--header-color-4, --bg-color);
}
.account-container header .avatar {
- box-shadow: -8px 0 24px var(--header-color-3, --bg-color),
- 8px 0 24px var(--header-color-4, --bg-color);
+ /* box-shadow: -8px 0 24px var(--header-color-3, --bg-color),
+ 8px 0 24px var(--header-color-4, --bg-color); */
+ filter: drop-shadow(-8px 0 24px var(--header-color-3, --bg-color))
+ drop-shadow(8px 0 24px var(--header-color-4, --bg-color));
}
.account-container .note {
@@ -222,7 +224,7 @@
font-size: 175%;
margin-bottom: -8px;
line-height: 1.1;
- letter-spacing: -1px;
+ letter-spacing: -0.5px;
mix-blend-mode: multiply;
gap: 12px;
}
diff --git a/src/components/account-info.jsx b/src/components/account-info.jsx
index 82002287..4cabd657 100644
--- a/src/components/account-info.jsx
+++ b/src/components/account-info.jsx
@@ -164,7 +164,8 @@ function AccountInfo({
).data,
];
const rgbColors = colors.map((color) => {
- return `rgb(${color[0]}, ${color[1]}, ${color[2]}, 0.3)`;
+ const [r, g, b, a] = lightenRGB(color);
+ return `rgba(${r}, ${g}, ${b}, ${a})`;
});
setHeaderCornerColors(rgbColors);
console.log({ colors, rgbColors });
@@ -482,4 +483,15 @@ function RelatedActions({ info, instance, authenticated }) {
);
}
+// Apply more alpha if high luminence
+function lightenRGB([r, g, b]) {
+ const luminence = 0.2126 * r + 0.7152 * g + 0.0722 * b;
+ console.log('luminence', luminence);
+ // Follow this range
+ // luminence = 0, alpha = 0.05
+ // luminence = 220, alpha = 1
+ const alpha = Math.min(1, (luminence / 220) * 0.95 + 0.05);
+ return [r, g, b, alpha];
+}
+
export default AccountInfo;
diff --git a/src/components/avatar.css b/src/components/avatar.css
index 411407a6..3066d643 100644
--- a/src/components/avatar.css
+++ b/src/components/avatar.css
@@ -16,3 +16,9 @@
object-fit: cover;
background-color: var(--img-bg-color);
}
+
+.avatar.loaded,
+.avatar.loaded img {
+ box-shadow: none;
+ background-color: transparent;
+}
diff --git a/src/components/avatar.jsx b/src/components/avatar.jsx
index 1ceb7fe4..7af25995 100644
--- a/src/components/avatar.jsx
+++ b/src/components/avatar.jsx
@@ -1,5 +1,7 @@
import './avatar.css';
+import { useRef } from 'preact/hooks';
+
const SIZES = {
s: 16,
m: 20,
@@ -11,8 +13,10 @@ const SIZES = {
function Avatar({ url, size, alt = '', ...props }) {
size = SIZES[size] || size || SIZES.m;
+ const avatarRef = useRef();
return (
{!!url && (
-
+ {
+ avatarRef.current.classList.add('loaded');
+ }}
+ />
)}
);
From aeb75fdea7fbe87ac8c7f03a12b023dbce3b7542 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Mon, 13 Mar 2023 10:42:34 +0800
Subject: [PATCH 51/76] Somebody stop me
---
src/components/account-info.css | 8 ++++
src/components/account-info.jsx | 68 ++++++++++++++++++++++++++++-----
2 files changed, 66 insertions(+), 10 deletions(-)
diff --git a/src/components/account-info.css b/src/components/account-info.css
index c8222709..ab7b0c2a 100644
--- a/src/components/account-info.css
+++ b/src/components/account-info.css
@@ -56,6 +56,7 @@
text-shadow: -8px 0 12px -6px var(--bg-color), 8px 0 12px -6px var(--bg-color),
-8px 0 24px var(--header-color-3, --bg-color),
8px 0 24px var(--header-color-4, --bg-color);
+ animation: fade-in 0.5s both ease-in-out 0.1s;
}
.account-container header .avatar {
/* box-shadow: -8px 0 24px var(--header-color-3, --bg-color),
@@ -64,6 +65,13 @@
drop-shadow(8px 0 24px var(--header-color-4, --bg-color));
}
+.account-container main > *:first-child {
+ animation: fade-in 0.5s both ease-in-out 0.2s;
+}
+.account-container main > *:first-child ~ * {
+ animation: fade-in 0.5s both ease-in-out 0.3s;
+}
+
.account-container .note {
font-size: 95%;
line-height: 1.4;
diff --git a/src/components/account-info.jsx b/src/components/account-info.jsx
index 4cabd657..5650b47b 100644
--- a/src/components/account-info.jsx
+++ b/src/components/account-info.jsx
@@ -152,17 +152,59 @@ function AccountInfo({
canvas.width = e.target.width;
canvas.height = e.target.height;
ctx.drawImage(e.target, 0, 0);
+ // const colors = [
+ // ctx.getImageData(0, 0, 1, 1).data,
+ // ctx.getImageData(e.target.width - 1, 0, 1, 1).data,
+ // ctx.getImageData(0, e.target.height - 1, 1, 1).data,
+ // ctx.getImageData(
+ // e.target.width - 1,
+ // e.target.height - 1,
+ // 1,
+ // 1,
+ // ).data,
+ // ];
+ // Get 10x10 pixels from corners, get average color from each
+ const pixelDimension = 10;
const colors = [
- ctx.getImageData(0, 0, 1, 1).data,
- ctx.getImageData(e.target.width - 1, 0, 1, 1).data,
- ctx.getImageData(0, e.target.height - 1, 1, 1).data,
+ ctx.getImageData(0, 0, pixelDimension, pixelDimension)
+ .data,
ctx.getImageData(
- e.target.width - 1,
- e.target.height - 1,
- 1,
- 1,
+ e.target.width - pixelDimension,
+ 0,
+ pixelDimension,
+ pixelDimension,
).data,
- ];
+ ctx.getImageData(
+ 0,
+ e.target.height - pixelDimension,
+ pixelDimension,
+ pixelDimension,
+ ).data,
+ ctx.getImageData(
+ e.target.width - pixelDimension,
+ e.target.height - pixelDimension,
+ pixelDimension,
+ pixelDimension,
+ ).data,
+ ].map((data) => {
+ let r = 0;
+ let g = 0;
+ let b = 0;
+ let a = 0;
+ for (let i = 0; i < data.length; i += 4) {
+ r += data[i];
+ g += data[i + 1];
+ b += data[i + 2];
+ a += data[i + 3];
+ }
+ const dataLength = data.length / 4;
+ return [
+ r / dataLength,
+ g / dataLength,
+ b / dataLength,
+ a / dataLength,
+ ];
+ });
const rgbColors = colors.map((color) => {
const [r, g, b, a] = lightenRGB(color);
return `rgba(${r}, ${g}, ${b}, ${a})`;
@@ -488,9 +530,15 @@ function lightenRGB([r, g, b]) {
const luminence = 0.2126 * r + 0.7152 * g + 0.0722 * b;
console.log('luminence', luminence);
// Follow this range
- // luminence = 0, alpha = 0.05
+ // luminence = 0, alpha = 0.01
// luminence = 220, alpha = 1
- const alpha = Math.min(1, (luminence / 220) * 0.95 + 0.05);
+ let alpha;
+ if (luminence >= 220) {
+ alpha = 1;
+ } else {
+ alpha = (luminence / 255) * 0.99 + 0.01;
+ }
+ alpha = Math.min(1, alpha);
return [r, g, b, alpha];
}
From e4eafd259210e0fa52a818ee8a4e32a30c8be18d Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Mon, 13 Mar 2023 10:53:15 +0800
Subject: [PATCH 52/76] Still allow look at the unmasked banner
---
src/components/account-info.css | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/components/account-info.css b/src/components/account-info.css
index ab7b0c2a..f7f9c3d1 100644
--- a/src/components/account-info.css
+++ b/src/components/account-info.css
@@ -40,6 +40,12 @@
.account-container .header-banner:hover {
animation: position-object 5s ease-in-out 1s 5;
}
+.account-container .header-banner:active {
+ mask-image: none;
+}
+.account-container .header-banner:active + header {
+ opacity: 0.5 !important;
+}
@media (min-height: 480px) {
.account-container .header-banner {
From 348ceedceda3f75220ba3a04fb5a1eb1f7866ba7 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Mon, 13 Mar 2023 14:24:53 +0800
Subject: [PATCH 53/76] More fixes and adjustments for the avatars
---
src/components/account-info.css | 20 ++++++++++++++-----
src/components/account-info.jsx | 7 +++----
src/components/avatar.css | 7 +++++--
src/components/avatar.jsx | 34 +++++++++++++++++++++++++++++++--
4 files changed, 55 insertions(+), 13 deletions(-)
diff --git a/src/components/account-info.css b/src/components/account-info.css
index f7f9c3d1..3e105ffe 100644
--- a/src/components/account-info.css
+++ b/src/components/account-info.css
@@ -62,20 +62,24 @@
text-shadow: -8px 0 12px -6px var(--bg-color), 8px 0 12px -6px var(--bg-color),
-8px 0 24px var(--header-color-3, --bg-color),
8px 0 24px var(--header-color-4, --bg-color);
- animation: fade-in 0.5s both ease-in-out 0.1s;
+ animation: fade-in 0.3s both ease-in-out 0.1s;
}
.account-container header .avatar {
/* box-shadow: -8px 0 24px var(--header-color-3, --bg-color),
8px 0 24px var(--header-color-4, --bg-color); */
- filter: drop-shadow(-8px 0 24px var(--header-color-3, --bg-color))
- drop-shadow(8px 0 24px var(--header-color-4, --bg-color));
+ overflow: initial;
+ filter: drop-shadow(-2px 0 4px var(--header-color-3, --bg-color))
+ drop-shadow(2px 0 4px var(--header-color-4, --bg-color));
+}
+.account-container header .avatar:not(.has-alpha) img {
+ border-radius: 50%;
}
.account-container main > *:first-child {
- animation: fade-in 0.5s both ease-in-out 0.2s;
+ animation: fade-in 0.3s both ease-in-out 0.15s;
}
.account-container main > *:first-child ~ * {
- animation: fade-in 0.5s both ease-in-out 0.3s;
+ animation: fade-in 0.3s both ease-in-out 0.2s;
}
.account-container .note {
@@ -165,10 +169,14 @@
}
.timeline-start .account-container header {
padding: 16px 16px 1px;
+ animation: none;
}
.timeline-start .account-container main {
padding: 1px 16px 1px;
}
+.timeline-start .account-container main > * {
+ animation: none;
+}
.timeline-start .account-container .account-block .account-block-acct {
opacity: 0.5;
}
@@ -245,5 +253,7 @@
.timeline-start .account-container header .account-block .avatar {
width: 112px !important;
height: 112px !important;
+ filter: drop-shadow(-8px 0 8px var(--header-color-3, --bg-color))
+ drop-shadow(8px 0 8px var(--header-color-4, --bg-color));
}
}
diff --git a/src/components/account-info.jsx b/src/components/account-info.jsx
index 5650b47b..f10dc8c1 100644
--- a/src/components/account-info.jsx
+++ b/src/components/account-info.jsx
@@ -529,14 +529,13 @@ function RelatedActions({ info, instance, authenticated }) {
function lightenRGB([r, g, b]) {
const luminence = 0.2126 * r + 0.7152 * g + 0.0722 * b;
console.log('luminence', luminence);
- // Follow this range
- // luminence = 0, alpha = 0.01
- // luminence = 220, alpha = 1
let alpha;
if (luminence >= 220) {
alpha = 1;
+ } else if (luminence <= 50) {
+ alpha = 0.1;
} else {
- alpha = (luminence / 255) * 0.99 + 0.01;
+ alpha = luminence / 255;
}
alpha = Math.min(1, alpha);
return [r, g, b, alpha];
diff --git a/src/components/avatar.css b/src/components/avatar.css
index 3066d643..444a0cdb 100644
--- a/src/components/avatar.css
+++ b/src/components/avatar.css
@@ -9,6 +9,9 @@
flex-shrink: 0;
vertical-align: middle;
}
+.avatar.has-alpha {
+ border-radius: 0;
+}
.avatar img {
width: 100%;
@@ -17,8 +20,8 @@
background-color: var(--img-bg-color);
}
-.avatar.loaded,
-.avatar.loaded img {
+.avatar[data-loaded],
+.avatar[data-loaded] img {
box-shadow: none;
background-color: transparent;
}
diff --git a/src/components/avatar.jsx b/src/components/avatar.jsx
index 7af25995..2c841aff 100644
--- a/src/components/avatar.jsx
+++ b/src/components/avatar.jsx
@@ -11,13 +11,15 @@ const SIZES = {
xxxl: 64,
};
+const alphaCache = {};
+
function Avatar({ url, size, alt = '', ...props }) {
size = SIZES[size] || size || SIZES.m;
const avatarRef = useRef();
return (
{
+ e.target.crossOrigin = null;
+ e.target.src = url;
+ }}
onLoad={(e) => {
- avatarRef.current.classList.add('loaded');
+ avatarRef.current.dataset.loaded = true;
+ try {
+ // Check if image has alpha channel
+ const canvas = document.createElement('canvas');
+ const ctx = canvas.getContext('2d');
+ canvas.width = e.target.width;
+ canvas.height = e.target.height;
+ ctx.drawImage(e.target, 0, 0);
+ const allPixels = ctx.getImageData(
+ 0,
+ 0,
+ canvas.width,
+ canvas.height,
+ );
+ const hasAlpha = allPixels.data.some((pixel, i) => {
+ return i % 4 === 3 && pixel !== 255;
+ });
+ if (hasAlpha) {
+ avatarRef.current.classList.add('has-alpha');
+ alphaCache[url] = true;
+ }
+ } catch (e) {
+ // Ignore
+ }
}}
/>
)}
From 3d3d963a426f2c55b307331e732ab1df84a08ebe Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Mon, 13 Mar 2023 16:22:41 +0800
Subject: [PATCH 54/76] Check if undefined
---
src/components/avatar.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/avatar.jsx b/src/components/avatar.jsx
index 2c841aff..f8544ba5 100644
--- a/src/components/avatar.jsx
+++ b/src/components/avatar.jsx
@@ -40,7 +40,7 @@ function Avatar({ url, size, alt = '', ...props }) {
e.target.src = url;
}}
onLoad={(e) => {
- avatarRef.current.dataset.loaded = true;
+ if (avatarRef.current) avatarRef.current.dataset.loaded = true;
try {
// Check if image has alpha channel
const canvas = document.createElement('canvas');
From f5c05998badd16de6c36c251df1a48368ea9cce1 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Mon, 13 Mar 2023 18:53:58 +0800
Subject: [PATCH 55/76] Fix menu text not correctly vertically aligned
---
src/app.css | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/app.css b/src/app.css
index 76b74334..e4d1a2ff 100644
--- a/src/app.css
+++ b/src/app.css
@@ -1122,6 +1122,7 @@ body:has(.status-deck) .media-post-link {
text-decoration: none;
padding: 8px 16px !important;
margin: -8px -16px !important;
+ align-items: center;
}
.szh-menu .szh-menu__item a.is-active {
font-weight: bold;
From a3015e75f0dc17b9135da1e6524eb6da4aaf0eec Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Mon, 13 Mar 2023 19:15:14 +0800
Subject: [PATCH 56/76] =?UTF-8?q?Make=20things=20uh=E2=80=A6=20more=20"rev?=
=?UTF-8?q?ealing"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/account-info.css | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/components/account-info.css b/src/components/account-info.css
index 3e105ffe..f80d88dc 100644
--- a/src/components/account-info.css
+++ b/src/components/account-info.css
@@ -43,8 +43,17 @@
.account-container .header-banner:active {
mask-image: none;
}
-.account-container .header-banner:active + header {
- opacity: 0.5 !important;
+.account-container .header-banner:active + header .avatar + * {
+ transition: opacity 0.3s ease-in-out;
+ opacity: 0 !important;
+}
+.account-container .header-banner:active + header .avatar {
+ transition: filter 0.3s ease-in-out;
+ filter: none !important;
+}
+.account-container .header-banner:active + header .avatar img {
+ transition: border-radius 0.3s ease-in-out;
+ border-radius: 8px;
}
@media (min-height: 480px) {
From 0467dc7c09b7c57df62208b8b9b21d34caea0a96 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Mon, 13 Mar 2023 19:25:00 +0800
Subject: [PATCH 57/76] omg fix this infinite loop if image keeps erroring
---
src/components/avatar.jsx | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/components/avatar.jsx b/src/components/avatar.jsx
index f8544ba5..7f16980a 100644
--- a/src/components/avatar.jsx
+++ b/src/components/avatar.jsx
@@ -36,8 +36,10 @@ function Avatar({ url, size, alt = '', ...props }) {
loading="lazy"
crossOrigin={alphaCache[url] === undefined ? 'anonymous' : undefined}
onError={(e) => {
- e.target.crossOrigin = null;
- e.target.src = url;
+ if (e.target.crossOrigin) {
+ e.target.crossOrigin = null;
+ e.target.src = url;
+ }
}}
onLoad={(e) => {
if (avatarRef.current) avatarRef.current.dataset.loaded = true;
From beca8ed01fbf437f58153b03011a7a1d246f0453 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Mon, 13 Mar 2023 19:25:59 +0800
Subject: [PATCH 58/76] Show Profile link in menu
Because I need this
---
src/components/menu.jsx | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/components/menu.jsx b/src/components/menu.jsx
index 92d67db5..bca5dcb5 100644
--- a/src/components/menu.jsx
+++ b/src/components/menu.jsx
@@ -3,6 +3,7 @@ import { useSnapshot } from 'valtio';
import { api } from '../utils/api';
import states from '../utils/states';
+import { getCurrentAccount } from '../utils/store-utils';
import Icon from './icon';
import MenuLink from './MenuLink';
@@ -10,6 +11,7 @@ import MenuLink from './MenuLink';
function NavMenu(props) {
const snapStates = useSnapshot(states);
const { instance, authenticated } = api();
+ const currentAccount = getCurrentAccount();
// Home = Following
// But when in multi-column mode, Home becomes columns of anything
@@ -102,6 +104,11 @@ function NavMenu(props) {
{authenticated && (
<>
+ {currentAccount?.info?.id && (
+
+ Profile
+
+ )}