Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
43819b02
Unverified
Commit
43819b02
authored
May 25, 2023
by
boojack
Committed by
GitHub
May 25, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: add demo banner (#1739)
parent
e69f7c73
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
24 deletions
+69
-24
.air-windows.toml
scripts/.air-windows.toml
+11
-11
.air.toml
scripts/.air.toml
+11
-11
ChangePasswordDialog.tsx
web/src/components/ChangePasswordDialog.tsx
+7
-2
DemoBanner.tsx
web/src/components/DemoBanner.tsx
+38
-0
Root.tsx
web/src/layouts/Root.tsx
+2
-0
No files found.
scripts/.air-windows.toml
View file @
43819b02
...
...
@@ -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
scripts/.air.toml
View file @
43819b02
...
...
@@ -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
web/src/components/ChangePasswordDialog.tsx
View file @
43819b02
import
{
useEffect
,
useState
}
from
"react"
;
import
{
toast
}
from
"react-hot-toast"
;
import
{
useTranslation
}
from
"react-i18next"
;
import
{
useUserStore
}
from
"@/store/module"
;
import
{
use
GlobalStore
,
use
UserStore
}
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
=
()
=>
{
...
...
web/src/components/DemoBanner.tsx
0 → 100644
View file @
43819b02
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
;
web/src/layouts/Root.tsx
View file @
43819b02
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"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment