|
|
|
@ -4,13 +4,14 @@ import * as api from "@/helpers/api";
|
|
|
|
|
import storage from "@/helpers/storage";
|
|
|
|
|
import { useGlobalStore } from "@/store/module";
|
|
|
|
|
import Icon from "./Icon";
|
|
|
|
|
import Tooltip from "./kit/Tooltip";
|
|
|
|
|
|
|
|
|
|
interface State {
|
|
|
|
|
latestVersion: string;
|
|
|
|
|
show: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const UpgradeVersionBanner: React.FC = () => {
|
|
|
|
|
const UpgradeVersionView: React.FC = () => {
|
|
|
|
|
const globalStore = useGlobalStore();
|
|
|
|
|
const profile = globalStore.state.systemStatus.profile;
|
|
|
|
|
const [state, setState] = useState<State>({
|
|
|
|
@ -19,10 +20,6 @@ const UpgradeVersionBanner: React.FC = () => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (globalStore.state.systemStatus.ignoreUpgrade) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
api.getRepoLatestTag().then((latestTag) => {
|
|
|
|
|
const { skippedVersion } = storage.get(["skippedVersion"]);
|
|
|
|
|
const latestVersion = latestTag.slice(1) || "0.0.0";
|
|
|
|
@ -46,20 +43,21 @@ const UpgradeVersionBanner: React.FC = () => {
|
|
|
|
|
if (!state.show) return null;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="flex flex-row items-center justify-center w-full py-2 text-white bg-green-600">
|
|
|
|
|
<div className="flex flex-row justify-center items-center w-full py-2 px-2">
|
|
|
|
|
<a
|
|
|
|
|
className="flex flex-row items-center justify-center hover:underline"
|
|
|
|
|
className="flex flex-row justify-start items-center text-sm break-all text-green-600 hover:underline"
|
|
|
|
|
target="_blank"
|
|
|
|
|
href="https://github.com/usememos/memos/releases"
|
|
|
|
|
>
|
|
|
|
|
<Icon.ArrowUpCircle className="w-5 h-auto mr-2" />
|
|
|
|
|
New Update <span className="ml-1 font-bold">{state.latestVersion}</span>
|
|
|
|
|
✨ New version: v{state.latestVersion}
|
|
|
|
|
</a>
|
|
|
|
|
<button className="absolute opacity-80 right-4 hover:opacity-100" title="Skip this version" onClick={onSkip}>
|
|
|
|
|
<Icon.X />
|
|
|
|
|
</button>
|
|
|
|
|
<Tooltip title="Ignore upgrade" side="top">
|
|
|
|
|
<button className="ml-1 opacity-60 text-gray-600 hover:opacity-100" onClick={onSkip}>
|
|
|
|
|
<Icon.X className="w-4 h-auto" />
|
|
|
|
|
</button>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default UpgradeVersionBanner;
|
|
|
|
|
export default UpgradeVersionView;
|
|
|
|
|