Merge branch 'main' of https://github.com/Crossbell-Box/xLog
This commit is contained in:
+3
-4
@@ -89,7 +89,7 @@
|
||||
"jsdom": "22.1.0",
|
||||
"jsonfeed-to-rss": "3.0.7",
|
||||
"katex": "0.16.8",
|
||||
"langchain": "0.0.132",
|
||||
"langchain": "0.0.133",
|
||||
"lottie-react": "2.4.0",
|
||||
"mdast-util-to-hast": "12.3.0",
|
||||
"mdast-util-toc": "7.0.0",
|
||||
@@ -151,9 +151,8 @@
|
||||
"unified": "10.1.2",
|
||||
"unist-builder": "4.0.0",
|
||||
"unist-util-visit": "5.0.0",
|
||||
"use-onclickoutside": "0.4.1",
|
||||
"uuid": "9.0.0",
|
||||
"viem": "1.6.7",
|
||||
"viem": "1.7.0",
|
||||
"wagmi": "1.3.10",
|
||||
"zustand": "4.4.1"
|
||||
},
|
||||
@@ -170,7 +169,7 @@
|
||||
"@types/katex": "0.16.2",
|
||||
"@types/mdast": "4.0.0",
|
||||
"@types/mjml": "4.7.1",
|
||||
"@types/node": "20.5.3",
|
||||
"@types/node": "20.5.4",
|
||||
"@types/pangu": "4.0.0",
|
||||
"@types/prismjs": "1.26.0",
|
||||
"@types/react": "18.2.21",
|
||||
|
||||
Generated
+40
-59
@@ -183,8 +183,8 @@ dependencies:
|
||||
specifier: 0.16.8
|
||||
version: 0.16.8
|
||||
langchain:
|
||||
specifier: 0.0.132
|
||||
version: 0.0.132(cheerio@1.0.0-rc.12)(ioredis@5.3.2)(jsdom@22.1.0)
|
||||
specifier: 0.0.133
|
||||
version: 0.0.133(cheerio@1.0.0-rc.12)(ioredis@5.3.2)(jsdom@22.1.0)
|
||||
lottie-react:
|
||||
specifier: 2.4.0
|
||||
version: 2.4.0(react-dom@18.2.0)(react@18.2.0)
|
||||
@@ -368,18 +368,15 @@ dependencies:
|
||||
unist-util-visit:
|
||||
specifier: 5.0.0
|
||||
version: 5.0.0
|
||||
use-onclickoutside:
|
||||
specifier: 0.4.1
|
||||
version: 0.4.1(@types/react@18.2.21)(react@18.2.0)
|
||||
uuid:
|
||||
specifier: 9.0.0
|
||||
version: 9.0.0
|
||||
viem:
|
||||
specifier: 1.6.7
|
||||
version: 1.6.7(typescript@5.1.6)(zod@3.22.2)
|
||||
specifier: 1.7.0
|
||||
version: 1.7.0(typescript@5.1.6)(zod@3.22.2)
|
||||
wagmi:
|
||||
specifier: 1.3.10
|
||||
version: 1.3.10(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.1.6)(viem@1.6.7)(zod@3.22.2)
|
||||
version: 1.3.10(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.1.6)(viem@1.7.0)(zod@3.22.2)
|
||||
zustand:
|
||||
specifier: 4.4.1
|
||||
version: 4.4.1(@types/react@18.2.21)(immer@10.0.2)(react@18.2.0)
|
||||
@@ -422,8 +419,8 @@ devDependencies:
|
||||
specifier: 4.7.1
|
||||
version: 4.7.1
|
||||
'@types/node':
|
||||
specifier: 20.5.3
|
||||
version: 20.5.3
|
||||
specifier: 20.5.4
|
||||
version: 20.5.4
|
||||
'@types/pangu':
|
||||
specifier: 4.0.0
|
||||
version: 4.0.0
|
||||
@@ -1116,8 +1113,8 @@ packages:
|
||||
'@mantine/hooks': 6.0.19(react@18.2.0)
|
||||
'@mantine/notifications': 6.0.19(@mantine/core@6.0.19)(@mantine/hooks@6.0.19)(react-dom@18.2.0)(react@18.2.0)
|
||||
'@tanstack/react-query': 4.33.0(react-dom@18.2.0)(react@18.2.0)
|
||||
'@wagmi/connectors': 2.7.0(@wagmi/chains@1.7.0)(react@18.2.0)(typescript@5.1.6)(viem@1.6.7)(zod@3.22.2)
|
||||
'@web3modal/ethereum': 2.7.1(@wagmi/core@1.3.9)(viem@1.6.7)
|
||||
'@wagmi/connectors': 2.7.0(@wagmi/chains@1.7.0)(react@18.2.0)(typescript@5.1.6)(viem@1.7.0)(zod@3.22.2)
|
||||
'@web3modal/ethereum': 2.7.1(@wagmi/core@1.3.9)(viem@1.7.0)
|
||||
canvas-confetti: 1.6.0
|
||||
check-password-strength: 2.0.7
|
||||
classnames: 2.3.2
|
||||
@@ -1133,8 +1130,8 @@ packages:
|
||||
react-google-recaptcha: 3.1.0(react@18.2.0)
|
||||
rxjs: 7.8.1
|
||||
ts-essentials: 9.3.2(typescript@5.1.6)
|
||||
viem: 1.6.7(typescript@5.1.6)(zod@3.22.2)
|
||||
wagmi: 1.3.10(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.1.6)(viem@1.6.7)(zod@3.22.2)
|
||||
viem: 1.7.0(typescript@5.1.6)(zod@3.22.2)
|
||||
wagmi: 1.3.10(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.1.6)(viem@1.7.0)(zod@3.22.2)
|
||||
zustand: 4.4.1(@types/react@18.2.21)(immer@10.0.2)(react@18.2.0)
|
||||
transitivePeerDependencies:
|
||||
- '@react-native-async-storage/async-storage'
|
||||
@@ -1160,7 +1157,7 @@ packages:
|
||||
'@crossbell/util-hooks': 1.5.11(react-dom@18.2.0)(react@18.2.0)(typescript@5.1.6)(zod@3.22.2)
|
||||
crossbell: 1.6.1(typescript@5.1.6)(zod@3.22.2)
|
||||
react: 18.2.0
|
||||
viem: 1.6.7(typescript@5.1.6)(zod@3.22.2)
|
||||
viem: 1.7.0(typescript@5.1.6)(zod@3.22.2)
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- react-dom
|
||||
@@ -1178,7 +1175,7 @@ packages:
|
||||
dayjs: 1.11.9
|
||||
lodash.compact: 3.0.1
|
||||
lru-cache: 10.0.1
|
||||
viem: 1.6.7(typescript@5.1.6)(zod@3.22.2)
|
||||
viem: 1.7.0(typescript@5.1.6)(zod@3.22.2)
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- react
|
||||
@@ -1210,8 +1207,8 @@ packages:
|
||||
dayjs: 1.11.9
|
||||
react: 18.2.0
|
||||
react-intersection-observer: 9.5.2(react@18.2.0)
|
||||
viem: 1.6.7(typescript@5.1.6)(zod@3.22.2)
|
||||
wagmi: 1.3.10(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.1.6)(viem@1.6.7)(zod@3.22.2)
|
||||
viem: 1.7.0(typescript@5.1.6)(zod@3.22.2)
|
||||
wagmi: 1.3.10(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.1.6)(viem@1.7.0)(zod@3.22.2)
|
||||
zustand: 4.4.1(@types/react@18.2.21)(immer@10.0.2)(react@18.2.0)
|
||||
transitivePeerDependencies:
|
||||
- '@types/react'
|
||||
@@ -1242,7 +1239,7 @@ packages:
|
||||
react: 18.2.0
|
||||
rxjs: 7.8.1
|
||||
ts-essentials: 9.3.2(typescript@5.1.6)
|
||||
viem: 1.6.7(typescript@5.1.6)(zod@3.22.2)
|
||||
viem: 1.7.0(typescript@5.1.6)(zod@3.22.2)
|
||||
zustand: 4.4.1(@types/react@18.2.21)(immer@10.0.2)(react@18.2.0)
|
||||
transitivePeerDependencies:
|
||||
- '@types/react'
|
||||
@@ -2726,7 +2723,7 @@ packages:
|
||||
resolution: {integrity: sha512-gYw0ki/EAuV1oSyMxpqandHjnthZjYYy+YWpTAzf8BqfXM3ItcZLpjxfg+3+mXW8HIO+3jw6T9iiqEXsqHaMMw==}
|
||||
dependencies:
|
||||
'@safe-global/safe-gateway-typescript-sdk': 3.7.3
|
||||
viem: 1.6.7(typescript@5.1.6)(zod@3.22.2)
|
||||
viem: 1.7.0(typescript@5.1.6)(zod@3.22.2)
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- encoding
|
||||
@@ -3037,7 +3034,7 @@ packages:
|
||||
/@types/connect@3.4.35:
|
||||
resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==}
|
||||
dependencies:
|
||||
'@types/node': 20.5.3
|
||||
'@types/node': 20.5.4
|
||||
dev: false
|
||||
|
||||
/@types/cookie@0.5.1:
|
||||
@@ -3150,7 +3147,7 @@ packages:
|
||||
/@types/node-fetch@2.6.4:
|
||||
resolution: {integrity: sha512-1ZX9fcN4Rvkvgv4E6PAY5WXUFWFcRWxZa3EW83UjycOB9ljJCedb2CupIP4RZMEwF/M3eTcCihbBRgwtGbg5Rg==}
|
||||
dependencies:
|
||||
'@types/node': 20.5.3
|
||||
'@types/node': 20.5.4
|
||||
form-data: 3.0.1
|
||||
dev: false
|
||||
|
||||
@@ -3162,8 +3159,8 @@ packages:
|
||||
resolution: {integrity: sha512-Av/7MqX/iNKwT9Tr60V85NqMnsmh8ilfJoBlIVibkXfitk9Q22D9Y5mSpm+FvG5DET7EbVfB40bOiLzKgYFgPw==}
|
||||
dev: false
|
||||
|
||||
/@types/node@20.5.3:
|
||||
resolution: {integrity: sha512-ITI7rbWczR8a/S6qjAW7DMqxqFMjjTo61qZVWJ1ubPvbIQsL5D/TvwjYEalM8Kthpe3hTzOGrF2TGbAu2uyqeA==}
|
||||
/@types/node@20.5.4:
|
||||
resolution: {integrity: sha512-Y9vbIAoM31djQZrPYjpTLo0XlaSwOIsrlfE3LpulZeRblttsLQRFRlBAppW0LOxyT3ALj2M5vU1ucQQayQH3jA==}
|
||||
|
||||
/@types/pangu@4.0.0:
|
||||
resolution: {integrity: sha512-da3b6P7QDH41VdfF2xRE8/KgL06nX3RawfiIMAvJ/sYzLWQCQtxc+B3qWVtrIlrNlSgV/e1oG2SZYUpN6gvmhQ==}
|
||||
@@ -3248,13 +3245,13 @@ packages:
|
||||
/@types/ws@7.4.7:
|
||||
resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==}
|
||||
dependencies:
|
||||
'@types/node': 20.5.3
|
||||
'@types/node': 20.5.4
|
||||
dev: false
|
||||
|
||||
/@types/ws@8.5.5:
|
||||
resolution: {integrity: sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg==}
|
||||
dependencies:
|
||||
'@types/node': 20.5.3
|
||||
'@types/node': 20.5.4
|
||||
dev: false
|
||||
|
||||
/@typescript-eslint/parser@6.4.0(eslint@8.47.0)(typescript@5.1.6):
|
||||
@@ -3352,7 +3349,7 @@ packages:
|
||||
typescript: 5.1.6
|
||||
dev: false
|
||||
|
||||
/@wagmi/connectors@2.7.0(@wagmi/chains@1.7.0)(react@18.2.0)(typescript@5.1.6)(viem@1.6.7)(zod@3.22.2):
|
||||
/@wagmi/connectors@2.7.0(@wagmi/chains@1.7.0)(react@18.2.0)(typescript@5.1.6)(viem@1.7.0)(zod@3.22.2):
|
||||
resolution: {integrity: sha512-1KOL0HTJl5kzSC/YdKwFwiokr6poUQn1V/tcT0TpG3iH2x0lSM7FTkvCjVVY/6lKzTXrLlo9y2aE7AsOPnkvqg==}
|
||||
peerDependencies:
|
||||
'@wagmi/chains': '>=1.7.0'
|
||||
@@ -3376,7 +3373,7 @@ packages:
|
||||
abitype: 0.8.7(typescript@5.1.6)(zod@3.22.2)
|
||||
eventemitter3: 4.0.7
|
||||
typescript: 5.1.6
|
||||
viem: 1.6.7(typescript@5.1.6)(zod@3.22.2)
|
||||
viem: 1.7.0(typescript@5.1.6)(zod@3.22.2)
|
||||
transitivePeerDependencies:
|
||||
- '@react-native-async-storage/async-storage'
|
||||
- bufferutil
|
||||
@@ -3388,7 +3385,7 @@ packages:
|
||||
- zod
|
||||
dev: false
|
||||
|
||||
/@wagmi/core@1.3.9(@types/react@18.2.21)(immer@10.0.2)(react@18.2.0)(typescript@5.1.6)(viem@1.6.7)(zod@3.22.2):
|
||||
/@wagmi/core@1.3.9(@types/react@18.2.21)(immer@10.0.2)(react@18.2.0)(typescript@5.1.6)(viem@1.7.0)(zod@3.22.2):
|
||||
resolution: {integrity: sha512-SrnABCrsDvhiMCLLLyzyHnZbEumsFT/XWlJJQZeyEDcixL95R7XQwOaaoRI4MpNilCtMtu3jzN57tA5Z2iA+kw==}
|
||||
peerDependencies:
|
||||
typescript: '>=5.0.4'
|
||||
@@ -3398,11 +3395,11 @@ packages:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@wagmi/chains': 1.7.0(typescript@5.1.6)
|
||||
'@wagmi/connectors': 2.7.0(@wagmi/chains@1.7.0)(react@18.2.0)(typescript@5.1.6)(viem@1.6.7)(zod@3.22.2)
|
||||
'@wagmi/connectors': 2.7.0(@wagmi/chains@1.7.0)(react@18.2.0)(typescript@5.1.6)(viem@1.7.0)(zod@3.22.2)
|
||||
abitype: 0.8.7(typescript@5.1.6)(zod@3.22.2)
|
||||
eventemitter3: 4.0.7
|
||||
typescript: 5.1.6
|
||||
viem: 1.6.7(typescript@5.1.6)(zod@3.22.2)
|
||||
viem: 1.7.0(typescript@5.1.6)(zod@3.22.2)
|
||||
zustand: 4.4.1(@types/react@18.2.21)(immer@10.0.2)(react@18.2.0)
|
||||
transitivePeerDependencies:
|
||||
- '@react-native-async-storage/async-storage'
|
||||
@@ -3790,14 +3787,14 @@ packages:
|
||||
tslib: 1.14.1
|
||||
dev: false
|
||||
|
||||
/@web3modal/ethereum@2.7.1(@wagmi/core@1.3.9)(viem@1.6.7):
|
||||
/@web3modal/ethereum@2.7.1(@wagmi/core@1.3.9)(viem@1.7.0):
|
||||
resolution: {integrity: sha512-1x3qhYh9qgtvw1MDQD4VeDf2ZOsVANKRPtUty4lF+N4L8xnAIwvNKUAMA4j6T5xSsjqUfq5Tdy5mYsNxLmsWMA==}
|
||||
peerDependencies:
|
||||
'@wagmi/core': '>=1'
|
||||
viem: '>=1'
|
||||
dependencies:
|
||||
'@wagmi/core': 1.3.9(@types/react@18.2.21)(immer@10.0.2)(react@18.2.0)(typescript@5.1.6)(viem@1.6.7)(zod@3.22.2)
|
||||
viem: 1.6.7(typescript@5.1.6)(zod@3.22.2)
|
||||
'@wagmi/core': 1.3.9(@types/react@18.2.21)(immer@10.0.2)(react@18.2.0)(typescript@5.1.6)(viem@1.7.0)(zod@3.22.2)
|
||||
viem: 1.7.0(typescript@5.1.6)(zod@3.22.2)
|
||||
dev: false
|
||||
|
||||
/@webassemblyjs/ast@1.11.6:
|
||||
@@ -4137,10 +4134,6 @@ packages:
|
||||
smoothscroll: 0.4.0
|
||||
dev: false
|
||||
|
||||
/are-passive-events-supported@1.1.1:
|
||||
resolution: {integrity: sha512-5wnvlvB/dTbfrCvJ027Y4L4gW/6Mwoy1uFSavney0YO++GU+0e/flnjiBBwH+1kh7xNCgCOGvmJC3s32joYbww==}
|
||||
dev: false
|
||||
|
||||
/arg@5.0.2:
|
||||
resolution: {integrity: sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==}
|
||||
|
||||
@@ -4917,7 +4910,7 @@ packages:
|
||||
eip1193-types: 0.2.1
|
||||
exponential-backoff: 3.1.1
|
||||
p-limit: 3.1.0
|
||||
viem: 1.6.7(typescript@5.1.6)(zod@3.22.2)
|
||||
viem: 1.7.0(typescript@5.1.6)(zod@3.22.2)
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- typescript
|
||||
@@ -7503,7 +7496,7 @@ packages:
|
||||
resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==}
|
||||
engines: {node: '>= 10.13.0'}
|
||||
dependencies:
|
||||
'@types/node': 20.5.3
|
||||
'@types/node': 20.5.4
|
||||
merge-stream: 2.0.0
|
||||
supports-color: 8.1.1
|
||||
dev: true
|
||||
@@ -7692,8 +7685,8 @@ packages:
|
||||
engines: {node: '>=6'}
|
||||
dev: false
|
||||
|
||||
/langchain@0.0.132(cheerio@1.0.0-rc.12)(ioredis@5.3.2)(jsdom@22.1.0):
|
||||
resolution: {integrity: sha512-gXnuiAhsQQqXheKQiaSmFa9s3S/Yhkkb9OCytu04OE0ecttvVvfjjqIoNVS9vor8V7kRUgYPKHJsMz2UFDoJNw==}
|
||||
/langchain@0.0.133(cheerio@1.0.0-rc.12)(ioredis@5.3.2)(jsdom@22.1.0):
|
||||
resolution: {integrity: sha512-AVieepmeOso+32+bdGPX02qpHRh3Eff7r+gVe6GkR8KyMsl+FW7JFvXLhBTpO5pdzFQoNL/UtCBQkvHxEdmW3Q==}
|
||||
engines: {node: '>=18'}
|
||||
peerDependencies:
|
||||
'@aws-crypto/sha256-js': ^5.0.0
|
||||
@@ -11456,18 +11449,6 @@ packages:
|
||||
use-isomorphic-layout-effect: 1.1.2(@types/react@18.2.21)(react@18.2.0)
|
||||
dev: false
|
||||
|
||||
/use-onclickoutside@0.4.1(@types/react@18.2.21)(react@18.2.0):
|
||||
resolution: {integrity: sha512-hAo1viJ9D2mPffUig4EWCwE4as7fq84HANk3MCkY3rhXk5oMl0mjLCLF/OhzWIhTaITcAcDDcnaxRdMHPq+sww==}
|
||||
peerDependencies:
|
||||
react: ^16.8.0 || ^17.0.0 || ^18.0.0
|
||||
dependencies:
|
||||
are-passive-events-supported: 1.1.1
|
||||
react: 18.2.0
|
||||
use-latest: 1.2.1(@types/react@18.2.21)(react@18.2.0)
|
||||
transitivePeerDependencies:
|
||||
- '@types/react'
|
||||
dev: false
|
||||
|
||||
/use-sidecar@1.1.2(@types/react@18.2.21)(react@18.2.0):
|
||||
resolution: {integrity: sha512-epTbsLuzZ7lPClpz2TyryBfztm7m+28DlEv2ZCQ3MDr5ssiwyOwGH/e5F9CkfWjJ1t4clvI58yF822/GUkjjhw==}
|
||||
engines: {node: '>=10'}
|
||||
@@ -11598,8 +11579,8 @@ packages:
|
||||
vfile-message: 4.0.2
|
||||
dev: false
|
||||
|
||||
/viem@1.6.7(typescript@5.1.6)(zod@3.22.2):
|
||||
resolution: {integrity: sha512-w2OMJqKcQrzPQnmMFxe4ex+md8wSwfle6L3LvEi25CBvDKhkuljVrsWY19UzG05ssQhiZ+cdxU3YMBrX817Qiw==}
|
||||
/viem@1.7.0(typescript@5.1.6)(zod@3.22.2):
|
||||
resolution: {integrity: sha512-S4SclYe0Oca6TuPh2YPI3BzfC7a4UvN7TRDCWwpoVNnu9+4z2hqCZhW+6aF1yufgSwdezNsF14vztE/P4eMdBw==}
|
||||
peerDependencies:
|
||||
typescript: '>=5.0.4'
|
||||
peerDependenciesMeta:
|
||||
@@ -11647,7 +11628,7 @@ packages:
|
||||
xml-name-validator: 4.0.0
|
||||
dev: false
|
||||
|
||||
/wagmi@1.3.10(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.1.6)(viem@1.6.7)(zod@3.22.2):
|
||||
/wagmi@1.3.10(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.1.6)(viem@1.7.0)(zod@3.22.2):
|
||||
resolution: {integrity: sha512-MMGJcnxOmeUZWDmzUxgRGcB1cqxbJoSFSa+pNY4vBCWMz0n4ptpE5F8FKISLCx+BGoDwsaz2ldcMALcdJZ+29w==}
|
||||
peerDependencies:
|
||||
react: '>=17.0.0'
|
||||
@@ -11660,12 +11641,12 @@ packages:
|
||||
'@tanstack/query-sync-storage-persister': 4.29.25
|
||||
'@tanstack/react-query': 4.33.0(react-dom@18.2.0)(react@18.2.0)
|
||||
'@tanstack/react-query-persist-client': 4.29.25(@tanstack/react-query@4.33.0)
|
||||
'@wagmi/core': 1.3.9(@types/react@18.2.21)(immer@10.0.2)(react@18.2.0)(typescript@5.1.6)(viem@1.6.7)(zod@3.22.2)
|
||||
'@wagmi/core': 1.3.9(@types/react@18.2.21)(immer@10.0.2)(react@18.2.0)(typescript@5.1.6)(viem@1.7.0)(zod@3.22.2)
|
||||
abitype: 0.8.7(typescript@5.1.6)(zod@3.22.2)
|
||||
react: 18.2.0
|
||||
typescript: 5.1.6
|
||||
use-sync-external-store: 1.2.0(react@18.2.0)
|
||||
viem: 1.6.7(typescript@5.1.6)(zod@3.22.2)
|
||||
viem: 1.7.0(typescript@5.1.6)(zod@3.22.2)
|
||||
transitivePeerDependencies:
|
||||
- '@react-native-async-storage/async-storage'
|
||||
- '@types/react'
|
||||
|
||||
@@ -9,6 +9,7 @@ import PostMeta from "~/components/site/PostMeta"
|
||||
import { SiteHeader } from "~/components/site/SiteHeader"
|
||||
import { getTranslation } from "~/lib/i18n"
|
||||
import { toCid } from "~/lib/ipfs-parser"
|
||||
import { isOnlyContent } from "~/lib/is-only-content"
|
||||
import getQueryClient from "~/lib/query-client"
|
||||
import { cn } from "~/lib/utils"
|
||||
import { fetchGetPage, getSummary } from "~/queries/page.server"
|
||||
@@ -53,6 +54,7 @@ export default async function SiteModal({
|
||||
lang: i18n.resolvedLanguage,
|
||||
})
|
||||
}
|
||||
const onlyContent = isOnlyContent()
|
||||
|
||||
return (
|
||||
<PostModal handle={site?.handle}>
|
||||
@@ -97,6 +99,7 @@ export default async function SiteModal({
|
||||
page={page}
|
||||
site={site}
|
||||
withActions={false}
|
||||
onlyContent={onlyContent}
|
||||
/>
|
||||
</article>
|
||||
<Hydrate state={dehydratedState}>
|
||||
|
||||
@@ -10,12 +10,12 @@ import { useQueryClient } from "@tanstack/react-query"
|
||||
|
||||
import { DashboardMain } from "~/components/dashboard/DashboardMain"
|
||||
import { PublishButton } from "~/components/dashboard/PublishButton"
|
||||
import PublishedModal from "~/components/dashboard/PublishedModal"
|
||||
import { Button } from "~/components/ui/Button"
|
||||
import { FieldLabel } from "~/components/ui/FieldLabel"
|
||||
import { ImageUploader } from "~/components/ui/ImageUploader"
|
||||
import { Input } from "~/components/ui/Input"
|
||||
import { ModalContentProps, useModalStack } from "~/components/ui/ModalStack"
|
||||
import { UniLink } from "~/components/ui/UniLink"
|
||||
import { useModalStack } from "~/components/ui/ModalStack"
|
||||
import { initialEditorState, useEditorState } from "~/hooks/useEditorState"
|
||||
import { useBeforeMounted } from "~/hooks/useSyncOnce"
|
||||
import { showConfetti } from "~/lib/confetti"
|
||||
@@ -226,61 +226,56 @@ export default function PortfolioEditor() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<DashboardMain fullWidth>
|
||||
<div className="min-w-[270px] max-w-screen-lg flex flex-col space-y-8">
|
||||
{page.isLoading ? (
|
||||
<div className="flex justify-center items-center min-h-[300px]">
|
||||
{t("Loading")}...
|
||||
<DashboardMain className="max-w-screen-lg" title="Edit portfolio">
|
||||
{page.isLoading ? (
|
||||
<div className="flex justify-center items-center min-h-[300px]">
|
||||
{t("Loading")}...
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<EditorExtraProperties />
|
||||
<div className="flex justify-between h-14 items-center text-sm mt-8">
|
||||
<div className="flex items-center space-x-3 flex-shrink-0">
|
||||
<PublishButton
|
||||
savePage={savePage}
|
||||
deletePage={deletePage}
|
||||
twitterShareUrl={
|
||||
page.data && site.data
|
||||
? getTwitterShareUrl({
|
||||
page: page.data,
|
||||
site: site.data,
|
||||
t,
|
||||
})
|
||||
: ""
|
||||
}
|
||||
published={visibility !== PageVisibilityEnum.Draft}
|
||||
isSaving={
|
||||
createPage.isLoading ||
|
||||
updatePage.isLoading ||
|
||||
deleteP.isLoading
|
||||
}
|
||||
isDisabled={false}
|
||||
type={type}
|
||||
isModified={visibility === PageVisibilityEnum.Modified}
|
||||
discardChanges={discardChanges}
|
||||
placement="top-start"
|
||||
/>
|
||||
<span
|
||||
className={cn(
|
||||
`text-sm capitalize`,
|
||||
visibility === PageVisibilityEnum.Draft
|
||||
? `text-zinc-300`
|
||||
: visibility === PageVisibilityEnum.Modified
|
||||
? "text-orange-600"
|
||||
: "text-green-600",
|
||||
)}
|
||||
>
|
||||
{t(visibility as string)}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<div className={`pt-10 flex w-full min-w-[840px] px-5`}>
|
||||
<EditorExtraProperties />
|
||||
</div>
|
||||
<div
|
||||
className={`flex justify-between px-5 h-14 items-center text-sm`}
|
||||
>
|
||||
<div className="flex items-center space-x-3 flex-shrink-0">
|
||||
<PublishButton
|
||||
savePage={savePage}
|
||||
deletePage={deletePage}
|
||||
twitterShareUrl={
|
||||
page.data && site.data
|
||||
? getTwitterShareUrl({
|
||||
page: page.data,
|
||||
site: site.data,
|
||||
t,
|
||||
})
|
||||
: ""
|
||||
}
|
||||
published={visibility !== PageVisibilityEnum.Draft}
|
||||
isSaving={
|
||||
createPage.isLoading ||
|
||||
updatePage.isLoading ||
|
||||
deleteP.isLoading
|
||||
}
|
||||
isDisabled={false}
|
||||
type={type}
|
||||
isModified={visibility === PageVisibilityEnum.Modified}
|
||||
discardChanges={discardChanges}
|
||||
/>
|
||||
<span
|
||||
className={cn(
|
||||
`text-sm capitalize`,
|
||||
visibility === PageVisibilityEnum.Draft
|
||||
? `text-zinc-300`
|
||||
: visibility === PageVisibilityEnum.Modified
|
||||
? "text-orange-600"
|
||||
: "text-green-600",
|
||||
)}
|
||||
>
|
||||
{t(visibility as string)}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</DashboardMain>
|
||||
</>
|
||||
)
|
||||
@@ -438,33 +433,3 @@ const EditorExtraProperties = memo(() => {
|
||||
})
|
||||
|
||||
EditorExtraProperties.displayName = "EditorExtraProperties"
|
||||
|
||||
const PublishedModal = ({
|
||||
dismiss,
|
||||
transactionUrl,
|
||||
}: ModalContentProps<{
|
||||
transactionUrl: string
|
||||
}>) => {
|
||||
const { t } = useTranslation("dashboard")
|
||||
return (
|
||||
<>
|
||||
<div className="p-5">
|
||||
{t(
|
||||
"Your post has been securely stored on the blockchain. Now you may want to",
|
||||
)}
|
||||
<ul className="list-disc pl-5 mt-2 space-y-1">
|
||||
<li>
|
||||
<UniLink className="text-accent" href={transactionUrl}>
|
||||
{t("View the transaction")}
|
||||
</UniLink>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div className="h-16 border-t flex items-center px-5">
|
||||
<Button isBlock onClick={() => dismiss()}>
|
||||
{t("Got it, thanks!")}
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,20 +1,8 @@
|
||||
"use client"
|
||||
|
||||
import { useDebounceEffect } from "ahooks"
|
||||
import type { Root } from "mdast"
|
||||
import { nanoid } from "nanoid"
|
||||
import dynamic from "next/dynamic"
|
||||
import { useParams, useRouter, useSearchParams } from "next/navigation"
|
||||
import {
|
||||
ChangeEvent,
|
||||
FC,
|
||||
memo,
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
} from "react"
|
||||
import { ChangeEvent, FC, memo, useCallback, useEffect, useState } from "react"
|
||||
import toast from "react-hot-toast"
|
||||
import { shallow } from "zustand/shallow"
|
||||
|
||||
@@ -23,19 +11,20 @@ import { DateInput } from "@mantine/dates"
|
||||
import { useQueryClient } from "@tanstack/react-query"
|
||||
|
||||
import { DashboardMain } from "~/components/dashboard/DashboardMain"
|
||||
import DualColumnEditor from "~/components/dashboard/DualColumnEditor"
|
||||
import { OptionsButton } from "~/components/dashboard/OptionsButton"
|
||||
import { PublishButton } from "~/components/dashboard/PublishButton"
|
||||
import PublishedModal from "~/components/dashboard/PublishedModal"
|
||||
import { Button } from "~/components/ui/Button"
|
||||
import { EditorToolbar } from "~/components/ui/EditorToolbar"
|
||||
import { FieldLabel } from "~/components/ui/FieldLabel"
|
||||
import { ImageUploader } from "~/components/ui/ImageUploader"
|
||||
import { Input } from "~/components/ui/Input"
|
||||
import { ModalContentProps, useModalStack } from "~/components/ui/ModalStack"
|
||||
import { useModalStack } from "~/components/ui/ModalStack"
|
||||
import { Switch } from "~/components/ui/Switch"
|
||||
import { TagInput } from "~/components/ui/TagInput"
|
||||
import { UniLink } from "~/components/ui/UniLink"
|
||||
import { toolbarShortcuts, toolbars } from "~/editor"
|
||||
import { editorUpload } from "~/editor/Multimedia"
|
||||
import { toolbars } from "~/editor"
|
||||
import {
|
||||
Values,
|
||||
initialEditorState,
|
||||
@@ -44,7 +33,6 @@ import {
|
||||
import { useGetState } from "~/hooks/useGetState"
|
||||
import { useIsMobileLayout } from "~/hooks/useMobileLayout"
|
||||
import { useBeforeMounted } from "~/hooks/useSyncOnce"
|
||||
import { useUploadFile } from "~/hooks/useUploadFile"
|
||||
import { showConfetti } from "~/lib/confetti"
|
||||
import { RESERVED_TAGS } from "~/lib/constants"
|
||||
import { getDefaultSlug } from "~/lib/default-slug"
|
||||
@@ -55,7 +43,6 @@ import { getPageVisibility } from "~/lib/page-helpers"
|
||||
import { delStorage, setStorage } from "~/lib/storage"
|
||||
import { ExpandedNote, NoteType, PageVisibilityEnum } from "~/lib/types"
|
||||
import { cn, pick } from "~/lib/utils"
|
||||
import { Rendered, renderPageContent } from "~/markdown"
|
||||
import { checkPageSlug } from "~/models/page.model"
|
||||
import {
|
||||
useCreatePage,
|
||||
@@ -66,30 +53,6 @@ import {
|
||||
} from "~/queries/page"
|
||||
import { useGetSite } from "~/queries/site"
|
||||
|
||||
const DynamicCodeMirrorEditor = dynamic(
|
||||
() => import("~/components/ui/CodeMirror"),
|
||||
{
|
||||
ssr: false,
|
||||
loading: () => (
|
||||
<div className="flex-1 h-12 flex items-center justify-center">
|
||||
Loading...
|
||||
</div>
|
||||
),
|
||||
},
|
||||
)
|
||||
|
||||
const DynamicPageContent = dynamic(
|
||||
() => import("~/components/common/PageContent"),
|
||||
{
|
||||
ssr: false,
|
||||
loading: () => (
|
||||
<div className="flex-1 h-12 flex items-center justify-center">
|
||||
Loading...
|
||||
</div>
|
||||
),
|
||||
},
|
||||
)
|
||||
|
||||
export default function PostEditor() {
|
||||
const router = useRouter()
|
||||
const queryClient = useQueryClient()
|
||||
@@ -159,8 +122,6 @@ export default function PostEditor() {
|
||||
}
|
||||
}, [page.isSuccess, page.data])
|
||||
|
||||
const uploadFile = useUploadFile()
|
||||
|
||||
// reset editor state when page changes
|
||||
useBeforeMounted(() => {
|
||||
useEditorState.setState({
|
||||
@@ -391,27 +352,7 @@ export default function PostEditor() {
|
||||
)
|
||||
}, [page.data, subdomain, draftKey, site.data?.characterId])
|
||||
|
||||
const [currentScrollArea, setCurrentScrollArea] = useState<string>("")
|
||||
const [view, setView] = useState<EditorView>()
|
||||
const [tree, setTree] = useState<Root | null>()
|
||||
|
||||
// preview
|
||||
|
||||
const [parsedContent, setParsedContent] = useState<Rendered | undefined>()
|
||||
|
||||
useDebounceEffect(
|
||||
() => {
|
||||
const result = renderPageContent(values.content)
|
||||
setTree(result.tree)
|
||||
setParsedContent(result)
|
||||
},
|
||||
[values.content],
|
||||
{
|
||||
wait: 500,
|
||||
},
|
||||
)
|
||||
|
||||
const previewRef = useRef<HTMLDivElement>(null)
|
||||
|
||||
// editor
|
||||
const onCreateEditor = useCallback(
|
||||
@@ -428,115 +369,6 @@ export default function PostEditor() {
|
||||
[updateValue],
|
||||
)
|
||||
|
||||
const handleDropFile = useCallback(
|
||||
async (file: File) => {
|
||||
if (view) {
|
||||
editorUpload(file, view)
|
||||
}
|
||||
},
|
||||
[uploadFile, view],
|
||||
)
|
||||
|
||||
const computedPosition = useCallback(() => {
|
||||
let previewChildNodes = previewRef.current?.childNodes[0]?.childNodes
|
||||
const editorElementList: number[] = []
|
||||
const previewElementList: number[] = []
|
||||
if (view?.state && previewChildNodes) {
|
||||
tree?.children.forEach((child, index) => {
|
||||
if (
|
||||
child.position &&
|
||||
previewChildNodes?.[index] &&
|
||||
(child as any).tagName !== "style"
|
||||
) {
|
||||
if (child.position.start.line > view.state.doc.lines) return
|
||||
const line = view.state?.doc.line(child.position.start.line)
|
||||
const block = view.lineBlockAt(line.from)
|
||||
if (block) {
|
||||
editorElementList.push(block.top)
|
||||
previewElementList.push(
|
||||
(previewChildNodes[index] as HTMLElement).offsetTop,
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
return {
|
||||
editorElementList,
|
||||
previewElementList,
|
||||
}
|
||||
}, [view, tree])
|
||||
|
||||
const onScroll = useCallback(
|
||||
(scrollTop: number, area: string) => {
|
||||
if (
|
||||
currentScrollArea === area &&
|
||||
previewRef.current?.parentElement &&
|
||||
view
|
||||
) {
|
||||
const position = computedPosition()
|
||||
|
||||
let selfElement
|
||||
let selfPosition
|
||||
let targetElement
|
||||
let targetPosition
|
||||
if (area === "preview") {
|
||||
selfElement = previewRef.current.parentElement
|
||||
selfPosition = position.previewElementList
|
||||
targetElement = view.scrollDOM
|
||||
targetPosition = position.editorElementList
|
||||
} else {
|
||||
selfElement = view.scrollDOM
|
||||
selfPosition = position.editorElementList
|
||||
targetElement = previewRef.current.parentElement
|
||||
targetPosition = position.previewElementList
|
||||
}
|
||||
|
||||
let scrollElementIndex = 0
|
||||
for (let i = 0; i < selfPosition.length; i++) {
|
||||
if (scrollTop < selfPosition[i]) {
|
||||
scrollElementIndex = i - 1
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// scroll to bottom
|
||||
if (scrollTop >= selfElement.scrollHeight - selfElement.clientHeight) {
|
||||
targetElement.scrollTop =
|
||||
targetElement.scrollHeight - targetElement.clientHeight
|
||||
return
|
||||
}
|
||||
|
||||
// scroll to position
|
||||
if (scrollElementIndex >= 0) {
|
||||
let ratio =
|
||||
(scrollTop - selfPosition[scrollElementIndex]) /
|
||||
(selfPosition[scrollElementIndex + 1] -
|
||||
selfPosition[scrollElementIndex])
|
||||
targetElement.scrollTop =
|
||||
ratio *
|
||||
(targetPosition[scrollElementIndex + 1] -
|
||||
targetPosition[scrollElementIndex]) +
|
||||
targetPosition[scrollElementIndex]
|
||||
}
|
||||
}
|
||||
},
|
||||
[view, computedPosition, currentScrollArea],
|
||||
)
|
||||
|
||||
const onEditorScroll = useCallback(
|
||||
(scrollTop: number) => {
|
||||
onScroll(scrollTop, "editor")
|
||||
},
|
||||
[onScroll],
|
||||
)
|
||||
|
||||
const onPreviewScroll = useCallback(
|
||||
(scrollTop: number) => {
|
||||
onScroll(scrollTop, "preview")
|
||||
},
|
||||
[onScroll],
|
||||
)
|
||||
|
||||
const onPreviewButtonClick = useCallback(() => {
|
||||
window.open(
|
||||
`/site/${subdomain}/preview/${draftKey.replace(
|
||||
@@ -567,18 +399,6 @@ export default function PostEditor() {
|
||||
}
|
||||
}, [draftKey, site.data?.characterId])
|
||||
|
||||
const cmStyle = useMemo(
|
||||
() => ({
|
||||
".cm-scroller": {
|
||||
padding: "0 1.25rem",
|
||||
},
|
||||
".cm-content": {
|
||||
paddingBottom: "600px",
|
||||
},
|
||||
}),
|
||||
[],
|
||||
)
|
||||
|
||||
return (
|
||||
<>
|
||||
<DashboardMain fullWidth>
|
||||
@@ -685,52 +505,12 @@ export default function PostEditor() {
|
||||
placeholder={t("Title goes here...") || ""}
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-5 flex-1 min-h-0 flex relative items-center">
|
||||
{!(isMobileLayout && isRendering) && (
|
||||
<DynamicCodeMirrorEditor
|
||||
value={initialContent}
|
||||
placeholder={t("Start writing...") as string}
|
||||
onChange={onChange}
|
||||
handleDropFile={handleDropFile}
|
||||
onScroll={onEditorScroll}
|
||||
cmStyle={cmStyle}
|
||||
onCreateEditor={onCreateEditor}
|
||||
onMouseEnter={() => {
|
||||
setCurrentScrollArea("editor")
|
||||
}}
|
||||
className={cn(
|
||||
"h-full flex-1",
|
||||
isRendering ? "border-r" : "",
|
||||
)}
|
||||
shortcuts={toolbarShortcuts}
|
||||
/>
|
||||
)}
|
||||
{!isMobileLayout && (
|
||||
<div className="z-10 w-[1px]">
|
||||
<div
|
||||
aria-label="Toggle preview view"
|
||||
className="bg-accent rounded-full cursor-pointer text-white w-6 h-6 -translate-x-1/2"
|
||||
onClick={() => setIsRendering(!isRendering)}
|
||||
>
|
||||
{isRendering ? (
|
||||
<i className="icon-[mingcute--right-line] text-2xl inline-block w-6 h-6" />
|
||||
) : (
|
||||
<i className="icon-[mingcute--left-line] text-2xl inline-block w-6 h-6" />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{isRendering && (
|
||||
<DynamicPageContent
|
||||
className="bg-white px-5 overflow-scroll pb-[200px] h-full flex-1"
|
||||
parsedContent={parsedContent}
|
||||
inputRef={previewRef}
|
||||
onScroll={onPreviewScroll}
|
||||
onMouseEnter={() => {
|
||||
setCurrentScrollArea("preview")
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<div className="mt-5 flex-1 min-h-0">
|
||||
<DualColumnEditor
|
||||
initialContent={initialContent}
|
||||
onChange={onChange}
|
||||
onCreateEditor={onCreateEditor}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{!isMobileLayout && (
|
||||
@@ -986,47 +766,3 @@ const EditorAdvancedModal: FC<{
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const PublishedModal = ({
|
||||
dismiss,
|
||||
postUrl,
|
||||
transactionUrl,
|
||||
twitterShareUrl,
|
||||
}: ModalContentProps<{
|
||||
postUrl: string
|
||||
transactionUrl: string
|
||||
twitterShareUrl: string
|
||||
}>) => {
|
||||
const { t } = useTranslation("dashboard")
|
||||
return (
|
||||
<>
|
||||
<div className="p-5">
|
||||
{t(
|
||||
"Your post has been securely stored on the blockchain. Now you may want to",
|
||||
)}
|
||||
<ul className="list-disc pl-5 mt-2 space-y-1">
|
||||
<li>
|
||||
<UniLink className="text-accent" href={postUrl}>
|
||||
{t("View the post")}
|
||||
</UniLink>
|
||||
</li>
|
||||
<li>
|
||||
<UniLink className="text-accent" href={transactionUrl}>
|
||||
{t("View the transaction")}
|
||||
</UniLink>
|
||||
</li>
|
||||
<li>
|
||||
<UniLink className="text-accent" href={twitterShareUrl}>
|
||||
{t("Share to Twitter")}
|
||||
</UniLink>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div className="h-16 border-t flex items-center px-5">
|
||||
<Button isBlock onClick={() => dismiss()}>
|
||||
{t("Got it, thanks!")}
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import { getSiteLink } from "~/lib/helpers"
|
||||
import { getTranslation } from "~/lib/i18n"
|
||||
import { toCid, toGateway } from "~/lib/ipfs-parser"
|
||||
import { isInRN } from "~/lib/is-in-rn"
|
||||
import { isOnlyContent } from "~/lib/is-only-client"
|
||||
import { isOnlyContent } from "~/lib/is-only-content"
|
||||
import getQueryClient from "~/lib/query-client"
|
||||
import { fetchGetPage, getSummary } from "~/queries/page.server"
|
||||
import { fetchGetSite } from "~/queries/site.server"
|
||||
@@ -103,7 +103,7 @@ export default async function SitePagePage({
|
||||
}
|
||||
|
||||
const dehydratedState = dehydrate(queryClient)
|
||||
const onlyContent = await isOnlyContent()
|
||||
const onlyContent = isOnlyContent()
|
||||
|
||||
function addPageJsonLd() {
|
||||
return {
|
||||
@@ -176,6 +176,7 @@ export default async function SitePagePage({
|
||||
page={page}
|
||||
site={site}
|
||||
withActions={true}
|
||||
onlyContent={onlyContent}
|
||||
/>
|
||||
<OIAButton
|
||||
isInRN={!!inRN}
|
||||
|
||||
@@ -14,7 +14,7 @@ import { FABContainer } from "~/components/ui/FAB"
|
||||
import { SITE_URL } from "~/lib/env"
|
||||
import { getSiteLink } from "~/lib/helpers"
|
||||
import { isInRN } from "~/lib/is-in-rn"
|
||||
import { isOnlyContent, searchParser } from "~/lib/is-only-client"
|
||||
import { isOnlyContent, searchParser } from "~/lib/is-only-content"
|
||||
import getQueryClient from "~/lib/query-client"
|
||||
import { ExpandedNote } from "~/lib/types"
|
||||
import { cn } from "~/lib/utils"
|
||||
@@ -95,11 +95,11 @@ export default async function SiteLayout({
|
||||
const queryClient = getQueryClient()
|
||||
|
||||
const { inRN } = isInRN()
|
||||
const search = await searchParser()
|
||||
const search = searchParser()
|
||||
// https://github.com/vercel/next.js/issues/46618#issuecomment-1450416633
|
||||
// Issue: The type will not be updated when the page is redirected.
|
||||
let pathname = headers().get("x-xlog-pathname")
|
||||
const onlyContent = await isOnlyContent()
|
||||
const onlyContent = isOnlyContent()
|
||||
|
||||
if (!inRN && pathname && /^(\/site(?!\/.*\/preview\/).*)/.test(pathname)) {
|
||||
const targetPath = `${getSiteLink({
|
||||
|
||||
@@ -2,14 +2,13 @@ import { type MutableRefObject, memo } from "react"
|
||||
|
||||
import PostActions from "~/components/site/PostActions"
|
||||
import PostToc from "~/components/site/PostToc"
|
||||
import { isOnlyContent } from "~/lib/is-only-client"
|
||||
import { ExpandedCharacter, ExpandedNote } from "~/lib/types"
|
||||
import { cn } from "~/lib/utils"
|
||||
import { renderPageContent } from "~/markdown"
|
||||
|
||||
import { PageContentContainer } from "./PageContentContainer"
|
||||
|
||||
const PageContent = memo(async function PageContent({
|
||||
const PageContent = memo(function PageContent({
|
||||
className,
|
||||
content,
|
||||
toc,
|
||||
@@ -21,6 +20,7 @@ const PageContent = memo(async function PageContent({
|
||||
page,
|
||||
site,
|
||||
withActions,
|
||||
onlyContent,
|
||||
}: {
|
||||
content?: string
|
||||
className?: string
|
||||
@@ -33,6 +33,7 @@ const PageContent = memo(async function PageContent({
|
||||
page?: ExpandedNote
|
||||
site?: ExpandedCharacter
|
||||
withActions?: boolean
|
||||
onlyContent?: boolean
|
||||
}) {
|
||||
let inParsedContent
|
||||
if (parsedContent) {
|
||||
@@ -41,8 +42,6 @@ const PageContent = memo(async function PageContent({
|
||||
inParsedContent = renderPageContent(content, false, isComment)
|
||||
}
|
||||
|
||||
const onlyContent = await isOnlyContent()
|
||||
|
||||
return (
|
||||
<PageContentContainer
|
||||
className={cn("relative", className)}
|
||||
|
||||
@@ -19,7 +19,9 @@ export const DashboardMain = ({
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
fullWidth ? "relative" : "min-w-[270px] relative px-5 py-5 md:px-10",
|
||||
fullWidth
|
||||
? "relative"
|
||||
: "min-w-[270px] relative px-5 py-5 md:px-10 md:py-8",
|
||||
className,
|
||||
isMobileLayout ? "max-w-[100vw]" : "",
|
||||
"min-h-full flex flex-col",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Fragment, useState } from "react"
|
||||
import { Fragment } from "react"
|
||||
|
||||
import { Popover, Transition } from "@headlessui/react"
|
||||
import { Bars3Icon } from "@heroicons/react/24/outline"
|
||||
@@ -14,8 +14,6 @@ export const DashboardTopbar = ({
|
||||
userWidget: React.ReactNode
|
||||
drawerWidget: (close: any) => React.ReactNode
|
||||
}) => {
|
||||
const [isOpen, setIsOpen] = useState(false)
|
||||
|
||||
return (
|
||||
<div className="w-full top-0 h-16 bg-slate-50 z-20 transition-all flex flex-row fixed px-5 md:px-10 items-center">
|
||||
<Popover className="relative">
|
||||
@@ -32,13 +30,7 @@ export const DashboardTopbar = ({
|
||||
>
|
||||
<Popover.Overlay className="fixed inset-0 bg-black opacity-10" />
|
||||
</Transition>
|
||||
<Popover.Button
|
||||
className={`
|
||||
group inline-flex items-center rounded-md text-base font-medium hover:text-opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`}
|
||||
onClick={() => {
|
||||
setIsOpen(true)
|
||||
}}
|
||||
>
|
||||
<Popover.Button className="group inline-flex items-center rounded-md text-base font-medium hover:text-opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75">
|
||||
<Bars3Icon className="h-6 w-6" />
|
||||
</Popover.Button>
|
||||
<Transition
|
||||
|
||||
@@ -0,0 +1,264 @@
|
||||
import { useDebounceEffect } from "ahooks"
|
||||
import type { Root } from "mdast"
|
||||
import dynamic from "next/dynamic"
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react"
|
||||
|
||||
import { EditorView } from "@codemirror/view"
|
||||
|
||||
import { toolbarShortcuts } from "~/editor"
|
||||
import { editorUpload } from "~/editor/Multimedia"
|
||||
import { useIsMobileLayout } from "~/hooks/useMobileLayout"
|
||||
import { useUploadFile } from "~/hooks/useUploadFile"
|
||||
import { useTranslation } from "~/lib/i18n/client"
|
||||
import { cn } from "~/lib/utils"
|
||||
import { Rendered, renderPageContent } from "~/markdown"
|
||||
|
||||
const DynamicCodeMirrorEditor = dynamic(
|
||||
() => import("~/components/ui/CodeMirror"),
|
||||
{
|
||||
ssr: false,
|
||||
loading: () => (
|
||||
<div className="flex-1 h-12 flex items-center justify-center">
|
||||
Loading...
|
||||
</div>
|
||||
),
|
||||
},
|
||||
)
|
||||
|
||||
const DynamicPageContent = dynamic(
|
||||
() => import("~/components/common/PageContent"),
|
||||
{
|
||||
ssr: false,
|
||||
loading: () => (
|
||||
<div className="flex-1 h-12 flex items-center justify-center">
|
||||
Loading...
|
||||
</div>
|
||||
),
|
||||
},
|
||||
)
|
||||
|
||||
export default function DualColumnEditor({
|
||||
initialContent,
|
||||
onChange,
|
||||
onCreateEditor,
|
||||
}: {
|
||||
initialContent: string
|
||||
onChange: (value: string) => void
|
||||
onCreateEditor: (view: EditorView) => void
|
||||
}) {
|
||||
const isMobileLayout = useIsMobileLayout()
|
||||
const [isRendering, setIsRendering] = useState(!isMobileLayout)
|
||||
const { t } = useTranslation("dashboard")
|
||||
const uploadFile = useUploadFile()
|
||||
|
||||
const [currentScrollArea, setCurrentScrollArea] = useState<string>("")
|
||||
const [view, setView] = useState<EditorView>()
|
||||
const [tree, setTree] = useState<Root | null>()
|
||||
const [values, setValues] = useState("")
|
||||
|
||||
// preview
|
||||
const [parsedContent, setParsedContent] = useState<Rendered | undefined>()
|
||||
|
||||
useEffect(() => {
|
||||
setValues(initialContent)
|
||||
}, [initialContent])
|
||||
|
||||
useDebounceEffect(
|
||||
() => {
|
||||
const result = renderPageContent(values)
|
||||
setTree(result.tree)
|
||||
setParsedContent(result)
|
||||
},
|
||||
[values],
|
||||
{
|
||||
wait: 500,
|
||||
},
|
||||
)
|
||||
|
||||
const previewRef = useRef<HTMLDivElement>(null)
|
||||
|
||||
// editor
|
||||
const onCreateEditorInside = useCallback(
|
||||
(view: EditorView) => {
|
||||
setView?.(view)
|
||||
onCreateEditor?.(view)
|
||||
},
|
||||
[setView],
|
||||
)
|
||||
|
||||
const handleDropFile = useCallback(
|
||||
async (file: File) => {
|
||||
if (view) {
|
||||
editorUpload(file, view)
|
||||
}
|
||||
},
|
||||
[uploadFile, view],
|
||||
)
|
||||
|
||||
const computedPosition = useCallback(() => {
|
||||
let previewChildNodes = previewRef.current?.childNodes[0]?.childNodes
|
||||
const editorElementList: number[] = []
|
||||
const previewElementList: number[] = []
|
||||
if (view?.state && previewChildNodes) {
|
||||
tree?.children.forEach((child, index) => {
|
||||
if (
|
||||
child.position &&
|
||||
previewChildNodes?.[index] &&
|
||||
(child as any).tagName !== "style"
|
||||
) {
|
||||
if (child.position.start.line > view.state.doc.lines) return
|
||||
const line = view.state?.doc.line(child.position.start.line)
|
||||
const block = view.lineBlockAt(line.from)
|
||||
if (block) {
|
||||
editorElementList.push(block.top)
|
||||
previewElementList.push(
|
||||
(previewChildNodes[index] as HTMLElement).offsetTop,
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
return {
|
||||
editorElementList,
|
||||
previewElementList,
|
||||
}
|
||||
}, [view, tree])
|
||||
|
||||
const onScroll = useCallback(
|
||||
(scrollTop: number, area: string) => {
|
||||
if (
|
||||
currentScrollArea === area &&
|
||||
previewRef.current?.parentElement &&
|
||||
view
|
||||
) {
|
||||
const position = computedPosition()
|
||||
|
||||
let selfElement
|
||||
let selfPosition
|
||||
let targetElement
|
||||
let targetPosition
|
||||
if (area === "preview") {
|
||||
selfElement = previewRef.current.parentElement
|
||||
selfPosition = position.previewElementList
|
||||
targetElement = view.scrollDOM
|
||||
targetPosition = position.editorElementList
|
||||
} else {
|
||||
selfElement = view.scrollDOM
|
||||
selfPosition = position.editorElementList
|
||||
targetElement = previewRef.current.parentElement
|
||||
targetPosition = position.previewElementList
|
||||
}
|
||||
|
||||
let scrollElementIndex = 0
|
||||
for (let i = 0; i < selfPosition.length; i++) {
|
||||
if (scrollTop < selfPosition[i]) {
|
||||
scrollElementIndex = i - 1
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// scroll to bottom
|
||||
if (scrollTop >= selfElement.scrollHeight - selfElement.clientHeight) {
|
||||
targetElement.scrollTop =
|
||||
targetElement.scrollHeight - targetElement.clientHeight
|
||||
return
|
||||
}
|
||||
|
||||
// scroll to position
|
||||
if (scrollElementIndex >= 0) {
|
||||
let ratio =
|
||||
(scrollTop - selfPosition[scrollElementIndex]) /
|
||||
(selfPosition[scrollElementIndex + 1] -
|
||||
selfPosition[scrollElementIndex])
|
||||
targetElement.scrollTop =
|
||||
ratio *
|
||||
(targetPosition[scrollElementIndex + 1] -
|
||||
targetPosition[scrollElementIndex]) +
|
||||
targetPosition[scrollElementIndex]
|
||||
}
|
||||
}
|
||||
},
|
||||
[view, computedPosition, currentScrollArea],
|
||||
)
|
||||
|
||||
const onEditorScroll = useCallback(
|
||||
(scrollTop: number) => {
|
||||
onScroll(scrollTop, "editor")
|
||||
},
|
||||
[onScroll],
|
||||
)
|
||||
|
||||
const onPreviewScroll = useCallback(
|
||||
(scrollTop: number) => {
|
||||
onScroll(scrollTop, "preview")
|
||||
},
|
||||
[onScroll],
|
||||
)
|
||||
|
||||
const cmStyle = useMemo(
|
||||
() => ({
|
||||
".cm-scroller": {
|
||||
padding: "0 1.25rem",
|
||||
},
|
||||
".cm-content": {
|
||||
paddingBottom: "600px",
|
||||
},
|
||||
}),
|
||||
[],
|
||||
)
|
||||
|
||||
const onChangeInside = useCallback(
|
||||
(value: string) => {
|
||||
setValues(value)
|
||||
onChange(value)
|
||||
},
|
||||
[setValues, onChange],
|
||||
)
|
||||
|
||||
return (
|
||||
<div className="min-h-0 flex relative items-center w-full h-full">
|
||||
{!(isMobileLayout && isRendering) && (
|
||||
<DynamicCodeMirrorEditor
|
||||
value={initialContent}
|
||||
placeholder={t("Start writing...") as string}
|
||||
onChange={onChangeInside}
|
||||
handleDropFile={handleDropFile}
|
||||
onScroll={onEditorScroll}
|
||||
cmStyle={cmStyle}
|
||||
onCreateEditor={onCreateEditorInside}
|
||||
onMouseEnter={() => {
|
||||
setCurrentScrollArea("editor")
|
||||
}}
|
||||
className={cn("h-full flex-1", isRendering ? "border-r" : "")}
|
||||
shortcuts={toolbarShortcuts}
|
||||
/>
|
||||
)}
|
||||
{!isMobileLayout && (
|
||||
<div className="z-10 w-[1px]">
|
||||
<div
|
||||
aria-label="Toggle preview view"
|
||||
className="bg-accent rounded-full cursor-pointer text-white w-6 h-6 -translate-x-1/2"
|
||||
onClick={() => setIsRendering(!isRendering)}
|
||||
>
|
||||
{isRendering ? (
|
||||
<i className="icon-[mingcute--right-line] text-2xl inline-block w-6 h-6" />
|
||||
) : (
|
||||
<i className="icon-[mingcute--left-line] text-2xl inline-block w-6 h-6" />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{isRendering && (
|
||||
<DynamicPageContent
|
||||
className="bg-white px-5 overflow-scroll pb-[200px] h-full flex-1"
|
||||
parsedContent={parsedContent}
|
||||
inputRef={previewRef}
|
||||
onScroll={onPreviewScroll}
|
||||
onMouseEnter={() => {
|
||||
setCurrentScrollArea("preview")
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -225,7 +225,7 @@ export const PagesManager = ({ type }: { type: NoteType }) => {
|
||||
{t(`New ${type.charAt(0).toUpperCase() + type.slice(1)}`)}
|
||||
</span>
|
||||
</Button>
|
||||
{type !== "portfolio" && (
|
||||
{(type === "post" || type === "page") && (
|
||||
<span className="hidden sm:inline-flex">
|
||||
<Tooltip
|
||||
label={t("Import markdown file with front matter supported")}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { useEffect, useRef, useState } from "react"
|
||||
import useOnClickOutside from "use-onclickoutside"
|
||||
import { useState } from "react"
|
||||
|
||||
import { Placement } from "@floating-ui/react"
|
||||
|
||||
import { Menu } from "~/components//ui/Menu"
|
||||
import { DeleteConfirmationModal } from "~/components/common/DeleteConfirmationModal"
|
||||
import { useTranslation } from "~/lib/i18n/client"
|
||||
import { NoteType } from "~/lib/types"
|
||||
@@ -17,6 +19,7 @@ export const PublishButton = ({
|
||||
isModified,
|
||||
twitterShareUrl,
|
||||
type,
|
||||
placement = "bottom-end",
|
||||
}: {
|
||||
savePage: () => void
|
||||
deletePage: () => void
|
||||
@@ -27,23 +30,10 @@ export const PublishButton = ({
|
||||
type: NoteType
|
||||
isModified: boolean
|
||||
discardChanges: () => void
|
||||
placement?: Placement
|
||||
}) => {
|
||||
const [showDropdown, setShowDropdown] = useState(false)
|
||||
const dropdownRef = useRef<HTMLDivElement | null>(null)
|
||||
const triggerRef = useRef<HTMLButtonElement | null>(null)
|
||||
const { t } = useTranslation("dashboard")
|
||||
|
||||
useOnClickOutside(dropdownRef, (e) => {
|
||||
if (triggerRef.current?.contains(e.target as any)) return
|
||||
setShowDropdown(false)
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
if (isSaving) {
|
||||
setShowDropdown(false)
|
||||
}
|
||||
}, [isSaving])
|
||||
|
||||
const [deleteConfirmModalOpen, setDeleteConfirmModalOpen] =
|
||||
useState<boolean>(false)
|
||||
|
||||
@@ -60,26 +50,19 @@ export const PublishButton = ({
|
||||
{t(published ? "Update" : "Publish")}
|
||||
</Button>
|
||||
{published && (
|
||||
<Button
|
||||
isAutoWidth
|
||||
style={{ padding: "0 8px" }}
|
||||
onClick={() => {
|
||||
setShowDropdown(!showDropdown)
|
||||
}}
|
||||
ref={triggerRef}
|
||||
isDisabled={isSaving}
|
||||
>
|
||||
<i className="icon-[mingcute--down-line]" />
|
||||
</Button>
|
||||
)}
|
||||
</ButtonGroup>
|
||||
{showDropdown && (
|
||||
<div
|
||||
className="absolute right-0 min-w-[200px] pt-2 z-10"
|
||||
ref={dropdownRef}
|
||||
>
|
||||
<div className="bg-white py-2 rounded-lg shadow-modal">
|
||||
{published && (
|
||||
<Menu
|
||||
placement={placement}
|
||||
target={
|
||||
<Button
|
||||
isAutoWidth
|
||||
style={{ padding: "0 8px" }}
|
||||
isDisabled={isSaving}
|
||||
className="!rounded-r-full"
|
||||
>
|
||||
<i className="icon-[mingcute--down-line]" />
|
||||
</Button>
|
||||
}
|
||||
dropdown={
|
||||
<div>
|
||||
<button
|
||||
className="flex w-full h-8 hover:bg-zinc-100 items-center px-5"
|
||||
@@ -105,10 +88,10 @@ export const PublishButton = ({
|
||||
{t("Delete")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</ButtonGroup>
|
||||
<DeleteConfirmationModal
|
||||
open={deleteConfirmModalOpen}
|
||||
setOpen={setDeleteConfirmModalOpen}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
import { Button } from "~/components/ui/Button"
|
||||
import { ModalContentProps } from "~/components/ui/ModalStack"
|
||||
import { UniLink } from "~/components/ui/UniLink"
|
||||
import { useTranslation } from "~/lib/i18n/client"
|
||||
|
||||
export default function PublishedModal({
|
||||
dismiss,
|
||||
postUrl,
|
||||
transactionUrl,
|
||||
twitterShareUrl,
|
||||
}: ModalContentProps<{
|
||||
postUrl?: string
|
||||
transactionUrl: string
|
||||
twitterShareUrl?: string
|
||||
}>) {
|
||||
const { t } = useTranslation("dashboard")
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="p-5">
|
||||
{t(
|
||||
"Your publication has been securely stored on the blockchain. Now you may want to",
|
||||
)}
|
||||
<ul className="list-disc pl-5 mt-2 space-y-1">
|
||||
{postUrl && (
|
||||
<li>
|
||||
<UniLink className="text-accent" href={postUrl}>
|
||||
{t("View the post")}
|
||||
</UniLink>
|
||||
</li>
|
||||
)}
|
||||
<li>
|
||||
<UniLink className="text-accent" href={transactionUrl}>
|
||||
{t("View the transaction")}
|
||||
</UniLink>
|
||||
</li>
|
||||
{twitterShareUrl && (
|
||||
<li>
|
||||
<UniLink className="text-accent" href={twitterShareUrl}>
|
||||
{t("Share to Twitter")}
|
||||
</UniLink>
|
||||
</li>
|
||||
)}
|
||||
</ul>
|
||||
</div>
|
||||
<div className="h-16 border-t flex items-center px-5">
|
||||
<Button isBlock onClick={() => dismiss()}>
|
||||
{t("Got it, thanks!")}
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -141,7 +141,7 @@
|
||||
"More": "更多",
|
||||
"Meet New Friends": "认识新朋友",
|
||||
"Need help?": "需要帮助?",
|
||||
"Your post has been securely stored on the blockchain. Now you may want to": "你的文章已经安全地存储在区块链上。现在你可能想要",
|
||||
"Your publication has been securely stored on the blockchain. Now you may want to": "你的发布已经安全地存储在区块链上。现在你可能想要",
|
||||
"View the post": "查看文章",
|
||||
"View the transaction": "查看交易",
|
||||
"Share to Twitter": "分享到 Twitter",
|
||||
@@ -221,5 +221,6 @@
|
||||
"Interaction": "互动",
|
||||
"External Url": "外部链接",
|
||||
"Autofill": "自动填充",
|
||||
"Title": "标题"
|
||||
"Title": "标题",
|
||||
"Edit portfolio": "编辑作品"
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import { isServerSide } from "./utils"
|
||||
|
||||
export const searchParser = async () => {
|
||||
let search
|
||||
if (isServerSide()) {
|
||||
const { headers } = await import("next/headers")
|
||||
search = headers().get("x-xlog-search")
|
||||
} else {
|
||||
search = window.location.search
|
||||
}
|
||||
|
||||
return new URLSearchParams(search?.substring(1) || "")
|
||||
}
|
||||
|
||||
export const isOnlyContent = async () => {
|
||||
return (await searchParser()).get("only-content")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { headers } from "next/headers"
|
||||
|
||||
export const searchParser = () => {
|
||||
const search = headers().get("x-xlog-search")
|
||||
|
||||
return new URLSearchParams(search?.substring(1) || "")
|
||||
}
|
||||
|
||||
export const isOnlyContent = () => {
|
||||
return !!searchParser().get("only-content")
|
||||
}
|
||||
Reference in New Issue
Block a user