Merge branch 'dev'
This commit is contained in:
+10
-10
@@ -33,15 +33,15 @@
|
||||
"@codemirror/lang-markdown": "6.1.1",
|
||||
"@codemirror/language": "6.7.0",
|
||||
"@codemirror/language-data": "6.3.1",
|
||||
"@codemirror/state": "6.2.0",
|
||||
"@codemirror/state": "6.2.1",
|
||||
"@codemirror/theme-one-dark": "6.1.2",
|
||||
"@codemirror/view": "6.12.0",
|
||||
"@crossbell/connect-kit": "1.2.4",
|
||||
"@crossbell/contract": "1.2.3",
|
||||
"@crossbell/indexer": "1.2.3",
|
||||
"@crossbell/notification": "1.2.4",
|
||||
"@crossbell/ui": "1.2.3",
|
||||
"@crossbell/util-hooks": "1.2.0",
|
||||
"@crossbell/connect-kit": "1.3.1",
|
||||
"@crossbell/contract": "1.3.0",
|
||||
"@crossbell/indexer": "1.3.0",
|
||||
"@crossbell/notification": "1.3.1",
|
||||
"@crossbell/ui": "1.3.0",
|
||||
"@crossbell/util-hooks": "1.3.0",
|
||||
"@ddietr/codemirror-themes": "1.4.1",
|
||||
"@dqbd/tiktoken": "^1.0.7",
|
||||
"@emoji-mart/data": "1.1.2",
|
||||
@@ -69,7 +69,7 @@
|
||||
"canvas-confetti": "^1.6.0",
|
||||
"chroma-js": "^2.4.2",
|
||||
"clsx": "1.2.1",
|
||||
"crossbell": "^1.1.0",
|
||||
"crossbell": "^1.2.0",
|
||||
"dayjs": "1.11.7",
|
||||
"dotenv": "16.0.3",
|
||||
"emoji-mart": "5.5.2",
|
||||
@@ -149,8 +149,8 @@
|
||||
"unist-util-visit": "4.1.2",
|
||||
"use-onclickoutside": "0.4.1",
|
||||
"uuid": "9.0.0",
|
||||
"viem": "^0.3.31",
|
||||
"wagmi": "1.0.5",
|
||||
"viem": "^0.3.36",
|
||||
"wagmi": "1.0.6",
|
||||
"zustand": "^4.3.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
Generated
+1141
-1090
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 4.0 MiB |
+3
-9
@@ -1,8 +1,6 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"config:base"
|
||||
],
|
||||
"extends": ["config:base", "group:allNonMajor", "group:codemirror"],
|
||||
"lockFileMaintenance": {
|
||||
"enabled": true,
|
||||
"automerge": true
|
||||
@@ -19,10 +17,6 @@
|
||||
"automerge": true
|
||||
}
|
||||
],
|
||||
"automergeSchedule": [
|
||||
"before 2am"
|
||||
],
|
||||
"schedule": [
|
||||
"before 2am"
|
||||
]
|
||||
"automergeSchedule": ["before 2am"],
|
||||
"schedule": ["before 2am"]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
"use client"
|
||||
|
||||
import { useCallback, useEffect } from "react"
|
||||
|
||||
import { Image } from "~/components/ui/Image"
|
||||
import { useTranslation } from "~/lib/i18n/client"
|
||||
|
||||
async function OIAPage() {
|
||||
const { t } = useTranslation("site")
|
||||
|
||||
useEffect(() => {
|
||||
document.body.style.backgroundColor = "#fb9148"
|
||||
return () => {
|
||||
document.body.style.backgroundColor = ""
|
||||
}
|
||||
}, [])
|
||||
|
||||
const download = useCallback(() => {
|
||||
const result = confirm(
|
||||
t(
|
||||
"The app is currently under review, please stay tuned. Do you want to join the early access program?",
|
||||
)!,
|
||||
)
|
||||
const dcLink = "https://discord.gg/uK2yAtWw2s"
|
||||
if (result) {
|
||||
window.open(dcLink)
|
||||
}
|
||||
}, [])
|
||||
|
||||
const goBack = useCallback(() => {
|
||||
window.history.back()
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div className="relative h-screen w-screen bg-accent max-w-4xl m-auto">
|
||||
<Image
|
||||
fill
|
||||
className="object-cover absolute h-full w-full"
|
||||
src="/assets/download-preview.png"
|
||||
alt="Download Preview"
|
||||
/>
|
||||
<div className="absolute top-5 w-full text-xs text-center text-[white]">
|
||||
{t("Pull down to open the app")}
|
||||
</div>
|
||||
<button
|
||||
className="absolute left-1/2 transform -translate-x-1/2 bottom-[15%] text-accent px-4 py-2 rounded-[25px] w-[56.5%] bg-[white]"
|
||||
onClick={download}
|
||||
>
|
||||
{t("Download")}
|
||||
</button>
|
||||
<button
|
||||
className="absolute left-1/2 transform -translate-x-1/2 translate-y-[150%] bottom-[15%] text-[white] px-4 py-2 rounded-[25px] w-[56.5%]"
|
||||
onClick={goBack}
|
||||
>
|
||||
{t("Cancel Download")}
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default OIAPage
|
||||
@@ -5,6 +5,7 @@ import serialize from "serialize-javascript"
|
||||
import { Hydrate, dehydrate } from "@tanstack/react-query"
|
||||
|
||||
import { PageContent } from "~/components/common/PageContent"
|
||||
import { OIAButton } from "~/components/site/OIAButton"
|
||||
import { PostFooter } from "~/components/site/PostFooter"
|
||||
import PostMeta from "~/components/site/PostMeta"
|
||||
import { SITE_URL } from "~/lib/env"
|
||||
@@ -155,6 +156,7 @@ export default async function SitePagePage({
|
||||
site={site}
|
||||
withActions={true}
|
||||
/>
|
||||
<OIAButton link={`/notes/${page?.noteId}/${page?.characterId}`} />
|
||||
</article>
|
||||
{!onlyContent && (
|
||||
<Hydrate state={dehydratedState}>
|
||||
|
||||
@@ -122,9 +122,11 @@ export const CommentItem: React.FC<{
|
||||
onClick={() => setReplyOpen(!replyOpen)}
|
||||
>
|
||||
{t(`${replyOpen ? "Cancel " : ""}Reply`)}
|
||||
<span className="ml-1">
|
||||
{(comment as any)?.fromNotes?.count || 0}
|
||||
</span>
|
||||
{!replyOpen && (
|
||||
<span className="ml-1">
|
||||
{(comment as any)?.fromNotes?.count || 0}
|
||||
</span>
|
||||
)}
|
||||
</Button>
|
||||
)}
|
||||
{comment.characterId === account?.characterId && (
|
||||
|
||||
@@ -2,7 +2,7 @@ import confetti from "canvas-confetti"
|
||||
import { useEffect, useRef, useState } from "react"
|
||||
import { toast } from "react-hot-toast"
|
||||
|
||||
import { useAccountState, useConnectModal } from "@crossbell/connect-kit"
|
||||
import { useConnectModal } from "@crossbell/connect-kit"
|
||||
|
||||
import { Avatar } from "~/components/ui/Avatar"
|
||||
import { BoxRadio } from "~/components/ui/BoxRadio"
|
||||
@@ -66,15 +66,10 @@ export const PatronModal: React.FC<{
|
||||
|
||||
const [value, setValue] = useState(radios[1].value!)
|
||||
|
||||
const currentCharacterId = useAccountState(
|
||||
(s) => s.computed.account?.characterId,
|
||||
)
|
||||
|
||||
const submit = () => {
|
||||
if (currentCharacterId && site?.characterId && parseInt(value)) {
|
||||
if (site?.characterId && parseInt(value)) {
|
||||
tipCharacter.mutate({
|
||||
fromCharacterId: currentCharacterId,
|
||||
toCharacterId: site?.characterId,
|
||||
characterId: site?.characterId,
|
||||
amount: parseInt(value),
|
||||
noteId: page?.noteId,
|
||||
})
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
"use client"
|
||||
|
||||
import React, { useCallback, useEffect, useState } from "react"
|
||||
|
||||
import { useIsMobileLayout } from "~/hooks/useMobileLayout"
|
||||
import { useTranslation } from "~/lib/i18n/client"
|
||||
|
||||
export const OIAButton: React.FC<{
|
||||
link: `/${string}`
|
||||
}> = ({ link }) => {
|
||||
const { t, i18n } = useTranslation("site")
|
||||
const [isVisible, setIsVisible] = useState(true)
|
||||
|
||||
const oia = useCallback(() => {
|
||||
window.open(`https://oia.xlog.app${link}`, "_blank")
|
||||
}, [])
|
||||
|
||||
const isMobileLayout = useIsMobileLayout()
|
||||
|
||||
useEffect(() => {
|
||||
if (!isMobileLayout) {
|
||||
return
|
||||
}
|
||||
|
||||
let timeoutId: ReturnType<typeof setTimeout> | null = null
|
||||
const handleScroll = () => {
|
||||
setIsVisible(false)
|
||||
timeoutId && clearTimeout(timeoutId)
|
||||
timeoutId = setTimeout(() => setIsVisible(true), 1000)
|
||||
}
|
||||
window.addEventListener("scroll", handleScroll)
|
||||
return () => window.removeEventListener("scroll", handleScroll)
|
||||
}, [isMobileLayout])
|
||||
|
||||
if (!isMobileLayout) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<button
|
||||
onClick={oia}
|
||||
className={`fixed bottom-[10%] left-1/2 -translate-x-1/2 bg-black rounded-3xl px-5 py-3 text-accent z-50 transition-opacity duration-500 ${
|
||||
isVisible ? "opacity-100" : "opacity-0"
|
||||
}`}
|
||||
>
|
||||
{t("Open in App")}
|
||||
</button>
|
||||
)
|
||||
}
|
||||
@@ -1,7 +1,18 @@
|
||||
@media print {
|
||||
/* Copied from https://stackoverflow.com/a/44908040 */
|
||||
* {
|
||||
-webkit-print-color-adjust: exact !important;
|
||||
color-adjust: exact !important;
|
||||
print-color-adjust: exact !important;
|
||||
}
|
||||
|
||||
nav,
|
||||
header,
|
||||
footer,
|
||||
.xlog-post-views,
|
||||
.xlog-post-editor,
|
||||
.xlog-post-toc,
|
||||
.xlog-post-actions,
|
||||
*[data-hide-print] {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ export const useDarkMode = () => {
|
||||
date.setMonth(date.getMonth() + 1)
|
||||
document.cookie = IS_DEV
|
||||
? `color_scheme=${colorScheme};`
|
||||
: `color_scheme=${colorScheme}; Domain=.${OUR_DOMAIN}; Path=/; Secure; HttpOnly; expires=${date.toUTCString()}`
|
||||
: `color_scheme=${colorScheme}; Domain=.${OUR_DOMAIN}; Path=/; Secure; expires=${date.toUTCString()}`
|
||||
}, [value])
|
||||
|
||||
const onceRef = useRef(false)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"load more": "There are {{count}} more {{name}}, click to load more",
|
||||
"signed and stored on the blockchain": "Ownership of this {{name}} data is guaranteed by blockchain and smart contracts to the creator alone."
|
||||
"signed and stored on the blockchain": "Ownership of this {{name}} data is guaranteed by blockchain and smart contracts to the creator alone.",
|
||||
"Cancel Download": "Cancel"
|
||||
}
|
||||
@@ -5,6 +5,11 @@
|
||||
"Tags": "タグ",
|
||||
"load more": "まだ{{count}}件の{{name}}があります。",
|
||||
"signed and stored on the blockchain": "{{name}}は、創作者によって署名され、ブロックチェーンに安全に保存されています。",
|
||||
"Download": "ダウンロード",
|
||||
"Cancel Download": "ダウンロードをキャンセル",
|
||||
"Pull down to open the app": "ダウンロード済みですか?アプリを開くために引き下げてく",
|
||||
"The app is currently under review, please stay tuned. Do you want to join the early access program?": "アプリは現在レビュー中です。お待ちください。アーリーアクセスプログラムに参加しますか?",
|
||||
"Write a comment on the blockchain": "ブロックチェーンでコメントする",
|
||||
"Open in App": "アプリで開く",
|
||||
"powered by": "<span>このサイトは </span><name/><span> によって作動します</span>"
|
||||
}
|
||||
|
||||
@@ -16,7 +16,12 @@
|
||||
"Subscribe to RSS": "訂閱 RSS",
|
||||
"Search on this site": "在這個網站上搜尋",
|
||||
"404 - Whoops, this page is gone.": "404 - 哎呀,這個頁面不見了。",
|
||||
"Download": "立即下載",
|
||||
"Cancel Download": "取消下載",
|
||||
"Pull down to open the app": "已下載?下拉開啟應用程式",
|
||||
"The app is currently under review, please stay tuned. Do you want to join the early access program?": "應用程式目前正在審核中,請靜候佳音。您想參加早期體驗計劃嗎?",
|
||||
"Back to Home": "回到首頁",
|
||||
"All Posts": "所有文章",
|
||||
"Open in App": "在 App 中開啟",
|
||||
"Search Posts": "搜尋文章"
|
||||
}
|
||||
@@ -17,7 +17,12 @@
|
||||
"Subscribe to RSS": "订阅 RSS",
|
||||
"Search on this site": "在本站搜索",
|
||||
"404 - Whoops, this page is gone.": "404 - 哎呀,这个页面不见了。",
|
||||
"Download": "立即下载",
|
||||
"Cancel Download": "取消下载",
|
||||
"Pull down to open the app": "已下载?下拉打开应用",
|
||||
"The app is currently under review, please stay tuned. Do you want to join the early access program?": "应用正在审核中,敬请期待。是否加入内测计划?",
|
||||
"Back to Home": "返回主页",
|
||||
"All Posts": "所有文章",
|
||||
"Open in App": "在 App 中打开",
|
||||
"Search Posts": "搜索文章"
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import type { Transformer } from "../rehype-embed"
|
||||
import { generateIframeHTML, includesSomeOfArray } from "./utils"
|
||||
|
||||
const getSpotifyIFrameSrc = (url: URL) => {
|
||||
const { pathname } = url
|
||||
const urlString = url.toString()
|
||||
const type = pathname.split("/")[1].toLowerCase()
|
||||
|
||||
const podcastTypes = ["episode", "show"]
|
||||
if (podcastTypes.includes(type)) {
|
||||
return urlString.replace(type, `embed-podcast/${type}`)
|
||||
}
|
||||
|
||||
return urlString.replace(type, `embed/${type}`)
|
||||
}
|
||||
|
||||
export const SpotifyTransformer: Transformer = {
|
||||
name: "Spotify",
|
||||
shouldTransform(url) {
|
||||
const { host, pathname } = url
|
||||
|
||||
return (
|
||||
host === "open.spotify.com" &&
|
||||
!includesSomeOfArray(pathname, ["embed", "embed-podcast"]) &&
|
||||
includesSomeOfArray(pathname, [
|
||||
"/album/",
|
||||
"/artist/",
|
||||
"/episode/",
|
||||
"/show/",
|
||||
"/track/",
|
||||
"/playlist/",
|
||||
])
|
||||
)
|
||||
},
|
||||
getHTML(url) {
|
||||
const iframe = getSpotifyIFrameSrc(url)
|
||||
return generateIframeHTML({
|
||||
name: "spotify",
|
||||
src: iframe,
|
||||
height: "152px",
|
||||
width: "100%",
|
||||
style: "border-radius: 12px;",
|
||||
allow:
|
||||
"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",
|
||||
})
|
||||
},
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import { BilibiliTransformer } from "./Bilibili"
|
||||
import { CodeSandboxTransformer } from "./CodeSandBox"
|
||||
import { GitHubRepoTransformer } from "./GitHub"
|
||||
import { NetEaseMusicTransformer } from "./NetEaseMusic"
|
||||
import { SpotifyTransformer } from "./Spotify"
|
||||
import { TweetTransformer } from "./Tweet"
|
||||
import { YouTubeTransformer } from "./YouTube"
|
||||
|
||||
@@ -13,4 +14,5 @@ export const transformers: Transformer[] = [
|
||||
YouTubeTransformer,
|
||||
NetEaseMusicTransformer,
|
||||
BilibiliTransformer,
|
||||
SpotifyTransformer,
|
||||
]
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import { IframeHTMLAttributes } from "react"
|
||||
|
||||
interface IframeProps extends IframeHTMLAttributes<HTMLIFrameElement> {
|
||||
interface IframeProps
|
||||
extends Omit<IframeHTMLAttributes<HTMLIFrameElement>, "style"> {
|
||||
name: string
|
||||
ratio?: string
|
||||
/** inline style string */
|
||||
style?: string
|
||||
}
|
||||
|
||||
export const isHostIncludes = (domain: string, host: string) => {
|
||||
@@ -18,7 +21,6 @@ export const generateIframeHTML = ({
|
||||
height,
|
||||
width,
|
||||
ratio,
|
||||
style,
|
||||
...attributes
|
||||
}: IframeProps) => {
|
||||
const iframeAttributes = Object.entries(attributes)
|
||||
|
||||
+9
-16
@@ -4,6 +4,7 @@ import {
|
||||
useAccountState,
|
||||
useFollowCharacter,
|
||||
useFollowCharacters,
|
||||
useTip,
|
||||
useUnfollowCharacter,
|
||||
} from "@crossbell/connect-kit"
|
||||
import { useContract } from "@crossbell/contract"
|
||||
@@ -291,23 +292,15 @@ export const useGetStat = (
|
||||
|
||||
export function useTipCharacter() {
|
||||
const queryClient = useQueryClient()
|
||||
const contract = useContract()
|
||||
const mutation = useMutation(
|
||||
async (payload: Parameters<typeof siteModel.tipCharacter>[0]) => {
|
||||
return siteModel.tipCharacter(payload, contract)
|
||||
|
||||
return useTip({
|
||||
onSuccess: (data, variables) => {
|
||||
queryClient.invalidateQueries([
|
||||
"getTips",
|
||||
{ toCharacterId: variables.characterId },
|
||||
])
|
||||
},
|
||||
{
|
||||
onSuccess: (data, variables) => {
|
||||
queryClient.invalidateQueries([
|
||||
"getTips",
|
||||
{
|
||||
toCharacterId: variables.toCharacterId,
|
||||
},
|
||||
])
|
||||
},
|
||||
},
|
||||
)
|
||||
return mutation
|
||||
})
|
||||
}
|
||||
|
||||
export const useGetTips = (
|
||||
|
||||
Reference in New Issue
Block a user