mirror of
https://github.com/snowykami/neo-blog.git
synced 2025-09-26 19:16:24 +00:00
Refactor site configuration and color scheme management
- Replaced static config with dynamic site info context. - Updated color scheme handling in various components to use site info. - Removed deprecated config file and integrated site info fetching. - Enhanced user preference page to allow color scheme selection. - Adjusted blog and console components to reflect new site info structure. - Improved error handling and fallback mechanisms for site info retrieval.
This commit is contained in:
@ -7,7 +7,8 @@ import { calculateReadingTime } from "@/utils/common/post";
|
||||
import { CommentSection } from "@/components/comment";
|
||||
import { TargetType } from '@/models/types';
|
||||
import * as motion from "motion/react-client"
|
||||
import config from "@/config";
|
||||
import { fallbackSiteInfo, useSiteInfo } from "@/contexts/site-info-context";
|
||||
import { getSiteInfo } from "@/api/misc";
|
||||
|
||||
function PostMeta({ post }: { post: Post }) {
|
||||
return (
|
||||
@ -141,6 +142,7 @@ async function PostContent({ post }: { post: Post }) {
|
||||
|
||||
|
||||
async function BlogPost({ post }: { post: Post}) {
|
||||
const siteInfo = await getSiteInfo().then(res => res.data).catch(() => fallbackSiteInfo);
|
||||
return (
|
||||
<div className="h-full"
|
||||
>
|
||||
@ -148,14 +150,14 @@ async function BlogPost({ post }: { post: Post}) {
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: -30 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ duration: config.animationDurationSecond, ease: "easeOut" }}>
|
||||
transition={{ duration: siteInfo.animationDurationSecond, ease: "easeOut" }}>
|
||||
<PostHeader post={post} />
|
||||
</motion.div>
|
||||
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 30 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ duration: config.animationDurationSecond, ease: "easeOut" }}>
|
||||
transition={{ duration: siteInfo.animationDurationSecond, ease: "easeOut" }}>
|
||||
<PostContent post={post} />
|
||||
</motion.div>
|
||||
|
||||
|
Reference in New Issue
Block a user