From ecd5c7b91e6b9942f804cbfcfd0b9fcc80ca1b85 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sun, 7 Jan 2024 14:47:17 +0800 Subject: [PATCH 1/9] . (period) keyboard shortcut = load new posts --- src/components/keyboard-shortcuts-help.jsx | 4 +++ src/components/timeline.jsx | 42 ++++++++++++---------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/components/keyboard-shortcuts-help.jsx b/src/components/keyboard-shortcuts-help.jsx index f36b664e1..e95fefa8f 100644 --- a/src/components/keyboard-shortcuts-help.jsx +++ b/src/components/keyboard-shortcuts-help.jsx @@ -71,6 +71,10 @@ export default memo(function KeyboardShortcutsHelp() { ), }, + { + action: 'Load new posts', + keys: ., + }, { action: 'Open post details', keys: ( diff --git a/src/components/timeline.jsx b/src/components/timeline.jsx index c56c27bad..7f806e457 100644 --- a/src/components/timeline.jsx +++ b/src/components/timeline.jsx @@ -204,6 +204,21 @@ function Timeline({ } }); + const showNewPostsIndicator = + items.length > 0 && uiState !== 'loading' && showNew; + const handleLoadNewPosts = useCallback(() => { + loadItems(true); + scrollableRef.current?.scrollTo({ + top: 0, + behavior: 'smooth', + }); + }, [loadItems]); + const dotRef = useHotkeys('.', () => { + if (showNewPostsIndicator) { + handleLoadNewPosts(); + } + }); + // const { // scrollDirection, // nearReachStart, @@ -387,24 +402,15 @@ function Timeline({ {!!headerEnd && headerEnd} - {items.length > 0 && - uiState !== 'loading' && - // !hiddenUI && - showNew && ( - - )} + {showNewPostsIndicator && ( + + )} {!!timelineStart && (
Date: Mon, 8 Jan 2024 13:44:31 +0800 Subject: [PATCH 2/9] Upgrade dependencies --- package-lock.json | 194 ++++++++++++++++++++++++++++++++++++++++------ package.json | 10 +-- 2 files changed, 177 insertions(+), 27 deletions(-) diff --git a/package-lock.json b/package-lock.json index 624ef8f5f..766ca6561 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,12 +23,12 @@ "idb-keyval": "~6.2.1", "just-debounce-it": "~3.2.0", "lz-string": "~1.5.0", - "masto": "~6.5.1", + "masto": "~6.5.2", "moize": "~6.1.6", "p-retry": "~6.2.0", "p-throttle": "~6.1.0", "preact": "~10.19.3", - "react-hotkeys-hook": "~4.4.1", + "react-hotkeys-hook": "~4.4.3", "react-intersection-observer": "~9.5.3", "react-quick-pinch-zoom": "~5.1.0", "react-router-dom": "6.6.2", @@ -43,13 +43,13 @@ "valtio": "1.9.0" }, "devDependencies": { - "@preact/preset-vite": "~2.7.0", + "@preact/preset-vite": "~2.8.1", "@trivago/prettier-plugin-sort-imports": "~4.3.0", - "postcss": "~8.4.32", + "postcss": "~8.4.33", "postcss-dark-theme-class": "~1.1.0", "postcss-preset-env": "~9.3.0", "twitter-text": "~3.1.0", - "vite": "~5.0.10", + "vite": "~5.0.11", "vite-plugin-generate-file": "~0.1.1", "vite-plugin-html-config": "~1.0.11", "vite-plugin-pwa": "~0.17.4", @@ -3081,11 +3081,10 @@ } }, "node_modules/@preact/preset-vite": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/@preact/preset-vite/-/preset-vite-2.7.0.tgz", - "integrity": "sha512-m5N0FVtxbCCDxNk55NGhsRpKJChYcupcuQHzMJc/Bll07IKZKn8amwYciyKFS9haU6AgzDAJ/ewvApr6Qg1DHw==", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/@preact/preset-vite/-/preset-vite-2.8.1.tgz", + "integrity": "sha512-a9KV4opdj17X2gOFuGup0aE+sXYABX/tJi/QDptOrleX4FlnoZgDWvz45tHOdVfrZX+3uvVsIYPHxRsTerkDNA==", "dev": true, - "license": "MIT", "dependencies": { "@babel/plugin-transform-react-jsx": "^7.22.15", "@babel/plugin-transform-react-jsx-development": "^7.22.5", @@ -3094,6 +3093,8 @@ "babel-plugin-transform-hook-names": "^1.0.2", "debug": "^4.3.4", "kolorist": "^1.8.0", + "magic-string": "0.30.5", + "node-html-parser": "^6.1.10", "resolve": "^1.22.8" }, "peerDependencies": { @@ -3101,6 +3102,24 @@ "vite": "2.x || 3.x || 4.x || 5.x" } }, + "node_modules/@preact/preset-vite/node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "node_modules/@preact/preset-vite/node_modules/magic-string": { + "version": "0.30.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.5.tgz", + "integrity": "sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==", + "dev": true, + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.15" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/@prefresh/babel-plugin": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/@prefresh/babel-plugin/-/babel-plugin-0.5.0.tgz", @@ -3752,6 +3771,12 @@ "dev": true, "license": "MIT" }, + "node_modules/boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", + "dev": true + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -4103,6 +4128,34 @@ "postcss": "^8.4" } }, + "node_modules/css-select": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", + "integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==", + "dev": true, + "dependencies": { + "boolbase": "^1.0.0", + "css-what": "^6.1.0", + "domhandler": "^5.0.2", + "domutils": "^3.0.1", + "nth-check": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/css-what": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz", + "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==", + "dev": true, + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, "node_modules/cssdb": { "version": "7.9.0", "resolved": "https://registry.npmjs.org/cssdb/-/cssdb-7.9.0.tgz", @@ -4193,6 +4246,61 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/dom-serializer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", + "dev": true, + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/domelementtype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ] + }, + "node_modules/domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "dev": true, + "dependencies": { + "domelementtype": "^2.3.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/domutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz", + "integrity": "sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==", + "dev": true, + "dependencies": { + "dom-serializer": "^2.0.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, "node_modules/dot-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", @@ -4232,6 +4340,18 @@ "dev": true, "license": "ISC" }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "dev": true, + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/es-abstract": { "version": "1.21.2", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.21.2.tgz", @@ -4811,6 +4931,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true, + "bin": { + "he": "bin/he" + } + }, "node_modules/header-case": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/header-case/-/header-case-2.0.4.tgz", @@ -5479,9 +5608,9 @@ } }, "node_modules/masto": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/masto/-/masto-6.5.1.tgz", - "integrity": "sha512-jQTWSNmwtKPQ/H9gW6dIvX4cYIQZE5tKwFFwv6/hcuwqHuYaNHMMU51Qt9pqC1y9NZshivwsMijC9QKUKIiHhg==", + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/masto/-/masto-6.5.2.tgz", + "integrity": "sha512-JfnG7MSQmhszWnLsvdBuxXc2tcVUyCvlTxnSH/5S+In4dU1tvc1wGhFR87kO+YW8gfDsDw9CHh+AD/z+DbTTfQ==", "dependencies": { "change-case": "^4.1.2", "events-to-async": "^2.0.1", @@ -5613,6 +5742,16 @@ "tslib": "^2.0.3" } }, + "node_modules/node-html-parser": { + "version": "6.1.12", + "resolved": "https://registry.npmjs.org/node-html-parser/-/node-html-parser-6.1.12.tgz", + "integrity": "sha512-/bT/Ncmv+fbMGX96XG9g05vFt43m/+SYKIs9oAemQVYyVcZmDAI2Xq/SbNcpOA35eF0Zk2av3Ksf+Xk8Vt8abA==", + "dev": true, + "dependencies": { + "css-select": "^5.1.0", + "he": "1.2.0" + } + }, "node_modules/node-releases": { "version": "2.0.13", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", @@ -5630,6 +5769,18 @@ "node": ">=0.10.0" } }, + "node_modules/nth-check": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "dev": true, + "dependencies": { + "boolbase": "^1.0.0" + }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + } + }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -5783,9 +5934,9 @@ } }, "node_modules/postcss": { - "version": "8.4.32", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.32.tgz", - "integrity": "sha512-D/kj5JNu6oo2EIy+XL/26JEDTlIbB8hw85G8StOE6L74RQAVVP5rej6wxCNqyMbR4RkPfqvezVbPw81Ngd6Kcw==", + "version": "8.4.33", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.33.tgz", + "integrity": "sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg==", "dev": true, "funding": [ { @@ -6646,10 +6797,9 @@ } }, "node_modules/react-hotkeys-hook": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/react-hotkeys-hook/-/react-hotkeys-hook-4.4.1.tgz", - "integrity": "sha512-sClBMBioFEgFGYLTWWRKvhxcCx1DRznd+wkFHwQZspnRBkHTgruKIHptlK/U/2DPX8BhHoRGzpMVWUXMmdZlmw==", - "license": "MIT", + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/react-hotkeys-hook/-/react-hotkeys-hook-4.4.3.tgz", + "integrity": "sha512-G6psp7OUm9xxY4G2vL48tBwWUVJLvD/PeInaPdPvqRJ8GoXBu6Djqr6WIw5gu1M0SbR1epNUlvpccxu2ZzmtFQ==", "peerDependencies": { "react": ">=16.8.1", "react-dom": ">=16.8.1" @@ -7624,9 +7774,9 @@ } }, "node_modules/vite": { - "version": "5.0.10", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.10.tgz", - "integrity": "sha512-2P8J7WWgmc355HUMlFrwofacvr98DAjoE52BfdbwQtyLH06XKwaL/FMnmKM2crF0iX4MpmMKoDlNCB1ok7zHCw==", + "version": "5.0.11", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.11.tgz", + "integrity": "sha512-XBMnDjZcNAw/G1gEiskiM1v6yzM4GE5aMGvhWTlHAYYhxb7S3/V1s3m2LDHa8Vh6yIWYYB0iJwsEaS523c4oYA==", "dev": true, "dependencies": { "esbuild": "^0.19.3", diff --git a/package.json b/package.json index 3d691b5de..feb541e00 100644 --- a/package.json +++ b/package.json @@ -25,12 +25,12 @@ "idb-keyval": "~6.2.1", "just-debounce-it": "~3.2.0", "lz-string": "~1.5.0", - "masto": "~6.5.1", + "masto": "~6.5.2", "moize": "~6.1.6", "p-retry": "~6.2.0", "p-throttle": "~6.1.0", "preact": "~10.19.3", - "react-hotkeys-hook": "~4.4.1", + "react-hotkeys-hook": "~4.4.3", "react-intersection-observer": "~9.5.3", "react-quick-pinch-zoom": "~5.1.0", "react-router-dom": "6.6.2", @@ -45,13 +45,13 @@ "valtio": "1.9.0" }, "devDependencies": { - "@preact/preset-vite": "~2.7.0", + "@preact/preset-vite": "~2.8.1", "@trivago/prettier-plugin-sort-imports": "~4.3.0", - "postcss": "~8.4.32", + "postcss": "~8.4.33", "postcss-dark-theme-class": "~1.1.0", "postcss-preset-env": "~9.3.0", "twitter-text": "~3.1.0", - "vite": "~5.0.10", + "vite": "~5.0.11", "vite-plugin-generate-file": "~0.1.1", "vite-plugin-html-config": "~1.0.11", "vite-plugin-pwa": "~0.17.4", From c47687e2e45e32ef23a2041f12ca39632097700f Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Wed, 10 Jan 2024 00:03:36 +0800 Subject: [PATCH 3/9] Fix / and ? key shortcuts suddenly not working --- src/components/keyboard-shortcuts-help.jsx | 2 +- src/components/search-command.jsx | 2 +- src/pages/search.jsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/keyboard-shortcuts-help.jsx b/src/components/keyboard-shortcuts-help.jsx index e95fefa8f..90cc82cce 100644 --- a/src/components/keyboard-shortcuts-help.jsx +++ b/src/components/keyboard-shortcuts-help.jsx @@ -17,7 +17,7 @@ export default memo(function KeyboardShortcutsHelp() { } useHotkeys( - '?, shift+?', + '?, shift+?, shift+slash', (e) => { console.log('help'); states.showKeyboardShortcutsHelp = true; diff --git a/src/components/search-command.jsx b/src/components/search-command.jsx index 105ab97ea..c40a92fa3 100644 --- a/src/components/search-command.jsx +++ b/src/components/search-command.jsx @@ -11,7 +11,7 @@ export default memo(function SearchCommand({ onClose = () => {} }) { const searchFormRef = useRef(null); useHotkeys( - '/', + ['Slash', '/'], (e) => { setShowSearch(true); setTimeout(() => { diff --git a/src/pages/search.jsx b/src/pages/search.jsx index 7c4f6ea32..0b2f706d8 100644 --- a/src/pages/search.jsx +++ b/src/pages/search.jsx @@ -174,7 +174,7 @@ function Search({ columnMode, ...props }) { }, [q, type, instance]); useHotkeys( - '/', + ['/', 'Slash'], (e) => { searchFormRef.current?.focus?.(); }, From d71b1a7e36cf97fc1b1d3980aad691aa5647286a Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Wed, 10 Jan 2024 01:47:50 +0800 Subject: [PATCH 4/9] Test add "more" icon near timestamp --- src/components/icon.jsx | 1 + src/components/status.css | 17 ++++++++++++++--- src/components/status.jsx | 1 + 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/components/icon.jsx b/src/components/icon.jsx index 1f60dcbae..5942cfd13 100644 --- a/src/components/icon.jsx +++ b/src/components/icon.jsx @@ -41,6 +41,7 @@ export const ICONS = { upload: () => import('@iconify-icons/mingcute/upload-3-line'), gear: () => import('@iconify-icons/mingcute/settings-3-line'), more: () => import('@iconify-icons/mingcute/more-3-line'), + more2: () => import('@iconify-icons/mingcute/more-1-fill'), external: () => import('@iconify-icons/mingcute/external-link-line'), popout: () => import('@iconify-icons/mingcute/external-link-line'), popin: [() => import('@iconify-icons/mingcute/external-link-line'), '180deg'], diff --git a/src/components/status.css b/src/components/status.css index 8921b7e54..eb4513538 100644 --- a/src/components/status.css +++ b/src/components/status.css @@ -364,9 +364,8 @@ vertical-align: middle; } .status > .container > .meta :is(.time, .edited) { - color: inherit; + color: var(--text-insignificant-color); text-align: end; - opacity: 0.5; text-decoration: none; flex-shrink: 0; margin-left: 4px; @@ -375,9 +374,21 @@ .status > .container > .meta a.time { position: relative; overflow: visible; + display: flex; + align-items: center; + gap: 2px; + font-size: 90%; + + .more { + margin-left: 4px; + transition: transform 0.2s ease-out; + } } .status > .container > .meta a.time:is(:hover, :focus) { - text-decoration: underline; + .more { + transform: scale(1.2); + color: var(--link-color); + } } .status > .container > .meta a.time:active, .status > .container > .meta a.time.is-open { diff --git a/src/components/status.jsx b/src/components/status.jsx index 9c4fd9cca..29914e0ca 100644 --- a/src/components/status.jsx +++ b/src/components/status.jsx @@ -1412,6 +1412,7 @@ function Status({ /> )}{' '} + {showContextMenu && } ) : ( // Date: Wed, 10 Jan 2024 01:48:20 +0800 Subject: [PATCH 5/9] Truncate URLs --- src/utils/getHTMLText.jsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/utils/getHTMLText.jsx b/src/utils/getHTMLText.jsx index 142f7e7d6..9ad74a3ca 100644 --- a/src/utils/getHTMLText.jsx +++ b/src/utils/getHTMLText.jsx @@ -9,6 +9,17 @@ function getHTMLText(html) { div.querySelectorAll('br').forEach((br) => { br.replaceWith('\n'); }); + + // MASTODON-SPECIFIC classes + // Remove .invisible + div.querySelectorAll('.invisible').forEach((el) => { + el.remove(); + }); + // Add … at end of .ellipsis + div.querySelectorAll('.ellipsis').forEach((el) => { + el.append('...'); + }); + return div.innerText.replace(/[\r\n]{3,}/g, '\n\n').trim(); } From 8c6563a6711bea80e032693b6c582f0d0ee38503 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Wed, 10 Jan 2024 14:48:08 +0800 Subject: [PATCH 6/9] More contextual copy --- src/components/shortcuts-settings.jsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/shortcuts-settings.jsx b/src/components/shortcuts-settings.jsx index db7b6cb1f..deb64c9ad 100644 --- a/src/components/shortcuts-settings.jsx +++ b/src/components/shortcuts-settings.jsx @@ -428,7 +428,12 @@ function ShortcutsSettings({ onClose }) { disabled={shortcuts.length >= SHORTCUTS_LIMIT} onClick={() => setShowForm(true)} > - Add shortcut + {' '} + + {snapStates.settings.shortcutsViewMode === 'multi-column' + ? 'Add column…' + : 'Add shortcut…'} +

