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
caf054ba
Unverified
Commit
caf054ba
authored
Feb 16, 2023
by
boojack
Committed by
GitHub
Feb 16, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: add beta badge to storage (#1099)
* chore: add beta badge to storage * chore: update
parent
7e8011ba
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
30 additions
and
17 deletions
+30
-17
memo.go
server/memo.go
+1
-1
BetaBadge.tsx
web/src/components/BetaBadge.tsx
+7
-3
SettingDialog.tsx
web/src/components/SettingDialog.tsx
+11
-7
SystemSection.tsx
web/src/components/Settings/SystemSection.tsx
+6
-1
base-dialog.less
web/src/less/base-dialog.less
+1
-1
beta-badge.less
web/src/less/beta-badge.less
+0
-3
memo-editor.less
web/src/less/memo-editor.less
+1
-1
global.ts
web/src/store/module/global.ts
+3
-0
No files found.
server/memo.go
View file @
caf054ba
...
@@ -57,7 +57,7 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
...
@@ -57,7 +57,7 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
disablePublicMemosSystemSetting
,
err
:=
s
.
Store
.
FindSystemSetting
(
ctx
,
&
api
.
SystemSettingFind
{
disablePublicMemosSystemSetting
,
err
:=
s
.
Store
.
FindSystemSetting
(
ctx
,
&
api
.
SystemSettingFind
{
Name
:
api
.
SystemSettingDisablePublicMemosName
,
Name
:
api
.
SystemSettingDisablePublicMemosName
,
})
})
if
err
!=
nil
{
if
err
!=
nil
&&
common
.
ErrorCode
(
err
)
!=
common
.
NotFound
{
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to find system setting"
)
.
SetInternal
(
err
)
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to find system setting"
)
.
SetInternal
(
err
)
}
}
if
disablePublicMemosSystemSetting
!=
nil
{
if
disablePublicMemosSystemSetting
!=
nil
{
...
...
web/src/components/BetaBadge.tsx
View file @
caf054ba
import
"../less/beta-badge.less"
;
interface
Props
{
interface
Props
{
className
?:
string
;
className
?:
string
;
}
}
...
@@ -7,7 +5,13 @@ interface Props {
...
@@ -7,7 +5,13 @@ interface Props {
const
BetaBadge
:
React
.
FC
<
Props
>
=
(
props
:
Props
)
=>
{
const
BetaBadge
:
React
.
FC
<
Props
>
=
(
props
:
Props
)
=>
{
const
{
className
}
=
props
;
const
{
className
}
=
props
;
return
<
span
className=
{
`beta-badge ${className ?? ""}`
}
>
beta
</
span
>;
return
(
<
span
className=
{
`mx-1 px-1 leading-5 text-xs border dark:border-zinc-600 rounded-full text-gray-500 dark:text-gray-400 ${className ?? ""}`
}
>
Beta
</
span
>
);
};
};
export
default
BetaBadge
;
export
default
BetaBadge
;
web/src/components/SettingDialog.tsx
View file @
caf054ba
import
{
useState
}
from
"react"
;
import
{
useState
}
from
"react"
;
import
{
useTranslation
}
from
"react-i18next"
;
import
{
useTranslation
}
from
"react-i18next"
;
import
{
useUserStore
}
from
"../store/module"
;
import
{
use
GlobalStore
,
use
UserStore
}
from
"../store/module"
;
import
Icon
from
"./Icon"
;
import
Icon
from
"./Icon"
;
import
{
generateDialog
}
from
"./Dialog"
;
import
{
generateDialog
}
from
"./Dialog"
;
import
MyAccountSection
from
"./Settings/MyAccountSection"
;
import
MyAccountSection
from
"./Settings/MyAccountSection"
;
...
@@ -8,6 +8,7 @@ import PreferencesSection from "./Settings/PreferencesSection";
...
@@ -8,6 +8,7 @@ import PreferencesSection from "./Settings/PreferencesSection";
import
MemberSection
from
"./Settings/MemberSection"
;
import
MemberSection
from
"./Settings/MemberSection"
;
import
SystemSection
from
"./Settings/SystemSection"
;
import
SystemSection
from
"./Settings/SystemSection"
;
import
StorageSection
from
"./Settings/StorageSection"
;
import
StorageSection
from
"./Settings/StorageSection"
;
import
BetaBadge
from
"./BetaBadge"
;
import
"../less/setting-dialog.less"
;
import
"../less/setting-dialog.less"
;
type
Props
=
DialogProps
;
type
Props
=
DialogProps
;
...
@@ -21,6 +22,7 @@ interface State {
...
@@ -21,6 +22,7 @@ interface State {
const
SettingDialog
:
React
.
FC
<
Props
>
=
(
props
:
Props
)
=>
{
const
SettingDialog
:
React
.
FC
<
Props
>
=
(
props
:
Props
)
=>
{
const
{
destroy
}
=
props
;
const
{
destroy
}
=
props
;
const
{
t
}
=
useTranslation
();
const
{
t
}
=
useTranslation
();
const
globalStore
=
useGlobalStore
();
const
userStore
=
useUserStore
();
const
userStore
=
useUserStore
();
const
user
=
userStore
.
state
.
user
;
const
user
=
userStore
.
state
.
user
;
const
[
state
,
setState
]
=
useState
<
State
>
({
const
[
state
,
setState
]
=
useState
<
State
>
({
...
@@ -70,12 +72,14 @@ const SettingDialog: React.FC<Props> = (props: Props) => {
...
@@ -70,12 +72,14 @@ const SettingDialog: React.FC<Props> = (props: Props) => {
>
>
<
span
className=
"icon-text"
>
🛠️
</
span
>
{
t
(
"setting.system"
)
}
<
span
className=
"icon-text"
>
🛠️
</
span
>
{
t
(
"setting.system"
)
}
</
span
>
</
span
>
{
globalStore
.
isDev
()
&&
(
<
span
<
span
onClick=
{
()
=>
handleSectionSelectorItemClick
(
"storage"
)
}
onClick=
{
()
=>
handleSectionSelectorItemClick
(
"storage"
)
}
className=
{
`section-item ${state.selectedSection === "storage" ? "selected" : ""}`
}
className=
{
`section-item ${state.selectedSection === "storage" ? "selected" : ""}`
}
>
>
<
span
className=
"icon-text"
>
💾
</
span
>
{
t
(
"setting.storage"
)
}
<
span
className=
"icon-text"
>
💾
</
span
>
{
t
(
"setting.storage"
)
}
<
BetaBadge
/>
</
span
>
</
span
>
)
}
</
div
>
</
div
>
</>
</>
)
:
null
}
)
:
null
}
...
...
web/src/components/Settings/SystemSection.tsx
View file @
caf054ba
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useTranslation
}
from
"react-i18next"
;
import
{
useTranslation
}
from
"react-i18next"
;
import
{
Button
,
Switch
,
Textarea
}
from
"@mui/joy"
;
import
{
Button
,
Divider
,
Switch
,
Textarea
}
from
"@mui/joy"
;
import
{
useGlobalStore
}
from
"../../store/module"
;
import
{
useGlobalStore
}
from
"../../store/module"
;
import
*
as
api
from
"../../helpers/api"
;
import
*
as
api
from
"../../helpers/api"
;
import
toastHelper
from
"../Toast"
;
import
toastHelper
from
"../Toast"
;
...
@@ -157,6 +157,11 @@ const SystemSection = () => {
...
@@ -157,6 +157,11 @@ const SystemSection = () => {
<
span
className=
"normal-text"
>
{
t
(
"setting.system-section.disable-public-memos"
)
}
</
span
>
<
span
className=
"normal-text"
>
{
t
(
"setting.system-section.disable-public-memos"
)
}
</
span
>
<
Switch
checked=
{
state
.
disablePublicMemos
}
onChange=
{
(
event
)
=>
handleDisablePublicMemosChanged
(
event
.
target
.
checked
)
}
/>
<
Switch
checked=
{
state
.
disablePublicMemos
}
onChange=
{
(
event
)
=>
handleDisablePublicMemosChanged
(
event
.
target
.
checked
)
}
/>
</
div
>
</
div
>
<
div
className=
"form-label"
>
<
span
className=
"normal-text"
>
Storage
</
span
>
<
Switch
checked=
{
state
.
disablePublicMemos
}
onChange=
{
(
event
)
=>
handleDisablePublicMemosChanged
(
event
.
target
.
checked
)
}
/>
</
div
>
<
Divider
className=
"!mt-3 !my-4"
/>
<
div
className=
"form-label"
>
<
div
className=
"form-label"
>
<
span
className=
"normal-text"
>
{
t
(
"setting.system-section.additional-style"
)
}
</
span
>
<
span
className=
"normal-text"
>
{
t
(
"setting.system-section.additional-style"
)
}
</
span
>
<
Button
onClick=
{
handleSaveAdditionalStyle
}
>
{
t
(
"common.save"
)
}
</
Button
>
<
Button
onClick=
{
handleSaveAdditionalStyle
}
>
{
t
(
"common.save"
)
}
</
Button
>
...
...
web/src/less/base-dialog.less
View file @
caf054ba
.dialog-wrapper {
.dialog-wrapper {
@apply fixed top-0 left-0 flex flex-col justify-start items-center w-full h-full pt-16 pb-8 px-4 z-100 overflow-x-hidden overflow-y-scroll bg-transparent transition-all hide-scrollbar;
@apply fixed top-0 left-0 flex flex-col justify-start items-center w-full h-full pt-16 pb-8 px-4 z-100
0
overflow-x-hidden overflow-y-scroll bg-transparent transition-all hide-scrollbar;
&.showup {
&.showup {
background-color: rgba(0, 0, 0, 0.6);
background-color: rgba(0, 0, 0, 0.6);
...
...
web/src/less/beta-badge.less
deleted
100644 → 0
View file @
7e8011ba
.beta-badge {
@apply px-2 py-1 text-xs border rounded-full text-gray-500;
}
web/src/less/memo-editor.less
View file @
caf054ba
...
@@ -52,7 +52,7 @@
...
@@ -52,7 +52,7 @@
@apply hidden flex-row justify-start items-start flex-wrap absolute top-6 left-0 mt-1 p-1 z-1 rounded w-52 h-auto max-h-48 overflow-y-auto font-mono shadow bg-zinc-200 dark:bg-zinc-600;
@apply hidden flex-row justify-start items-start flex-wrap absolute top-6 left-0 mt-1 p-1 z-1 rounded w-52 h-auto max-h-48 overflow-y-auto font-mono shadow bg-zinc-200 dark:bg-zinc-600;
> .item-container {
> .item-container {
@apply w-auto max-w-full truncate text-black dark:text-gray-300 cursor-pointer rounded text-sm leading-6 px-2
truncate
hover:bg-zinc-300 dark:hover:bg-zinc-700 shrink-0;
@apply w-auto max-w-full truncate text-black dark:text-gray-300 cursor-pointer rounded text-sm leading-6 px-2 hover:bg-zinc-300 dark:hover:bg-zinc-700 shrink-0;
}
}
> .tip-text {
> .tip-text {
...
...
web/src/store/module/global.ts
View file @
caf054ba
...
@@ -64,6 +64,9 @@ export const useGlobalStore = () => {
...
@@ -64,6 +64,9 @@ export const useGlobalStore = () => {
getState
:
()
=>
{
getState
:
()
=>
{
return
store
.
getState
().
global
;
return
store
.
getState
().
global
;
},
},
isDev
:
()
=>
{
return
state
.
systemStatus
.
profile
.
mode
===
"dev"
;
},
fetchSystemStatus
:
async
()
=>
{
fetchSystemStatus
:
async
()
=>
{
const
{
data
:
systemStatus
}
=
(
await
api
.
getSystemStatus
()).
data
;
const
{
data
:
systemStatus
}
=
(
await
api
.
getSystemStatus
()).
data
;
store
.
dispatch
(
setGlobalState
({
systemStatus
:
systemStatus
}));
store
.
dispatch
(
setGlobalState
({
systemStatus
:
systemStatus
}));
...
...
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