From f7a441987771dc0fb9cd4341f30f91d72ce638d6 Mon Sep 17 00:00:00 2001 From: email Date: Thu, 24 Mar 2022 00:28:27 +0800 Subject: [PATCH] chore: update about site dialog --- web/src/components/AboutSiteDialog.tsx | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/web/src/components/AboutSiteDialog.tsx b/web/src/components/AboutSiteDialog.tsx index cfb38b63..b28918b4 100644 --- a/web/src/components/AboutSiteDialog.tsx +++ b/web/src/components/AboutSiteDialog.tsx @@ -1,3 +1,5 @@ +import { useEffect, useState } from "react"; +import utils from "../helpers/utils"; import { showDialog } from "./Dialog"; import showStarHistoryDialog from "./StarHistoryDialog"; import "../less/about-site-dialog.less"; @@ -5,6 +7,19 @@ import "../less/about-site-dialog.less"; interface Props extends DialogProps {} const AboutSiteDialog: React.FC = ({ destroy }: Props) => { + const [lastUpdatedAt, setLastUpdatedAt] = useState(""); + + useEffect(() => { + try { + fetch("https://api.github.com/repos/justmemos/memos/commits/main").then(async (res) => { + const data = (await res.json()) as any; + setLastUpdatedAt(utils.getDateTimeString(new Date(data.commit.committer.date))); + }); + } catch (error) { + setLastUpdatedAt("2017/12/31"); + } + }, []); + const handleCloseBtnClick = () => { destroy(); }; @@ -26,15 +41,15 @@ const AboutSiteDialog: React.FC = ({ destroy }: Props) => {

Built with `Golang` and `React`.


- 🏗 This project is working in progress,
and very pleasure to welcome your{" "} - issues and PR. + 🏗 This project is working in progress,
and very pleasure to welcome your{" "} + issues.


Star History

- Last updated on 2021/12/12 14:38:15 🎉 + Last updated on {lastUpdatedAt} 🎉