From 07f927d4ffebf11f71daccd6a2f7a150a2fa200e Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Wed, 10 Jan 2024 14:48:29 +0800 Subject: [PATCH 7/9] Add notice if there's only 1 shortcut --- src/app.css | 4 + src/components/shortcuts-settings.jsx | 193 ++++++++++++++------------ 2 files changed, 106 insertions(+), 91 deletions(-) diff --git a/src/app.css b/src/app.css index a6c7f4e35..9af5af0b9 100644 --- a/src/app.css +++ b/src/app.css @@ -1059,6 +1059,10 @@ a[href^='http'][rel*='nofollow']:visited:not(:has(div)) { .ui-state { padding: 16px; text-align: center; + + .icon { + vertical-align: middle; + } } .status-carousel-link { diff --git a/src/components/shortcuts-settings.jsx b/src/components/shortcuts-settings.jsx index deb64c9ad..a2f1bdd29 100644 --- a/src/components/shortcuts-settings.jsx +++ b/src/components/shortcuts-settings.jsx @@ -279,92 +279,93 @@ function ShortcutsSettings({ onClose }) { })}
{shortcuts.length > 0 ? ( -
    - {shortcuts.filter(Boolean).map((shortcut, i) => { - // const key = i + Object.values(shortcut); - const key = Object.values(shortcut).join('-'); - const { type } = shortcut; - if (!SHORTCUTS_META[type]) return null; - let { icon, title, subtitle, excludeViewMode } = - SHORTCUTS_META[type]; - if (typeof title === 'function') { - title = title(shortcut, i); - } - if (typeof subtitle === 'function') { - subtitle = subtitle(shortcut, i); - } - if (typeof icon === 'function') { - icon = icon(shortcut, i); - } - if (typeof excludeViewMode === 'function') { - excludeViewMode = excludeViewMode(shortcut, i); - } - const excludedViewMode = excludeViewMode?.includes( - snapStates.settings.shortcutsViewMode, - ); - return ( -
  1. - - - {title} - {subtitle && ( - <> - {' '} - {subtitle} - - )} - {excludedViewMode && ( - - Not available in current view mode - - )} - - - - - - {/* + + + {/* */} - -
  2. - ); - })} -
+ + + ); + })} + + {shortcuts.length === 1 && + snapStates.settings.shortcutsViewMode !== 'float-button' && ( +
+ {' '} + + Add more than one shortcut/column to make this work. + +
+ )} + ) : (

No shortcuts yet. Tap on the Add shortcut button.

From 4b9ff0ca5b137e72008d17a8d3f78b32db88a11c Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Thu, 11 Jan 2024 10:44:24 +0800 Subject: [PATCH 8/9] Hide "more" icon for posts in notifications --- src/components/notification.jsx | 21 ++++++++++++++++++--- src/components/status.jsx | 6 ++++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/components/notification.jsx b/src/components/notification.jsx index e57220613..20e53045e 100644 --- a/src/components/notification.jsx +++ b/src/components/notification.jsx @@ -292,7 +292,12 @@ function Notification({ instance ? `/${instance}/s/${status.id}` : `/s/${status.id}` } > - + ))} @@ -326,9 +331,19 @@ function Notification({ } > {isStatic ? ( - + ) : ( - + )} )} diff --git a/src/components/status.jsx b/src/components/status.jsx index 29914e0ca..b2fb421a7 100644 --- a/src/components/status.jsx +++ b/src/components/status.jsx @@ -124,6 +124,7 @@ function Status({ quoted, onStatusLinkClick = () => {}, showFollowedTags, + allowContextMenu, }) { if (skeleton) { return ( @@ -987,7 +988,8 @@ function Status({ const [isContextMenuOpen, setIsContextMenuOpen] = useState(false); const [contextMenuProps, setContextMenuProps] = useState({}); - const showContextMenu = !isSizeLarge && !previewMode && !_deleted && !quoted; + const showContextMenu = + allowContextMenu || (!isSizeLarge && !previewMode && !_deleted && !quoted); // Only iOS/iPadOS browsers don't support contextmenu // Some comments report iPadOS might support contextmenu if a mouse is connected @@ -1412,7 +1414,7 @@ function Status({ /> )}{' '} - {showContextMenu && } + {!previewMode && } ) : ( // Date: Thu, 11 Jan 2024 10:44:37 +0800 Subject: [PATCH 9/9] Fix error when r is undefined --- src/utils/timeline-utils.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/timeline-utils.jsx b/src/utils/timeline-utils.jsx index 128b49046..f15dff8d5 100644 --- a/src/utils/timeline-utils.jsx +++ b/src/utils/timeline-utils.jsx @@ -219,7 +219,7 @@ export async function assignFollowedTags(items, instance) { statusWithFollowedTags.forEach((s) => { const { item, sKey, followedTags } = s; const r = relationships[item.account.id]; - if (!r.following) { + if (r && !r.following) { statusFollowedTags[sKey] = followedTags; } });