mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
async theme
This commit is contained in:
@@ -14,7 +14,11 @@ export default function Live2D() {
|
||||
]).then((e) => {
|
||||
if (typeof window?.loadlive2d !== 'undefined') {
|
||||
// https://github.com/xiazeyu/live2d-widget-models
|
||||
loadlive2d('live2d', BLOG.WIDGET_PET_LINK)
|
||||
try {
|
||||
loadlive2d('live2d', BLOG.WIDGET_PET_LINK)
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
|
||||
/**
|
||||
* 主题文件被加载出之前的占位符
|
||||
* @returns
|
||||
*/
|
||||
const Loading = () => {
|
||||
return <div className="w-screen h-screen flex justify-center items-center">
|
||||
<h1>Loading... <i className='ml-2 fas fa-spinner animate-spin' /></h1>
|
||||
</div>
|
||||
const Loading = (props) => {
|
||||
const { current } = props
|
||||
|
||||
return <>
|
||||
{current || <div className="w-screen h-screen flex justify-center items-center">
|
||||
<h1>Loading... <i className='ml-2 fas fa-spinner animate-spin' /></h1>
|
||||
</div>}
|
||||
</>
|
||||
}
|
||||
export default Loading
|
||||
|
||||
@@ -25,7 +25,7 @@ const PrismMac = () => {
|
||||
}
|
||||
loadExternalResource(BLOG.PRISM_THEME_PATH, 'css')
|
||||
loadExternalResource(BLOG.PRISM_JS_AUTO_LOADER, 'js').then((url) => {
|
||||
console.log('渲染公式图表')
|
||||
// console.log('渲染公式图表')
|
||||
if (window?.Prism?.plugins?.autoloader) {
|
||||
window.Prism.plugins.autoloader.languages_path = BLOG.PRISM_JS_PATH
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import Loading from '@/components/Loading'
|
||||
const NoFound = props => {
|
||||
const { theme, siteInfo } = useGlobal()
|
||||
const meta = { title: `${props?.siteInfo?.title} | 页面找不到啦`, image: siteInfo?.pageCover }
|
||||
const Layout404 = dynamic(() => import(`@/themes/${theme}/Layout404`).then(async (m) => { return m.Layout404 }), { ssr: false, loading: () => <Loading /> })
|
||||
const Layout404 = dynamic(() => import(`@/themes/${theme}/Layout404`).then(async (m) => { return m.Layout404 }), { ssr: true, loading: () => <Loading /> })
|
||||
return <Layout404 {...props} meta={meta}/>
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ const Slug = props => {
|
||||
|
||||
// 文章锁🔐
|
||||
const [lock, setLock] = useState(post?.password && post?.password !== '')
|
||||
const LayoutSlug = dynamic(() => import(`@/themes/${theme}/LayoutSlug`).then(async (m) => { return m.LayoutSlug }), { ssr: false, loading: () => <Loading /> })
|
||||
const LayoutSlug = dynamic(() => import(`@/themes/${theme}`).then(async (m) => { return m.LayoutSlug }), { ssr: true, loading: () => <Loading /> })
|
||||
|
||||
useEffect(() => {
|
||||
changeLoadingState(false)
|
||||
|
||||
@@ -16,7 +16,7 @@ const ArchiveIndex = props => {
|
||||
type: 'website'
|
||||
}
|
||||
|
||||
const LayoutArchive = dynamic(() => import(`@/themes/${theme}/LayoutArchive`).then(async (m) => { return m.LayoutArchive }), { ssr: false, loading: () => <Loading /> })
|
||||
const LayoutArchive = dynamic(() => import(`@/themes/${theme}/LayoutArchive`).then(async (m) => { return m.LayoutArchive }), { ssr: true, loading: () => <Loading /> })
|
||||
return <LayoutArchive {...props} meta={meta} />
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ export default function Category(props) {
|
||||
const { siteInfo, posts } = props
|
||||
const { locale } = useGlobal()
|
||||
if (!posts) {
|
||||
const Layout404 = dynamic(() => import(`@/themes/${theme}/Layout404`).then(async (m) => { return m.Layout404 }), { ssr: false, loading: () => <Loading /> })
|
||||
const Layout404 = dynamic(() => import(`@/themes/${theme}/Layout404`).then(async (m) => { return m.Layout404 }), { ssr: true, loading: () => <Loading /> })
|
||||
return <Layout404 {...props} />
|
||||
}
|
||||
const meta = {
|
||||
@@ -28,7 +28,7 @@ export default function Category(props) {
|
||||
type: 'website'
|
||||
}
|
||||
|
||||
const LayoutCategory = dynamic(() => import(`@/themes/${theme}/LayoutCategory`).then(async (m) => { return m.LayoutCategory }), { ssr: false, loading: () => <Loading /> })
|
||||
const LayoutCategory = dynamic(() => import(`@/themes/${theme}/LayoutCategory`).then(async (m) => { return m.LayoutCategory }), { ssr: true, loading: () => <Loading /> })
|
||||
return <LayoutCategory {...props} meta={meta} />
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ export default function Category(props) {
|
||||
const { siteInfo, posts } = props
|
||||
const { locale } = useGlobal()
|
||||
if (!posts) {
|
||||
const Layout404 = dynamic(() => import(`@/themes/${theme}/Layout404`).then(async (m) => { return m.Layout404 }), { ssr: false, loading: () => <Loading /> })
|
||||
const Layout404 = dynamic(() => import(`@/themes/${theme}/Layout404`).then(async (m) => { return m.Layout404 }), { ssr: true, loading: () => <Loading /> })
|
||||
return <Layout404 {...props} />
|
||||
}
|
||||
const meta = {
|
||||
@@ -28,7 +28,7 @@ export default function Category(props) {
|
||||
type: 'website'
|
||||
}
|
||||
|
||||
const LayoutCategory = dynamic(() => import(`@/themes/${theme}/LayoutCategory`).then(async (m) => { return m.LayoutCategory }), { ssr: false, loading: () => <Loading /> })
|
||||
const LayoutCategory = dynamic(() => import(`@/themes/${theme}/LayoutCategory`).then(async (m) => { return m.LayoutCategory }), { ssr: true, loading: () => <Loading /> })
|
||||
return <LayoutCategory {...props} meta={meta} />
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ import Loading from '@/components/Loading'
|
||||
*/
|
||||
const Index = props => {
|
||||
const { theme } = useGlobal()
|
||||
const LayoutIndex = dynamic(() => import(`@/themes/${theme}/LayoutIndex`)
|
||||
.then(async (m) => { return m.LayoutIndex }), { ssr: false, loading: () => <Loading /> }
|
||||
const LayoutIndex = dynamic(() => import(`@/themes/${theme}`)
|
||||
.then(async (m) => { return m.LayoutIndex }), { ssr: true, loading: () => <Loading /> }
|
||||
)
|
||||
return <LayoutIndex {...props} />
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ const Page = props => {
|
||||
type: 'website'
|
||||
}
|
||||
|
||||
const LayoutPage = dynamic(() => import(`@/themes/${theme}/LayoutPage`).then(async (m) => { return m.LayoutPage }), { ssr: false, loading: () => <Loading /> })
|
||||
const LayoutPage = dynamic(() => import(`@/themes/${theme}/LayoutPage`).then(async (m) => { return m.LayoutPage }), { ssr: true, loading: () => <Loading /> })
|
||||
return <LayoutPage {...props} meta={meta} />
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ const Index = props => {
|
||||
}
|
||||
const { theme } = useGlobal()
|
||||
|
||||
const LayoutSearch = dynamic(() => import(`@/themes/${theme}/LayoutSearch`).then(async (m) => { return m.LayoutSearch }), { ssr: false, loading: () => <Loading /> })
|
||||
const LayoutSearch = dynamic(() => import(`@/themes/${theme}/LayoutSearch`).then(async (m) => { return m.LayoutSearch }), { ssr: true, loading: () => <Loading /> })
|
||||
return <LayoutSearch {...props} currentSearch={keyword} meta={meta} />
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ const Index = props => {
|
||||
type: 'website'
|
||||
}
|
||||
const { theme } = useGlobal()
|
||||
const LayoutSearch = dynamic(() => import(`@/themes/${theme}/LayoutSearch`).then(async (m) => { return m.LayoutSearch }), { ssr: false, loading: () => <Loading /> })
|
||||
const LayoutSearch = dynamic(() => import(`@/themes/${theme}/LayoutSearch`).then(async (m) => { return m.LayoutSearch }), { ssr: true, loading: () => <Loading /> })
|
||||
return <LayoutSearch {...props} currentSearch={keyword} meta={meta} />
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ const Search = props => {
|
||||
|
||||
const { theme } = useGlobal()
|
||||
|
||||
const LayoutSearch = dynamic(() => import(`@/themes/${theme}/LayoutSearch`).then(async (m) => { return m.LayoutSearch }), { ssr: false, loading: () => <Loading /> })
|
||||
const LayoutSearch = dynamic(() => import(`@/themes/${theme}/LayoutSearch`).then(async (m) => { return m.LayoutSearch }), { ssr: true, loading: () => <Loading /> })
|
||||
return <LayoutSearch {...props} posts={filteredPosts} currentSearch={keyword} meta={meta} />
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ const Tag = props => {
|
||||
const { tag, siteInfo, posts } = props
|
||||
|
||||
if (!posts) {
|
||||
const Layout404 = dynamic(() => import(`@/themes/${theme}/Layout404`).then(async (m) => { return m.Layout404 }), { ssr: false, loading: () => <Loading /> })
|
||||
const Layout404 = dynamic(() => import(`@/themes/${theme}/Layout404`).then(async (m) => { return m.Layout404 }), { ssr: true, loading: () => <Loading /> })
|
||||
return <Layout404 {...props}/>
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ const Tag = props => {
|
||||
slug: 'tag/' + tag,
|
||||
type: 'website'
|
||||
}
|
||||
const LayoutTagIndex = dynamic(() => import(`@/themes/${theme}/LayoutTagIndex`).then(async (m) => { return m.LayoutTagIndex }), { ssr: false, loading: () => <Loading /> })
|
||||
const LayoutTagIndex = dynamic(() => import(`@/themes/${theme}/LayoutTagIndex`).then(async (m) => { return m.LayoutTagIndex }), { ssr: true, loading: () => <Loading /> })
|
||||
return <LayoutTagIndex {...props} meta={meta} />
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ const Tag = props => {
|
||||
const { tag, siteInfo, posts } = props
|
||||
|
||||
if (!posts) {
|
||||
const Layout404 = dynamic(() => import(`@/themes/${theme}/Layout404`).then(async (m) => { return m.Layout404 }), { ssr: false, loading: () => <Loading /> })
|
||||
const Layout404 = dynamic(() => import(`@/themes/${theme}/Layout404`).then(async (m) => { return m.Layout404 }), { ssr: true, loading: () => <Loading /> })
|
||||
return <Layout404 {...props}/>
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ const Tag = props => {
|
||||
slug: 'tag/' + tag,
|
||||
type: 'website'
|
||||
}
|
||||
const LayoutTag = dynamic(() => import(`@/themes/${theme}/LayoutTag`).then(async (m) => { return m.LayoutTag }), { ssr: false, loading: () => <Loading /> })
|
||||
const LayoutTag = dynamic(() => import(`@/themes/${theme}/LayoutTag`).then(async (m) => { return m.LayoutTag }), { ssr: true, loading: () => <Loading /> })
|
||||
return <LayoutTag {...props} meta={meta} />
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ const TagIndex = props => {
|
||||
slug: 'tag',
|
||||
type: 'website'
|
||||
}
|
||||
const LayoutTagIndex = dynamic(() => import(`@/themes/${theme}/LayoutTagIndex`).then(async (m) => { return m.LayoutTagIndex }), { ssr: false, loading: () => <Loading /> })
|
||||
const LayoutTagIndex = dynamic(() => import(`@/themes/${theme}/LayoutTagIndex`).then(async (m) => { return m.LayoutTagIndex }), { ssr: true, loading: () => <Loading /> })
|
||||
return <LayoutTagIndex {...props} meta={meta} />
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user