-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from nowscott/development
展示更多内容、添加投稿通道
- Loading branch information
Showing
5 changed files
with
59 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// components/DataUpdateDisplay.js | ||
import React from 'react'; | ||
|
||
const DataUpdateDisplay = ({ lastFetched }) => { | ||
const formattedDate = new Date(lastFetched).toLocaleString(); | ||
|
||
return ( | ||
<div className="text-center text-sm text-gray-600 dark:text-gray-300 py-2"> | ||
数据更新时间:{formattedDate} | ||
</div> | ||
); | ||
}; | ||
|
||
export default DataUpdateDisplay; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,40 @@ | ||
import { useEffect, useState } from 'react'; | ||
|
||
// components/Footer.js | ||
const Footer = () => { | ||
const [visitCount, setVisitCount] = useState(null); | ||
|
||
useEffect(() => { | ||
// 调用 API 获取访问量 | ||
const fetchVisitCount = async () => { | ||
try { | ||
const response = await fetch('/api/visit-count'); | ||
const data = await response.json(); | ||
setVisitCount(data.count); | ||
} catch (error) { | ||
console.error('获取访问量失败:', error); | ||
} | ||
}; | ||
|
||
fetchVisitCount(); | ||
}, []); | ||
|
||
return ( | ||
<p className='text-xs whitespace-nowrap text-purple-900 dark:text-rose-200 py-4'> | ||
Copyright © 2021 - NowScott | ||
</p> | ||
) | ||
<div className='text-xs whitespace-nowrap text-purple-900 dark:text-rose-200 py-4'> | ||
<a | ||
href='https://nowscott.notion.site/134f941cf9b880e1b00ee5bdf55fd71d?pvs=105' | ||
target='_blank' | ||
rel='noopener noreferrer' | ||
className='block mb-2 underline' | ||
> | ||
投稿网页 | ||
</a> | ||
{visitCount !== null && ( | ||
<p className='mb-1'>访问量:{visitCount}</p> | ||
)} | ||
<p>Copyright © 2021 - NowScott</p> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Footer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters