mirror of
https://github.com/usememos/memos.git
synced 2024-11-10 08:52:22 +08:00
chore: add demo banner (#1739)
This commit is contained in:
parent
e69f7c735b
commit
43819b021e
5 changed files with 69 additions and 24 deletions
|
@ -2,14 +2,14 @@ root = "."
|
|||
tmp_dir = ".air"
|
||||
|
||||
[build]
|
||||
bin = "./.air/memos.exe"
|
||||
cmd = "go build -o ./.air/memos.exe ./main.go"
|
||||
delay = 1000
|
||||
exclude_dir = [".air", "web", "build"]
|
||||
exclude_file = []
|
||||
exclude_regex = []
|
||||
exclude_unchanged = false
|
||||
follow_symlink = false
|
||||
full_bin = ""
|
||||
send_interrupt = true
|
||||
kill_delay = 2000
|
||||
bin = "./.air/memos.exe --mode dev"
|
||||
cmd = "go build -o ./.air/memos.exe ./main.go"
|
||||
delay = 1000
|
||||
exclude_dir = [".air", "web", "build"]
|
||||
exclude_file = []
|
||||
exclude_regex = []
|
||||
exclude_unchanged = false
|
||||
follow_symlink = false
|
||||
full_bin = ""
|
||||
send_interrupt = true
|
||||
kill_delay = 2000
|
||||
|
|
|
@ -2,14 +2,14 @@ root = "."
|
|||
tmp_dir = ".air"
|
||||
|
||||
[build]
|
||||
bin = "./.air/memos"
|
||||
cmd = "go build -o ./.air/memos ./main.go"
|
||||
delay = 1000
|
||||
exclude_dir = [".air", "web", "build"]
|
||||
exclude_file = []
|
||||
exclude_regex = []
|
||||
exclude_unchanged = false
|
||||
follow_symlink = false
|
||||
full_bin = ""
|
||||
send_interrupt = true
|
||||
kill_delay = 2000
|
||||
bin = "./.air/memos --mode dev"
|
||||
cmd = "go build -o ./.air/memos ./main.go"
|
||||
delay = 1000
|
||||
exclude_dir = [".air", "web", "build"]
|
||||
exclude_file = []
|
||||
exclude_regex = []
|
||||
exclude_unchanged = false
|
||||
follow_symlink = false
|
||||
full_bin = ""
|
||||
send_interrupt = true
|
||||
kill_delay = 2000
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { useEffect, useState } from "react";
|
||||
import { toast } from "react-hot-toast";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useUserStore } from "@/store/module";
|
||||
import { useGlobalStore, useUserStore } from "@/store/module";
|
||||
import Icon from "./Icon";
|
||||
import { generateDialog } from "./Dialog";
|
||||
|
||||
|
@ -10,11 +10,16 @@ type Props = DialogProps;
|
|||
const ChangePasswordDialog: React.FC<Props> = ({ destroy }: Props) => {
|
||||
const { t } = useTranslation();
|
||||
const userStore = useUserStore();
|
||||
const globalStore = useGlobalStore();
|
||||
const profile = globalStore.state.systemStatus.profile;
|
||||
const [newPassword, setNewPassword] = useState("");
|
||||
const [newPasswordAgain, setNewPasswordAgain] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
// do nth
|
||||
if (profile.mode === "demo" && userStore.state.user?.id === userStore.state.host?.id) {
|
||||
toast.error("Demo mode does not support this operation.");
|
||||
destroy();
|
||||
}
|
||||
}, []);
|
||||
|
||||
const handleCloseBtnClick = () => {
|
||||
|
|
38
web/src/components/DemoBanner.tsx
Normal file
38
web/src/components/DemoBanner.tsx
Normal file
|
@ -0,0 +1,38 @@
|
|||
import { useEffect, useState } from "react";
|
||||
import { useGlobalStore } from "@/store/module";
|
||||
import Icon from "./Icon";
|
||||
|
||||
interface State {
|
||||
show: boolean;
|
||||
}
|
||||
|
||||
const DemoBanner: React.FC = () => {
|
||||
const globalStore = useGlobalStore();
|
||||
const profile = globalStore.state.systemStatus.profile;
|
||||
const [state, setState] = useState<State>({
|
||||
show: false,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
const isDemo = profile.mode === "demo";
|
||||
setState({
|
||||
show: isDemo,
|
||||
});
|
||||
}, []);
|
||||
|
||||
if (!state.show) return null;
|
||||
|
||||
return (
|
||||
<div className="flex flex-row items-center justify-center w-full py-2 text-lg font-medium dark:text-gray-300 bg-white dark:bg-zinc-700 shadow">
|
||||
<div className="w-full max-w-6xl px-4 flex flex-row justify-between items-center gap-x-3">
|
||||
<span>A lightweight, self-hosted memo hub. Open Source and Free forever.</span>
|
||||
<a className="btn-primary shadow" href="https://usememos.com/docs/install/docker" target="_blank">
|
||||
Install
|
||||
<Icon.ExternalLink className="w-4 h-auto ml-1" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default DemoBanner;
|
|
@ -1,11 +1,13 @@
|
|||
import { Outlet } from "react-router-dom";
|
||||
import Header from "@/components/Header";
|
||||
import UpgradeVersionBanner from "@/components/UpgradeVersionBanner";
|
||||
import DemoBanner from "@/components/DemoBanner";
|
||||
|
||||
function Root() {
|
||||
return (
|
||||
<div className="w-full min-h-full bg-zinc-100 dark:bg-zinc-800">
|
||||
<div className="w-full h-auto flex flex-col justify-start items-center">
|
||||
<DemoBanner />
|
||||
<UpgradeVersionBanner />
|
||||
</div>
|
||||
<div className="w-full max-w-6xl mx-auto flex flex-row justify-center items-start">
|
||||
|
|
Loading…
Reference in a new issue