chore: update about dialog

This commit is contained in:
Steven 2023-10-28 15:17:33 +08:00
parent d02105ca30
commit f5c1e79195
4 changed files with 9 additions and 70 deletions

View file

@ -1,7 +1,7 @@
import { Divider } from "@mui/joy";
import { useGlobalStore } from "@/store/module";
import { useTranslate } from "@/utils/i18n";
import { generateDialog } from "./Dialog";
import GitHubBadge from "./GitHubBadge";
import Icon from "./Icon";
type Props = DialogProps;
@ -28,36 +28,14 @@ const AboutSiteDialog: React.FC<Props> = ({ destroy }: Props) => {
</div>
<div className="flex flex-col justify-start items-start max-w-full w-96">
<p className="text-xs">{t("about.memos-description")}</p>
<p className="text-sm mt-2 ">{customizedProfile.description || t("about.no-server-description")}</p>
<div className="mt-4 w-full flex flex-row text-sm justify-start items-center">
<div className="flex flex-row justify-start items-center mr-2">
{t("about.powered-by")}
<a href="https://usememos.com" target="_blank" className="flex flex-row justify-start items-center mx-1 hover:underline">
<img className="w-6 h-auto rounded-full mr-1" src="/logo.png" alt="" />
memos
</a>
<span>v{profile.version}</span>
</div>
<GitHubBadge />
</div>
<div className="border-t w-full mt-3 pt-2 text-sm flex flex-row justify-start items-center space-x-2">
<span className="text-gray-500">{t("about.other-projects")}:</span>
<a href="https://github.com/boojack/slash" target="_blank" className="flex items-center underline text-blue-600 hover:opacity-80">
<img className="w-5 h-auto mr-1 rounded-full" src="https://github.com/boojack/slash/raw/main/resources/logo.png" alt="" />
<span>Slash</span>
</a>
<a
href="https://github.com/boojack/sticky-notes"
target="_blank"
className="flex items-center underline text-blue-600 hover:opacity-80"
>
<img
className="w-5 h-auto mr-1"
src="https://raw.githubusercontent.com/boojack/sticky-notes/main/public/sticky-notes.ico"
alt=""
/>
<span>Sticky notes</span>
<p className="text-sm mt-2">{customizedProfile.description || t("about.no-server-description")}</p>
<Divider className="!my-3" />
<div className="w-full flex flex-row justify-start items-center text-sm italic">
{t("about.powered-by")}
<a className="shrink-0 flex flex-row justify-start items-center mx-1 hover:underline" href="https://usememos.com" target="_blank">
<img className="w-auto h-7" src="https://www.usememos.com/full-logo-landscape.png" alt="" />
</a>
<span>v{profile.version}</span>
</div>
</div>
</>

View file

@ -89,7 +89,7 @@ const CreateMemoRelationDialog: React.FC<Props> = (props: Props) => {
onChange={handleMemoIdChanged}
onKeyDown={handleMemoIdInputKeyDown}
fullWidth
endDecorator={<Icon.PlusCircle onClick={handleSaveBtnClick} className="w-4 h-auto cursor-pointer hover:opacity-80" />}
endDecorator={<Icon.Check onClick={handleSaveBtnClick} className="w-4 h-auto cursor-pointer hover:opacity-80" />}
/>
{memoList.length > 0 && (
<>

View file

@ -1,29 +0,0 @@
import { useEffect, useState } from "react";
import * as api from "@/helpers/api";
import Icon from "./Icon";
const GitHubBadge = () => {
const [starCount, setStarCount] = useState(0);
useEffect(() => {
api.getRepoStarCount().then((data) => {
setStarCount(data);
});
}, []);
return (
<a
className="h-7 flex flex-row justify-start items-center border dark:border-zinc-600 rounded cursor-pointer hover:opacity-80"
href="https://github.com/usememos/memos"
target="_blank"
>
<div className="apply w-auto h-full px-2 flex flex-row justify-center items-center text-xs bg-gray-100 dark:bg-zinc-700">
<Icon.Github className="mr-1 w-4 h-4" />
Star
</div>
<div className="w-auto h-full flex flex-row justify-center items-center px-3 text-xs font-bold">{starCount || ""}</div>
</a>
);
};
export default GitHubBadge;

View file

@ -180,16 +180,6 @@ export function deleteIdentityProvider(id: IdentityProviderId) {
return axios.delete(`/api/v1/idp/${id}`);
}
export async function getRepoStarCount() {
const { data } = await axios.get(`https://api.github.com/repos/usememos/memos`, {
headers: {
Accept: "application/vnd.github.v3.star+json",
Authorization: "",
},
});
return data.stargazers_count as number;
}
export async function getRepoLatestTag() {
const { data } = await axios.get(`https://api.github.com/repos/usememos/memos/tags`, {
headers: {