From 45950da71426bbd11f0ebf94d4b3e888df0e7794 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Fri, 24 Feb 2023 23:38:59 +0800
Subject: [PATCH 01/66] Don't POST if no choices set in poll
---
src/components/status.jsx | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/components/status.jsx b/src/components/status.jsx
index 5c21528a..9976af4c 100644
--- a/src/components/status.jsx
+++ b/src/components/status.jsx
@@ -951,6 +951,7 @@ function Poll({
choices.push(value);
}
});
+ if (!choices.length) return;
setUIState('loading');
await votePoll(choices);
setUIState('default');
From be83ca735820776e51a2833b6e206b98bd4f2cdb Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Sat, 25 Feb 2023 01:49:40 +0800
Subject: [PATCH 02/66] Neat trick to expand click area
---
src/app.css | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/app.css b/src/app.css
index 7a53f6c9..e36174c7 100644
--- a/src/app.css
+++ b/src/app.css
@@ -749,6 +749,13 @@ a[href^='http'][rel*='nofollow']:visited:not(:has(div)) {
.updates-button .icon {
vertical-align: top;
}
+@media (pointer: coarse) {
+ .updates-button:after {
+ content: '';
+ position: absolute;
+ inset: -16px;
+ }
+}
/* BOX */
From 9e867c7af5a2650970bea87859980779cea730c4 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Sat, 25 Feb 2023 10:03:34 +0800
Subject: [PATCH 03/66] Fix title not working when not logged in
Welcome page's useTitle overridden other page's useTitle
---
src/pages/welcome.jsx | 2 +-
src/utils/useTitle.js | 9 +++++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/pages/welcome.jsx b/src/pages/welcome.jsx
index 78c74990..99ceed6f 100644
--- a/src/pages/welcome.jsx
+++ b/src/pages/welcome.jsx
@@ -6,7 +6,7 @@ import states from '../utils/states';
import useTitle from '../utils/useTitle';
function Welcome() {
- useTitle();
+ useTitle(null, ['/', '/welcome']);
return (
diff --git a/src/utils/useTitle.js b/src/utils/useTitle.js
index e4a53825..6257b004 100644
--- a/src/utils/useTitle.js
+++ b/src/utils/useTitle.js
@@ -9,10 +9,11 @@ const { VITE_CLIENT_NAME: CLIENT_NAME } = import.meta.env;
export default function useTitle(title, path) {
const snapStates = useSnapshot(states);
const { currentLocation } = snapStates;
- let paths = [];
+ const hasPaths = Array.isArray(path);
+ let paths = hasPaths ? path : [];
// Workaround for matchPath not working for optional path segments
// https://github.com/remix-run/react-router/discussions/9862
- if (/:?\w+\?/.test(path)) {
+ if (!hasPaths && /:?\w+\?/.test(path)) {
paths.push(path.replace(/(:\w+)\?/g, '$1'));
paths.push(path.replace(/\/?:\w+\?/g, ''));
}
@@ -24,7 +25,7 @@ export default function useTitle(title, path) {
}
console.debug({ paths, matched, currentLocation });
useEffect(() => {
- if (path && !matched) return;
+ if (!matched) return;
document.title = title ? `${title} / ${CLIENT_NAME}` : CLIENT_NAME;
- }, [title, snapStates.currentLocation]);
+ }, [title, matched]);
}
From 49ef7e9ee46e5954f777a52e1fb1fac2e97e0a92 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Sat, 25 Feb 2023 10:03:52 +0800
Subject: [PATCH 04/66] Fix more icon (3 dots) too subtle
---
src/components/icon.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/icon.jsx b/src/components/icon.jsx
index 82221ee1..52bb42d8 100644
--- a/src/components/icon.jsx
+++ b/src/components/icon.jsx
@@ -37,7 +37,7 @@ const ICONS = {
attachment: 'mingcute:attachment-line',
upload: 'mingcute:upload-3-line',
gear: 'mingcute:settings-3-line',
- more: 'mingcute:more-1-line',
+ more: 'mingcute:more-3-line',
external: 'mingcute:external-link-line',
popout: 'mingcute:external-link-line',
popin: ['mingcute:external-link-line', '180deg'],
From 1f2dbb8e06a9482e49602be6f6f6ab2f790a1eec Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Sat, 25 Feb 2023 10:04:30 +0800
Subject: [PATCH 05/66] Experimental multi-hashtag timeline
---
src/app.css | 21 ++-
src/components/shortcuts-settings.jsx | 8 +-
src/pages/hashtag.jsx | 236 +++++++++++++++++++++++++-
3 files changed, 253 insertions(+), 12 deletions(-)
diff --git a/src/app.css b/src/app.css
index e36174c7..d6664e0b 100644
--- a/src/app.css
+++ b/src/app.css
@@ -109,9 +109,8 @@ a[href^='http'][rel*='nofollow']:visited:not(:has(div)) {
border-bottom: var(--hairline-width) solid var(--divider-color);
min-height: 3em;
display: grid;
- grid-template-columns: 1fr max-content 1fr;
+ grid-template-columns: 1fr minmax(0, max-content) 1fr;
align-items: center;
- text-overflow: ellipsis;
white-space: nowrap;
}
.deck > header .header-grid > .header-side:last-of-type {
@@ -126,6 +125,9 @@ a[href^='http'][rel*='nofollow']:visited:not(:has(div)) {
padding: 0;
font-size: 1.2em;
text-align: center;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
}
.deck > header .header-grid.header-grid-2 {
grid-template-columns: 1fr max-content;
@@ -1080,7 +1082,7 @@ body:has(.status-deck) .media-post-link {
.szh-menu__item:not(.szh-menu__item--disabled, .szh-menu__item--hover) {
color: var(--text-color);
}
-.szh-menu .szh-menu__item--hover {
+.szh-menu .szh-menu__item--hover:not(.menu-field) {
color: var(--button-text-color);
background-color: var(--button-bg-color);
}
@@ -1094,6 +1096,19 @@ body:has(.status-deck) .media-post-link {
opacity: 0.5;
font-weight: normal;
}
+.szh-menu .szh-menu__item form {
+ display: flex;
+ flex: 1;
+ gap: 8px;
+ align-items: center;
+}
+.szh-menu .szh-menu__item form > input[type='text'] {
+ flex-grow: 1;
+}
+.szh-menu .szh-menu__item--hover .danger-icon {
+ color: var(--red-color);
+ opacity: 1;
+}
/* GLASS MENU */
diff --git a/src/components/shortcuts-settings.jsx b/src/components/shortcuts-settings.jsx
index d933ce27..d54e0a4c 100644
--- a/src/components/shortcuts-settings.jsx
+++ b/src/components/shortcuts-settings.jsx
@@ -75,7 +75,8 @@ const TYPE_PARAMS = {
text: '#',
name: 'hashtag',
type: 'text',
- placeholder: 'e.g PixelArt',
+ placeholder: 'e.g. PixelArt (Max 5, space-separated)',
+ pattern: '[^#]+',
},
],
};
@@ -314,7 +315,7 @@ function ShortcutForm({ type, lists, followedHashtags, onSubmit, disabled }) {
const data = new FormData(e.target);
const result = {};
data.forEach((value, key) => {
- result[key] = value;
+ result[key] = value?.trim();
});
if (!result.type) return;
onSubmit(result);
@@ -348,7 +349,7 @@ function ShortcutForm({ type, lists, followedHashtags, onSubmit, disabled }) {
{TYPE_PARAMS[currentType]?.map?.(
- ({ text, name, type, placeholder }) => {
+ ({ text, name, type, placeholder, pattern }) => {
if (currentType === 'list') {
return (
@@ -382,6 +383,7 @@ function ShortcutForm({ type, lists, followedHashtags, onSubmit, disabled }) {
autocorrect="off"
autocapitalize="off"
spellcheck={false}
+ pattern={pattern}
/>
{currentType === 'hashtag' && followedHashtags.length > 0 && (
+
+
+ {/*
Experimental Multi-column mode
@@ -216,7 +240,7 @@ function ShortcutsSettings() {
Show shortcuts in multiple columns instead of the floating button.
-
+ */}
{shortcuts.length > 0 ? (
{shortcuts.map((shortcut, i) => {
diff --git a/src/components/shortcuts.css b/src/components/shortcuts.css
index 851a9d05..3baae5c7 100644
--- a/src/components/shortcuts.css
+++ b/src/components/shortcuts.css
@@ -44,3 +44,114 @@
transform: translateY(-200%);
}
}
+
+/* TAB BAR */
+
+#shortcuts .tab-bar:not([hidden]) {
+ position: fixed;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ z-index: 100;
+ background-color: var(--bg-blur-color);
+ backdrop-filter: blur(16px) saturate(3);
+ border-top: var(--hairline-width) solid var(--outline-color);
+ box-shadow: 0 -8px 16px -8px var(--drop-shadow-color);
+ overflow: auto;
+ transition: all 0.3s ease-in-out;
+ padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom)
+ env(safe-area-inset-left);
+}
+#shortcuts .tab-bar ul {
+ display: flex;
+ margin: 0;
+ padding: 0;
+}
+#shortcuts .tab-bar li {
+ flex-grow: 1;
+ margin: 0;
+ padding: 0;
+ list-style: none;
+ display: flex;
+}
+#shortcuts .tab-bar li a {
+ padding: 16px 0;
+ display: block;
+ color: var(--text-insignificant-color);
+ font-size: 10px;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: flex-start;
+ padding: 8px;
+ text-decoration: none;
+ text-shadow: 0 var(--hairline-width) var(--bg-color);
+ max-width: max(44px, 20vw);
+}
+#shortcuts .tab-bar li a:active {
+ transform: scale(0.95);
+ transition: none;
+}
+#shortcuts .tab-bar li a * {
+ pointer-events: none;
+}
+#shortcuts .tab-bar li a span {
+ width: 100%;
+ text-align: center;
+ display: block;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ overflow: hidden;
+}
+#shortcuts .tab-bar li a.is-active {
+ color: var(--link-color);
+ background-image: radial-gradient(
+ closest-side at 50% 50%,
+ var(--bg-color),
+ transparent
+ );
+}
+#app:has(header[hidden]) #shortcuts .tab-bar,
+shortcuts .tab-bar[hidden] {
+ transform: translateY(200%);
+ pointer-events: none;
+ user-select: none;
+}
+
+@media (min-width: calc(40em)) {
+ .timeline-deck {
+ margin-top: 44px;
+ }
+ .timeline-deck > header {
+ --margin-top: calc(44px + 8px);
+ }
+ #shortcuts .tab-bar:not([hidden]) {
+ top: 0;
+ bottom: auto;
+ padding: env(safe-area-inset-top) env(safe-area-inset-right) 0
+ env(safe-area-inset-left);
+ background-color: var(--bg-faded-blur-color);
+ border: 0;
+ box-shadow: none;
+ border-bottom: var(--hairline-width) solid var(--bg-faded-color);
+ }
+ #shortcuts .tab-bar ul {
+ justify-content: center;
+ }
+ #shortcuts .tab-bar li {
+ flex-grow: 0;
+ }
+ #shortcuts .tab-bar li a {
+ padding: 0 16px;
+ flex-direction: row;
+ font-size: 14px;
+ height: 44px;
+ gap: 4px;
+ }
+ #app:has(header[hidden]) #shortcuts .tab-bar,
+ shortcuts .tab-bar[hidden] {
+ transform: translateY(-150%);
+ pointer-events: none;
+ user-select: none;
+ }
+}
diff --git a/src/components/shortcuts.jsx b/src/components/shortcuts.jsx
index 19c8d338..b8ab396d 100644
--- a/src/components/shortcuts.jsx
+++ b/src/components/shortcuts.jsx
@@ -11,6 +11,7 @@ import states from '../utils/states';
import AsyncText from './AsyncText';
import Icon from './icon';
+import Link from './Link';
import MenuLink from './MenuLink';
function Shortcuts() {
@@ -29,8 +30,11 @@ function Shortcuts() {
.map((pin, i) => {
const { type, ...data } = pin;
if (!SHORTCUTS_META[type]) return null;
- let { path, title, icon } = SHORTCUTS_META[type];
+ let { id, path, title, icon } = SHORTCUTS_META[type];
+ if (typeof id === 'function') {
+ id = id(data);
+ }
if (typeof path === 'function') {
path = path(data, i);
}
@@ -42,6 +46,7 @@ function Shortcuts() {
}
return {
+ id,
path,
title,
icon,
@@ -65,47 +70,83 @@ function Shortcuts() {
return (
-
+ {snapStates.settings.shortcutsViewMode === 'tab-menu-bar' ? (
+
+ ) : (
+
+ )}
);
}
diff --git a/src/components/timeline.jsx b/src/components/timeline.jsx
index 53b0a60d..fa6d055d 100644
--- a/src/components/timeline.jsx
+++ b/src/components/timeline.jsx
@@ -262,7 +262,7 @@ function Timeline({
{headerStart !== null && headerStart !== undefined ? (
headerStart
) : (
-
+
)}
diff --git a/src/pages/account-statuses.jsx b/src/pages/account-statuses.jsx
index 346d4fe2..5561849f 100644
--- a/src/pages/account-statuses.jsx
+++ b/src/pages/account-statuses.jsx
@@ -97,7 +97,7 @@ function AccountStatuses() {
}
- id="account_statuses"
+ id="account-statuses"
instance={instance}
emptyText="Nothing to see here yet."
errorText="Unable to load statuses"
diff --git a/src/pages/hashtag.jsx b/src/pages/hashtag.jsx
index 6219c0c3..7bba1ebe 100644
--- a/src/pages/hashtag.jsx
+++ b/src/pages/hashtag.jsx
@@ -104,7 +104,7 @@ function Hashtags(props) {
)
}
- id="hashtags"
+ id="hashtag"
instance={instance}
emptyText="No one has posted anything with this tag yet."
errorText="Unable to load posts with this tag"
diff --git a/src/pages/home.jsx b/src/pages/home.jsx
index 3b1aea92..4cd84d98 100644
--- a/src/pages/home.jsx
+++ b/src/pages/home.jsx
@@ -28,7 +28,8 @@ function Home() {
return (
<>
- {snapStates.settings.shortcutsColumnsMode &&
+ {(snapStates.settings.shortcutsColumnsMode ||
+ snapStates.settings.shortcutsViewMode === 'multi-column') &&
!!snapStates.shortcuts?.length ? (
) : (
@@ -40,7 +41,7 @@ function Home() {
headerEnd={
{
diff --git a/src/utils/states.js b/src/utils/states.js
index a42bc6bd..44ca5119 100644
--- a/src/utils/states.js
+++ b/src/utils/states.js
@@ -37,6 +37,7 @@ const states = proxy({
shortcuts: store.account.get('shortcuts') ?? [],
// Settings
settings: {
+ shortcutsViewMode: store.account.get('settings-shortcutsViewMode') ?? null,
shortcutsColumnsMode:
store.account.get('settings-shortcutsColumnsMode') ?? false,
boostsCarousel: store.account.get('settings-boostsCarousel') ?? true,
@@ -58,6 +59,9 @@ subscribe(states, (v) => {
if (path.join('.') === 'settings.shortcutsColumnsMode') {
store.account.set('settings-shortcutsColumnsMode', !!value);
}
+ if (path.join('.') === 'settings.shortcutsViewMode') {
+ store.account.set('settings-shortcutsViewMode', value);
+ }
if (path?.[0] === 'shortcuts') {
store.account.set('shortcuts', states.shortcuts);
}
From 71f4ee4ce207e3f3b5ea9bc89731cbd3246346f1 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Tue, 28 Feb 2023 00:17:00 +0800
Subject: [PATCH 22/66] Hmm messed up the file casing
Will need to fix this later
---
src/components/shortcuts.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/shortcuts.jsx b/src/components/shortcuts.jsx
index b8ab396d..c6c24eb3 100644
--- a/src/components/shortcuts.jsx
+++ b/src/components/shortcuts.jsx
@@ -11,7 +11,7 @@ import states from '../utils/states';
import AsyncText from './AsyncText';
import Icon from './icon';
-import Link from './Link';
+import Link from './link';
import MenuLink from './MenuLink';
function Shortcuts() {
From 624f7930ad49e2a2f029e15844c438ca096087d6 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Tue, 28 Feb 2023 00:34:53 +0800
Subject: [PATCH 23/66] Fix tab bar widths
---
src/components/shortcuts.css | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/components/shortcuts.css b/src/components/shortcuts.css
index 3baae5c7..b8a53366 100644
--- a/src/components/shortcuts.css
+++ b/src/components/shortcuts.css
@@ -75,7 +75,6 @@
display: flex;
}
#shortcuts .tab-bar li a {
- padding: 16px 0;
display: block;
color: var(--text-insignificant-color);
font-size: 10px;
@@ -86,7 +85,7 @@
padding: 8px;
text-decoration: none;
text-shadow: 0 var(--hairline-width) var(--bg-color);
- max-width: max(44px, 20vw);
+ width: 20vw;
}
#shortcuts .tab-bar li a:active {
transform: scale(0.95);
@@ -143,6 +142,7 @@ shortcuts .tab-bar[hidden] {
}
#shortcuts .tab-bar li a {
padding: 0 16px;
+ width: auto;
flex-direction: row;
font-size: 14px;
height: 44px;
From 74e20fb532ad9f1714bfc6dea333a1bc9f814fd6 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Tue, 28 Feb 2023 00:35:07 +0800
Subject: [PATCH 24/66] Fix scroll-to-top not working
---
src/components/shortcuts-settings.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/shortcuts-settings.jsx b/src/components/shortcuts-settings.jsx
index 2ddedcf1..da555ce6 100644
--- a/src/components/shortcuts-settings.jsx
+++ b/src/components/shortcuts-settings.jsx
@@ -82,7 +82,7 @@ const TYPE_PARAMS = {
};
export const SHORTCUTS_META = {
following: {
- id: (_, index) => (index === 0 ? 'home' : 'following'),
+ id: 'home',
title: (_, index) => (index === 0 ? 'Home' : 'Following'),
path: '/',
icon: 'home',
From ba692e4caac2208927b3c900cd8c79bed9e29c6e Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Tue, 28 Feb 2023 00:35:23 +0800
Subject: [PATCH 25/66] Fix lack of spacing for compose button above the tab
bar
---
src/app.css | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/app.css b/src/app.css
index 740ebe67..8f828637 100644
--- a/src/app.css
+++ b/src/app.css
@@ -966,7 +966,7 @@ body:has(.status-deck) .media-post-link {
}
#app:has(#shortcuts .tab-bar) #compose-button {
bottom: calc(16px + 52px);
- bottom: calc(max(16px, env(safe-area-inset-bottom)) + 52px);
+ bottom: calc(16px + env(safe-area-inset-bottom) + 52px);
}
/* SHEET */
From 1808bebe843aca66ebbe2a0a6cff62baad540f2b Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Tue, 28 Feb 2023 00:37:53 +0800
Subject: [PATCH 26/66] Allow lower height single image
---
src/components/status.css | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/components/status.css b/src/components/status.css
index 27bec1e4..bd4b555f 100644
--- a/src/components/status.css
+++ b/src/components/status.css
@@ -330,6 +330,11 @@
gap: 2px;
height: 160px;
}
+.status .media-container.media-eq1 {
+ min-height: 44px;
+ height: auto;
+ max-height: 160px;
+}
.status .media-container.media-gt2 {
height: 200px;
}
From 58bc60c9b84cf9cce749d8e84b07dd1d42434f63 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Tue, 28 Feb 2023 07:59:48 +0800
Subject: [PATCH 27/66] Few CSS touches
---
src/app.css | 2 +-
src/components/shortcuts.css | 2 ++
src/index.css | 4 ++++
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/app.css b/src/app.css
index 8f828637..0a52a619 100644
--- a/src/app.css
+++ b/src/app.css
@@ -1211,7 +1211,7 @@ meter.donut:is(.danger, .explode):after {
.shiny-pill {
color: var(--button-text-color);
- text-shadow: 0 -1px var(--drop-shadow-color);
+ text-shadow: 0 calc(var(--hairline-width) * -1) var(--drop-shadow-color);
background-color: var(--button-bg-color);
background-image: linear-gradient(
160deg,
diff --git a/src/components/shortcuts.css b/src/components/shortcuts.css
index b8a53366..dcec80b3 100644
--- a/src/components/shortcuts.css
+++ b/src/components/shortcuts.css
@@ -61,6 +61,8 @@
transition: all 0.3s ease-in-out;
padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom)
env(safe-area-inset-left);
+ user-select: none;
+ -webkit-touch-callout: none;
}
#shortcuts .tab-bar ul {
display: flex;
diff --git a/src/index.css b/src/index.css
index 4910509a..796ec971 100644
--- a/src/index.css
+++ b/src/index.css
@@ -84,6 +84,10 @@
box-sizing: border-box;
}
+html {
+ text-size-adjust: 100%;
+}
+
body {
font-family: ui-rounded, system-ui;
font-size: 16px;
From 12b2387646646f5849841b17e248d3edd6c571e9 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Tue, 28 Feb 2023 08:12:07 +0800
Subject: [PATCH 28/66] Add backdrop for menu
---
src/app.css | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/app.css b/src/app.css
index 0a52a619..3445a34f 100644
--- a/src/app.css
+++ b/src/app.css
@@ -1040,6 +1040,9 @@ body:has(.status-deck) .media-post-link {
/* MENU POPUP */
+.szh-menu-container:has(.szh-menu--state-open) {
+ inset: 0;
+}
.szh-menu {
padding: 8px 0;
margin: 0;
From 327ba37fdf2b1a901762181b6afd57573d6b3cdc Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Tue, 28 Feb 2023 08:12:24 +0800
Subject: [PATCH 29/66] Bump dependencies
---
package-lock.json | 56 +++++++++++++++++++++++------------------------
package.json | 8 +++----
2 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index b3adf415..3e08ab14 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -10,7 +10,7 @@
"dependencies": {
"@github/text-expander-element": "~2.3.0",
"@iconify-icons/mingcute": "~1.2.4",
- "@szhsin/react-menu": "~3.4.1",
+ "@szhsin/react-menu": "~3.5.1",
"dayjs": "~1.11.7",
"dayjs-twitter": "~0.5.0",
"fast-blurhash": "~1.1.2",
@@ -21,9 +21,9 @@
"mem": "~9.0.2",
"p-retry": "~5.1.2",
"p-throttle": "~5.0.0",
- "preact": "~10.12.1",
+ "preact": "~10.13.0",
"react-hotkeys-hook": "~4.3.7",
- "react-intersection-observer": "~9.4.2",
+ "react-intersection-observer": "~9.4.3",
"react-router-dom": "6.6.2",
"string-length": "~5.0.1",
"swiped-events": "~1.1.7",
@@ -35,7 +35,7 @@
},
"devDependencies": {
"@preact/preset-vite": "~2.5.0",
- "@trivago/prettier-plugin-sort-imports": "~4.1.0",
+ "@trivago/prettier-plugin-sort-imports": "~4.1.1",
"postcss": "~8.4.21",
"postcss-dark-theme-class": "~0.7.3",
"postcss-preset-env": "~8.0.1",
@@ -2811,9 +2811,9 @@
}
},
"node_modules/@szhsin/react-menu": {
- "version": "3.4.1",
- "resolved": "https://registry.npmjs.org/@szhsin/react-menu/-/react-menu-3.4.1.tgz",
- "integrity": "sha512-Pxt7Kyp3yuX7zkT5tjdLRJGNFMa5Tx4BP+01gJ/dnMmHQpI1H2or9gEC0X+t3cLldO3LGmm4ViGypNCmQLv/4A==",
+ "version": "3.5.1",
+ "resolved": "https://registry.npmjs.org/@szhsin/react-menu/-/react-menu-3.5.1.tgz",
+ "integrity": "sha512-bTCfVNBSReG4+mnbN8n2OQWZ3DRPlJgMIBJFepPfDLiRzNSe5lbZ8Z5Kjiv9nuPLHOu3jSaybxgYJj/Dn8n75Q==",
"dependencies": {
"prop-types": "^15.7.2",
"react-transition-state": "^1.1.5"
@@ -2824,9 +2824,9 @@
}
},
"node_modules/@trivago/prettier-plugin-sort-imports": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/@trivago/prettier-plugin-sort-imports/-/prettier-plugin-sort-imports-4.1.0.tgz",
- "integrity": "sha512-aTr6QPFaPAAzPRFn9yWB/9yKi3ZAFqfGpxIGLPWuQfYJFGUed+W3KKwxntsoCiNvNE2iuKOg6haMo5KG8WXltg==",
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/@trivago/prettier-plugin-sort-imports/-/prettier-plugin-sort-imports-4.1.1.tgz",
+ "integrity": "sha512-dQ2r2uzNr1x6pJsuh/8x0IRA3CBUB+pWEW3J/7N98axqt7SQSm+2fy0FLNXvXGg77xEDC7KHxJlHfLYyi7PDcw==",
"dev": true,
"dependencies": {
"@babel/generator": "7.17.7",
@@ -5630,9 +5630,9 @@
"dev": true
},
"node_modules/preact": {
- "version": "10.12.1",
- "resolved": "https://registry.npmjs.org/preact/-/preact-10.12.1.tgz",
- "integrity": "sha512-l8386ixSsBdbreOAkqtrwqHwdvR35ID8c3rKPa8lCWuO86dBi32QWHV4vfsZK1utLLFMvw+Z5Ad4XLkZzchscg==",
+ "version": "10.13.0",
+ "resolved": "https://registry.npmjs.org/preact/-/preact-10.13.0.tgz",
+ "integrity": "sha512-ERdIdUpR6doqdaSIh80hvzebHB7O6JxycOhyzAeLEchqOq/4yueslQbfnPwXaNhAYacFTyCclhwkEbOumT0tHw==",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/preact"
@@ -5768,9 +5768,9 @@
}
},
"node_modules/react-intersection-observer": {
- "version": "9.4.2",
- "resolved": "https://registry.npmjs.org/react-intersection-observer/-/react-intersection-observer-9.4.2.tgz",
- "integrity": "sha512-AdK+ryzZ7U9ZJYttDUZ8q2Am3nqE0exg5Ryl5Y124KeVsix/1hGZPbdu58EqA98TwnzwDNWHxg/kwNawmIiUig==",
+ "version": "9.4.3",
+ "resolved": "https://registry.npmjs.org/react-intersection-observer/-/react-intersection-observer-9.4.3.tgz",
+ "integrity": "sha512-WNRqMQvKpupr6MzecAQI0Pj0+JQong307knLP4g/nBex7kYfIaZsPpXaIhKHR+oV8z+goUbH9e10j6lGRnTzlQ==",
"peerDependencies": {
"react": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0"
}
@@ -8836,18 +8836,18 @@
}
},
"@szhsin/react-menu": {
- "version": "3.4.1",
- "resolved": "https://registry.npmjs.org/@szhsin/react-menu/-/react-menu-3.4.1.tgz",
- "integrity": "sha512-Pxt7Kyp3yuX7zkT5tjdLRJGNFMa5Tx4BP+01gJ/dnMmHQpI1H2or9gEC0X+t3cLldO3LGmm4ViGypNCmQLv/4A==",
+ "version": "3.5.1",
+ "resolved": "https://registry.npmjs.org/@szhsin/react-menu/-/react-menu-3.5.1.tgz",
+ "integrity": "sha512-bTCfVNBSReG4+mnbN8n2OQWZ3DRPlJgMIBJFepPfDLiRzNSe5lbZ8Z5Kjiv9nuPLHOu3jSaybxgYJj/Dn8n75Q==",
"requires": {
"prop-types": "^15.7.2",
"react-transition-state": "^1.1.5"
}
},
"@trivago/prettier-plugin-sort-imports": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/@trivago/prettier-plugin-sort-imports/-/prettier-plugin-sort-imports-4.1.0.tgz",
- "integrity": "sha512-aTr6QPFaPAAzPRFn9yWB/9yKi3ZAFqfGpxIGLPWuQfYJFGUed+W3KKwxntsoCiNvNE2iuKOg6haMo5KG8WXltg==",
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/@trivago/prettier-plugin-sort-imports/-/prettier-plugin-sort-imports-4.1.1.tgz",
+ "integrity": "sha512-dQ2r2uzNr1x6pJsuh/8x0IRA3CBUB+pWEW3J/7N98axqt7SQSm+2fy0FLNXvXGg77xEDC7KHxJlHfLYyi7PDcw==",
"dev": true,
"requires": {
"@babel/generator": "7.17.7",
@@ -10831,9 +10831,9 @@
"dev": true
},
"preact": {
- "version": "10.12.1",
- "resolved": "https://registry.npmjs.org/preact/-/preact-10.12.1.tgz",
- "integrity": "sha512-l8386ixSsBdbreOAkqtrwqHwdvR35ID8c3rKPa8lCWuO86dBi32QWHV4vfsZK1utLLFMvw+Z5Ad4XLkZzchscg=="
+ "version": "10.13.0",
+ "resolved": "https://registry.npmjs.org/preact/-/preact-10.13.0.tgz",
+ "integrity": "sha512-ERdIdUpR6doqdaSIh80hvzebHB7O6JxycOhyzAeLEchqOq/4yueslQbfnPwXaNhAYacFTyCclhwkEbOumT0tHw=="
},
"prettier": {
"version": "2.8.0",
@@ -10918,9 +10918,9 @@
"requires": {}
},
"react-intersection-observer": {
- "version": "9.4.2",
- "resolved": "https://registry.npmjs.org/react-intersection-observer/-/react-intersection-observer-9.4.2.tgz",
- "integrity": "sha512-AdK+ryzZ7U9ZJYttDUZ8q2Am3nqE0exg5Ryl5Y124KeVsix/1hGZPbdu58EqA98TwnzwDNWHxg/kwNawmIiUig==",
+ "version": "9.4.3",
+ "resolved": "https://registry.npmjs.org/react-intersection-observer/-/react-intersection-observer-9.4.3.tgz",
+ "integrity": "sha512-WNRqMQvKpupr6MzecAQI0Pj0+JQong307knLP4g/nBex7kYfIaZsPpXaIhKHR+oV8z+goUbH9e10j6lGRnTzlQ==",
"requires": {}
},
"react-is": {
diff --git a/package.json b/package.json
index e457306e..60c150f7 100644
--- a/package.json
+++ b/package.json
@@ -12,7 +12,7 @@
"dependencies": {
"@github/text-expander-element": "~2.3.0",
"@iconify-icons/mingcute": "~1.2.4",
- "@szhsin/react-menu": "~3.4.1",
+ "@szhsin/react-menu": "~3.5.1",
"dayjs": "~1.11.7",
"dayjs-twitter": "~0.5.0",
"fast-blurhash": "~1.1.2",
@@ -23,9 +23,9 @@
"mem": "~9.0.2",
"p-retry": "~5.1.2",
"p-throttle": "~5.0.0",
- "preact": "~10.12.1",
+ "preact": "~10.13.0",
"react-hotkeys-hook": "~4.3.7",
- "react-intersection-observer": "~9.4.2",
+ "react-intersection-observer": "~9.4.3",
"react-router-dom": "6.6.2",
"string-length": "~5.0.1",
"swiped-events": "~1.1.7",
@@ -37,7 +37,7 @@
},
"devDependencies": {
"@preact/preset-vite": "~2.5.0",
- "@trivago/prettier-plugin-sort-imports": "~4.1.0",
+ "@trivago/prettier-plugin-sort-imports": "~4.1.1",
"postcss": "~8.4.21",
"postcss-dark-theme-class": "~0.7.3",
"postcss-preset-env": "~8.0.1",
From 57200b382f911de1b3edbd36db8083574730a756 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Tue, 28 Feb 2023 08:30:38 +0800
Subject: [PATCH 30/66] Style fixes for new tab/menu bar
---
src/app.css | 8 +++++---
src/components/shortcuts.css | 4 ++--
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/app.css b/src/app.css
index 3445a34f..b0c12d58 100644
--- a/src/app.css
+++ b/src/app.css
@@ -964,9 +964,11 @@ body:has(.status-deck) .media-post-link {
#compose-button .icon {
filter: drop-shadow(0 1px 2px var(--button-bg-color));
}
-#app:has(#shortcuts .tab-bar) #compose-button {
- bottom: calc(16px + 52px);
- bottom: calc(16px + env(safe-area-inset-bottom) + 52px);
+@media (max-width: calc(40em - 1px)) {
+ #app:has(#shortcuts .tab-bar) #compose-button {
+ bottom: calc(16px + 52px);
+ bottom: calc(16px + env(safe-area-inset-bottom) + 52px);
+ }
}
/* SHEET */
diff --git a/src/components/shortcuts.css b/src/components/shortcuts.css
index dcec80b3..7cfd3aa7 100644
--- a/src/components/shortcuts.css
+++ b/src/components/shortcuts.css
@@ -120,10 +120,10 @@ shortcuts .tab-bar[hidden] {
}
@media (min-width: calc(40em)) {
- .timeline-deck {
+ #app:has(#shortcuts .tab-bar) .timeline-deck {
margin-top: 44px;
}
- .timeline-deck > header {
+ #app:has(#shortcuts .tab-bar) .timeline-deck > header {
--margin-top: calc(44px + 8px);
}
#shortcuts .tab-bar:not([hidden]) {
From 067486e4dfd8474315d2693bc08d99084b03d4f5 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Tue, 28 Feb 2023 08:38:46 +0800
Subject: [PATCH 31/66] More style fixes
---
src/components/shortcuts.css | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/components/shortcuts.css b/src/components/shortcuts.css
index 7cfd3aa7..d49576d6 100644
--- a/src/components/shortcuts.css
+++ b/src/components/shortcuts.css
@@ -75,6 +75,7 @@
padding: 0;
list-style: none;
display: flex;
+ justify-content: center;
}
#shortcuts .tab-bar li a {
display: block;
@@ -119,7 +120,7 @@ shortcuts .tab-bar[hidden] {
user-select: none;
}
-@media (min-width: calc(40em)) {
+@media (min-width: 40em) {
#app:has(#shortcuts .tab-bar) .timeline-deck {
margin-top: 44px;
}
@@ -136,8 +137,13 @@ shortcuts .tab-bar[hidden] {
box-shadow: none;
border-bottom: var(--hairline-width) solid var(--bg-faded-color);
}
- #shortcuts .tab-bar ul {
- justify-content: center;
+ #shortcuts .tab-bar ul:before {
+ content: '';
+ margin: auto;
+ }
+ #shortcuts .tab-bar ul:after {
+ content: '';
+ margin: auto;
}
#shortcuts .tab-bar li {
flex-grow: 0;
From b2b8b58863576e038654b17413fba60b1f3250b2 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Tue, 28 Feb 2023 15:27:42 +0800
Subject: [PATCH 32/66] Very basic update checker
---
package-lock.json | 179 ++++++++++++++++++++++++++++++++++++++++
package.json | 1 +
src/app.jsx | 15 +++-
src/components/icon.jsx | 1 +
src/components/menu.jsx | 21 +++++
src/utils/states.js | 1 +
vite.config.js | 14 +++-
7 files changed, 229 insertions(+), 3 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 3e08ab14..cdcaec9e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -41,6 +41,7 @@
"postcss-preset-env": "~8.0.1",
"twitter-text": "~3.1.0",
"vite": "~4.1.4",
+ "vite-plugin-generate-file": "~0.0.4",
"vite-plugin-html-config": "~1.0.11",
"vite-plugin-html-env": "~1.2.7",
"vite-plugin-pwa": "~0.14.4",
@@ -3099,6 +3100,12 @@
"node": ">=4"
}
},
+ "node_modules/argparse": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
+ "dev": true
+ },
"node_modules/async": {
"version": "3.2.4",
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
@@ -4541,6 +4548,18 @@
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="
},
+ "node_modules/js-yaml": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
+ "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
+ "dev": true,
+ "dependencies": {
+ "argparse": "^2.0.1"
+ },
+ "bin": {
+ "js-yaml": "bin/js-yaml.js"
+ }
+ },
"node_modules/jsesc": {
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz",
@@ -6631,6 +6650,88 @@
}
}
},
+ "node_modules/vite-plugin-generate-file": {
+ "version": "0.0.4",
+ "resolved": "https://registry.npmjs.org/vite-plugin-generate-file/-/vite-plugin-generate-file-0.0.4.tgz",
+ "integrity": "sha512-5cdsdSRGdtUxbAGdaXlW3Wiy46lK7LYm2FaTy42KCFT9fS6kiR+Ynjsjt7UEuE4nfStvCS9bVk9+YtsEIJ+Vhw==",
+ "dev": true,
+ "dependencies": {
+ "chalk": "^4.1.2",
+ "ejs": "^3.1.6",
+ "js-yaml": "^4.1.0",
+ "mime-types": "^2.1.35"
+ }
+ },
+ "node_modules/vite-plugin-generate-file/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "dev": true,
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/vite-plugin-generate-file/node_modules/chalk": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
+ "dev": true,
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/vite-plugin-generate-file/node_modules/color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "dependencies": {
+ "color-name": "~1.1.4"
+ },
+ "engines": {
+ "node": ">=7.0.0"
+ }
+ },
+ "node_modules/vite-plugin-generate-file/node_modules/color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "node_modules/vite-plugin-generate-file/node_modules/has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/vite-plugin-generate-file/node_modules/supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "dev": true,
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/vite-plugin-html-config": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/vite-plugin-html-config/-/vite-plugin-html-config-1.0.11.tgz",
@@ -9078,6 +9179,12 @@
"color-convert": "^1.9.0"
}
},
+ "argparse": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
+ "dev": true
+ },
"async": {
"version": "3.2.4",
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
@@ -10127,6 +10234,15 @@
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="
},
+ "js-yaml": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
+ "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
+ "dev": true,
+ "requires": {
+ "argparse": "^2.0.1"
+ }
+ },
"jsesc": {
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz",
@@ -11518,6 +11634,69 @@
"rollup": "^3.10.0"
}
},
+ "vite-plugin-generate-file": {
+ "version": "0.0.4",
+ "resolved": "https://registry.npmjs.org/vite-plugin-generate-file/-/vite-plugin-generate-file-0.0.4.tgz",
+ "integrity": "sha512-5cdsdSRGdtUxbAGdaXlW3Wiy46lK7LYm2FaTy42KCFT9fS6kiR+Ynjsjt7UEuE4nfStvCS9bVk9+YtsEIJ+Vhw==",
+ "dev": true,
+ "requires": {
+ "chalk": "^4.1.2",
+ "ejs": "^3.1.6",
+ "js-yaml": "^4.1.0",
+ "mime-types": "^2.1.35"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "dev": true,
+ "requires": {
+ "color-convert": "^2.0.1"
+ }
+ },
+ "chalk": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
"vite-plugin-html-config": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/vite-plugin-html-config/-/vite-plugin-html-config-1.0.11.tgz",
diff --git a/package.json b/package.json
index 60c150f7..bc5bff5d 100644
--- a/package.json
+++ b/package.json
@@ -43,6 +43,7 @@
"postcss-preset-env": "~8.0.1",
"twitter-text": "~3.1.0",
"vite": "~4.1.4",
+ "vite-plugin-generate-file": "~0.0.4",
"vite-plugin-html-config": "~1.0.11",
"vite-plugin-html-env": "~1.2.7",
"vite-plugin-pwa": "~0.14.4",
diff --git a/src/app.jsx b/src/app.jsx
index e05a40b8..c492d544 100644
--- a/src/app.jsx
+++ b/src/app.jsx
@@ -19,8 +19,6 @@ import { useSnapshot } from 'valtio';
import Account from './components/account';
import Compose from './components/compose';
import Drafts from './components/drafts';
-import Icon from './components/icon';
-import Link from './components/link';
import Loader from './components/loader';
import MediaModal from './components/media-modal';
import Modal from './components/modal';
@@ -56,6 +54,7 @@ import showToast from './utils/show-toast';
import states, { getStatus, saveStatus } from './utils/states';
import store from './utils/store';
import { getCurrentAccount } from './utils/store-utils';
+import useInterval from './utils/useInterval';
import usePageVisibility from './utils/usePageVisibility';
window.__STATES__ = states;
@@ -241,6 +240,18 @@ function App() {
return !/^\/(login|welcome)/.test(pathname);
}, [location]);
+ useInterval(() => {
+ console.log('✨ Check app update');
+ fetch('./version.json')
+ .then((r) => r.json())
+ .then((info) => {
+ if (info) states.appVersion = info;
+ })
+ .catch((e) => {
+ console.error(e);
+ });
+ }, visible && 1000 * 60 * 60); // 1 hour
+
return (
<>
diff --git a/src/components/icon.jsx b/src/components/icon.jsx
index 3e84b2f4..dd96894e 100644
--- a/src/components/icon.jsx
+++ b/src/components/icon.jsx
@@ -61,6 +61,7 @@ const ICONS = {
link: 'mingcute:link-2-line',
history: 'mingcute:history-line',
share: 'mingcute:share-2-line',
+ sparkles: 'mingcute:sparkles-line',
};
const modules = import.meta.glob('/node_modules/@iconify-icons/mingcute/*.js');
diff --git a/src/components/menu.jsx b/src/components/menu.jsx
index d1b3b791..c7ca39f0 100644
--- a/src/components/menu.jsx
+++ b/src/components/menu.jsx
@@ -34,6 +34,27 @@ function NavMenu(props) {
}
>
+ {!!snapStates.appVersion?.commitHash &&
+ __COMMIT_HASH__ !== snapStates.appVersion.commitHash && (
+ <>
+
+
+ >
+ )}
Home
diff --git a/src/utils/states.js b/src/utils/states.js
index 44ca5119..abf6d378 100644
--- a/src/utils/states.js
+++ b/src/utils/states.js
@@ -6,6 +6,7 @@ import { api } from './api';
import store from './store';
const states = proxy({
+ appVersion: {},
// history: [],
prevLocation: null,
currentLocation: null,
diff --git a/vite.config.js b/vite.config.js
index e743151c..1998c922 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -3,6 +3,7 @@ import { execSync } from 'child_process';
import fs from 'fs';
import { resolve } from 'path';
import { defineConfig, loadEnv, splitVendorChunkPlugin } from 'vite';
+import generateFile from 'vite-plugin-generate-file';
import htmlPlugin from 'vite-plugin-html-config';
import VitePluginHtmlEnv from 'vite-plugin-html-env';
import { VitePWA } from 'vite-plugin-pwa';
@@ -12,6 +13,7 @@ const { NODE_ENV } = process.env;
const { VITE_CLIENT_NAME: CLIENT_NAME, VITE_APP_ERROR_LOGGING: ERROR_LOGGING } =
loadEnv('production', process.cwd());
+const now = new Date();
const commitHash = execSync('git rev-parse --short HEAD').toString().trim();
const rollbarCode = fs.readFileSync(
@@ -23,7 +25,7 @@ const rollbarCode = fs.readFileSync(
export default defineConfig({
mode: NODE_ENV,
define: {
- __BUILD_TIME__: JSON.stringify(Date.now()),
+ __BUILD_TIME__: JSON.stringify(now),
__COMMIT_HASH__: JSON.stringify(commitHash),
},
plugins: [
@@ -36,6 +38,16 @@ export default defineConfig({
htmlPlugin({
headScripts: ERROR_LOGGING ? [rollbarCode] : [],
}),
+ generateFile([
+ {
+ type: 'json',
+ output: './version.json',
+ data: {
+ buildTime: now,
+ commitHash,
+ },
+ },
+ ]),
VitePWA({
manifest: {
name: CLIENT_NAME,
From 393a47364981854a1859a779bb674bdac02ed39c Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Tue, 28 Feb 2023 15:32:29 +0800
Subject: [PATCH 33/66] Fix wrong logic
---
src/app.jsx | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/app.jsx b/src/app.jsx
index c492d544..c176a150 100644
--- a/src/app.jsx
+++ b/src/app.jsx
@@ -297,10 +297,10 @@ function App() {
} />
- {(!snapStates.settings.shortcutsColumnsMode ||
- snapStates.settings.shortcutsViewMode !== 'multi-column') && (
-
- )}
+ {!snapStates.settings.shortcutsColumnsMode &&
+ snapStates.settings.shortcutsViewMode !== 'multi-column' && (
+
+ )}
{!!snapStates.showCompose && (
Date: Tue, 28 Feb 2023 15:45:38 +0800
Subject: [PATCH 34/66] Attempt to fix menu sometimes not closeable on Mobile
Safari
---
src/components/status.jsx | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/components/status.jsx b/src/components/status.jsx
index 9a61b19d..b8f583d5 100644
--- a/src/components/status.jsx
+++ b/src/components/status.jsx
@@ -339,6 +339,7 @@ function Status({
}
};
+ const menuInstanceRef = useRef();
const StatusMenuItems = (
<>
{!isSizeLarge && (
@@ -559,22 +560,28 @@ function Status({
{size !== 'l' &&
(url ? (
@@ -156,88 +158,90 @@ function Settings({ onClose }) {
Settings
-
+
Hidden features
From f9af6cd8a7a7d7e288a42650a70f99a13087bd54 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Tue, 28 Feb 2023 19:12:16 +0800
Subject: [PATCH 39/66] Pass in all the 'i's
---
src/components/shortcuts-settings.jsx | 4 ++--
src/components/shortcuts.jsx | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/components/shortcuts-settings.jsx b/src/components/shortcuts-settings.jsx
index da555ce6..1681eced 100644
--- a/src/components/shortcuts-settings.jsx
+++ b/src/components/shortcuts-settings.jsx
@@ -249,10 +249,10 @@ function ShortcutsSettings() {
if (!SHORTCUTS_META[type]) return null;
let { icon, title } = SHORTCUTS_META[type];
if (typeof title === 'function') {
- title = title(shortcut);
+ title = title(shortcut, i);
}
if (typeof icon === 'function') {
- icon = icon(shortcut);
+ icon = icon(shortcut, i);
}
return (
-
diff --git a/src/components/shortcuts.jsx b/src/components/shortcuts.jsx
index c6c24eb3..c0832415 100644
--- a/src/components/shortcuts.jsx
+++ b/src/components/shortcuts.jsx
@@ -33,16 +33,16 @@ function Shortcuts() {
let { id, path, title, icon } = SHORTCUTS_META[type];
if (typeof id === 'function') {
- id = id(data);
+ id = id(data, i);
}
if (typeof path === 'function') {
path = path(data, i);
}
if (typeof title === 'function') {
- title = title(data);
+ title = title(data, i);
}
if (typeof icon === 'function') {
- icon = icon(data);
+ icon = icon(data, i);
}
return {
From eebba6608cbb79363c92cc56da693431ea48e1ee Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Tue, 28 Feb 2023 20:53:56 +0800
Subject: [PATCH 40/66] Update copy for floating button
---
src/components/shortcuts-settings.css | 6 ++++++
src/components/shortcuts-settings.jsx | 8 ++------
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/components/shortcuts-settings.css b/src/components/shortcuts-settings.css
index 756fa406..5d795cfb 100644
--- a/src/components/shortcuts-settings.css
+++ b/src/components/shortcuts-settings.css
@@ -30,6 +30,12 @@
flex-shrink: 0;
}
+#shortcuts-settings-container .shortcuts-view-mode {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+
#shortcuts-settings-container summary {
cursor: pointer;
}
diff --git a/src/components/shortcuts-settings.jsx b/src/components/shortcuts-settings.jsx
index 1681eced..0c20725e 100644
--- a/src/components/shortcuts-settings.jsx
+++ b/src/components/shortcuts-settings.jsx
@@ -206,12 +206,8 @@ function ShortcutsSettings() {
- Specify a list of shortcuts that'll appear in the floating Shortcuts
- button.
-
-
-