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
54271c15
Unverified
Commit
54271c15
authored
Nov 26, 2022
by
Zeng1998
Committed by
GitHub
Nov 26, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: fix some typos (#587)
parent
1ee8ebc9
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
60 additions
and
60 deletions
+60
-60
memo.go
api/memo.go
+3
-3
user_setting.go
api/user_setting.go
+2
-2
memo.go
server/memo.go
+10
-10
resource.go
server/resource.go
+2
-2
store.go
store/store.go
+1
-1
AboutSiteDialog.tsx
web/src/components/AboutSiteDialog.tsx
+1
-1
CreateShortcutDialog.tsx
web/src/components/CreateShortcutDialog.tsx
+1
-1
MemoEditor.tsx
web/src/components/MemoEditor.tsx
+4
-4
MemoResources.tsx
web/src/components/MemoResources.tsx
+2
-2
MemosHeader.tsx
web/src/components/MemosHeader.tsx
+2
-2
ResourcesDialog.tsx
web/src/components/ResourcesDialog.tsx
+3
-3
Sidebar.tsx
web/src/components/Sidebar.tsx
+3
-3
Toast.tsx
web/src/components/Toast.tsx
+7
-7
UsageHeatMap.tsx
web/src/components/UsageHeatMap.tsx
+6
-6
DatePicker.tsx
web/src/components/common/DatePicker.tsx
+1
-1
Selector.tsx
web/src/components/common/Selector.tsx
+3
-3
useToggle.ts
web/src/hooks/useToggle.ts
+1
-1
Blockquote.ts
web/src/labs/marked/parser/Blockquote.ts
+1
-1
about-site-dialog.less
web/src/less/about-site-dialog.less
+1
-1
home.less
web/src/less/home.less
+1
-1
Home.tsx
web/src/pages/Home.tsx
+1
-1
userService.ts
web/src/services/userService.ts
+2
-2
filter.d.ts
web/src/types/filter.d.ts
+2
-2
No files found.
api/memo.go
View file @
54271c15
...
...
@@ -8,8 +8,8 @@ const (
Public
Visibility
=
"PUBLIC"
// Protected is the PROTECTED visibility.
Protected
Visibility
=
"PROTECTED"
// Priv
i
te is the PRIVATE visibility.
Priv
i
te
Visibility
=
"PRIVATE"
// Priv
a
te is the PRIVATE visibility.
Priv
a
te
Visibility
=
"PRIVATE"
)
func
(
e
Visibility
)
String
()
string
{
...
...
@@ -18,7 +18,7 @@ func (e Visibility) String() string {
return
"PUBLIC"
case
Protected
:
return
"PROTECTED"
case
Priv
i
te
:
case
Priv
a
te
:
return
"PRIVATE"
}
return
"PRIVATE"
...
...
api/user_setting.go
View file @
54271c15
...
...
@@ -31,7 +31,7 @@ func (key UserSettingKey) String() string {
var
(
UserSettingLocaleValue
=
[]
string
{
"en"
,
"zh"
,
"vi"
,
"fr"
}
UserSettingMemoVisibilityValue
=
[]
Visibility
{
Priv
i
te
,
Protected
,
Public
}
UserSettingMemoVisibilityValue
=
[]
Visibility
{
Priv
a
te
,
Protected
,
Public
}
UserSettingEditorFontStyleValue
=
[]
string
{
"normal"
,
"mono"
}
UserSettingMemoDisplayTsOptionKeyValue
=
[]
string
{
"created_ts"
,
"updated_ts"
}
)
...
...
@@ -68,7 +68,7 @@ func (upsert UserSettingUpsert) Validate() error {
return
fmt
.
Errorf
(
"invalid user setting locale value"
)
}
}
else
if
upsert
.
Key
==
UserSettingMemoVisibilityKey
{
memoVisibilityValue
:=
Priv
i
te
memoVisibilityValue
:=
Priv
a
te
err
:=
json
.
Unmarshal
([]
byte
(
upsert
.
Value
),
&
memoVisibilityValue
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to unmarshal user setting memo visibility value"
)
...
...
server/memo.go
View file @
54271c15
...
...
@@ -45,7 +45,7 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
}
if
userMemoVisibilitySetting
!=
nil
{
memoVisibility
:=
api
.
Priv
i
te
memoVisibility
:=
api
.
Priv
a
te
err
:=
json
.
Unmarshal
([]
byte
(
userMemoVisibilitySetting
.
Value
),
&
memoVisibility
)
if
err
!=
nil
{
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to unmarshal user setting value"
)
.
SetInternal
(
err
)
...
...
@@ -53,7 +53,7 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
memoCreate
.
Visibility
=
memoVisibility
}
else
{
// Private is the default memo visibility.
memoCreate
.
Visibility
=
api
.
Priv
i
te
memoCreate
.
Visibility
=
api
.
Priv
a
te
}
}
...
...
@@ -176,10 +176,10 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
contentSearch
:=
"#"
+
tag
+
" "
memoFind
.
ContentSearch
=
&
contentSearch
}
visibilitListStr
:=
c
.
QueryParam
(
"visibility"
)
if
visibilitListStr
!=
""
{
visibilit
y
ListStr
:=
c
.
QueryParam
(
"visibility"
)
if
visibilit
y
ListStr
!=
""
{
visibilityList
:=
[]
api
.
Visibility
{}
for
_
,
visibility
:=
range
strings
.
Split
(
visibilitListStr
,
","
)
{
for
_
,
visibility
:=
range
strings
.
Split
(
visibilit
y
ListStr
,
","
)
{
visibilityList
=
append
(
visibilityList
,
api
.
Visibility
(
visibility
))
}
memoFind
.
VisibilityList
=
visibilityList
...
...
@@ -271,7 +271,7 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
if
*
memoFind
.
CreatorID
!=
currentUserID
{
memoFind
.
VisibilityList
=
[]
api
.
Visibility
{
api
.
Public
,
api
.
Protected
}
}
else
{
memoFind
.
VisibilityList
=
[]
api
.
Visibility
{
api
.
Public
,
api
.
Protected
,
api
.
Priv
i
te
}
memoFind
.
VisibilityList
=
[]
api
.
Visibility
{
api
.
Public
,
api
.
Protected
,
api
.
Priv
a
te
}
}
}
...
...
@@ -313,10 +313,10 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
contentSearch
:=
"#"
+
tag
+
" "
memoFind
.
ContentSearch
=
&
contentSearch
}
visibilitListStr
:=
c
.
QueryParam
(
"visibility"
)
if
visibilitListStr
!=
""
{
visibilit
y
ListStr
:=
c
.
QueryParam
(
"visibility"
)
if
visibilit
y
ListStr
!=
""
{
visibilityList
:=
[]
api
.
Visibility
{}
for
_
,
visibility
:=
range
strings
.
Split
(
visibilitListStr
,
","
)
{
for
_
,
visibility
:=
range
strings
.
Split
(
visibilit
y
ListStr
,
","
)
{
visibilityList
=
append
(
visibilityList
,
api
.
Visibility
(
visibility
))
}
memoFind
.
VisibilityList
=
visibilityList
...
...
@@ -372,7 +372,7 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
}
userID
,
ok
:=
c
.
Get
(
getUserIDContextKey
())
.
(
int
)
if
memo
.
Visibility
==
api
.
Priv
i
te
{
if
memo
.
Visibility
==
api
.
Priv
a
te
{
if
!
ok
||
memo
.
CreatorID
!=
userID
{
return
echo
.
NewHTTPError
(
http
.
StatusForbidden
,
"this memo is private only"
)
}
...
...
server/resource.go
View file @
54271c15
...
...
@@ -93,13 +93,13 @@ func (s *Server) registerResourceRoutes(g *echo.Group) {
}
for
_
,
resource
:=
range
list
{
memoResour
e
ceList
,
err
:=
s
.
Store
.
FindMemoResourceList
(
ctx
,
&
api
.
MemoResourceFind
{
memoResourceList
,
err
:=
s
.
Store
.
FindMemoResourceList
(
ctx
,
&
api
.
MemoResourceFind
{
ResourceID
:
&
resource
.
ID
,
})
if
err
!=
nil
{
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to find memo resource list"
)
.
SetInternal
(
err
)
}
resource
.
LinkedMemoAmount
=
len
(
memoResour
e
ceList
)
resource
.
LinkedMemoAmount
=
len
(
memoResourceList
)
}
c
.
Response
()
.
Header
()
.
Set
(
echo
.
HeaderContentType
,
echo
.
MIMEApplicationJSONCharsetUTF8
)
...
...
store/store.go
View file @
54271c15
...
...
@@ -49,7 +49,7 @@ func (s *Store) Vacuum(ctx context.Context) error {
return
nil
}
// Exec vacuum records in a trans
ca
tion.
// Exec vacuum records in a trans
ac
tion.
func
vacuum
(
ctx
context
.
Context
,
tx
*
sql
.
Tx
)
error
{
if
err
:=
vacuumMemo
(
ctx
,
tx
);
err
!=
nil
{
return
err
...
...
web/src/components/AboutSiteDialog.tsx
View file @
54271c15
...
...
@@ -30,7 +30,7 @@ const AboutSiteDialog: React.FC<Props> = ({ destroy }: Props) => {
<
img
className=
"logo-img"
src=
"/logo-full.webp"
alt=
""
/>
<
p
>
{
t
(
"slogan"
)
}
</
p
>
<
br
/>
<
div
className=
"addtion-info-container"
>
<
div
className=
"add
i
tion-info-container"
>
<
GitHubBadge
/>
<>
{
t
(
"common.version"
)
}
:
...
...
web/src/components/CreateShortcutDialog.tsx
View file @
54271c15
...
...
@@ -192,7 +192,7 @@ const MemoFilterInputer: React.FC<MemoFilterInputerProps> = (props: MemoFilterIn
if
([
"AND"
,
"OR"
].
includes
(
value
))
{
handleFilterChange
(
index
,
{
...
filter
,
relation
:
value
as
MemoFilterR
a
lation
,
relation
:
value
as
MemoFilterR
e
lation
,
});
}
};
...
...
web/src/components/MemoEditor.tsx
View file @
54271c15
...
...
@@ -53,7 +53,7 @@ const MemoEditor = () => {
const
[
allowSave
,
setAllowSave
]
=
useState
<
boolean
>
(
false
);
const
prevGlobalStateRef
=
useRef
(
editorState
);
const
editorRef
=
useRef
<
EditorRefActions
>
(
null
);
const
tagSeletorRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
tagSele
c
torRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
memoVisibilityOptionSelectorItems
=
VISIBILITY_SELECTOR_ITEMS
.
map
((
item
)
=>
{
return
{
value
:
item
.
value
,
...
...
@@ -337,8 +337,8 @@ const MemoEditor = () => {
});
};
const
handleTagSeletorClick
=
useCallback
((
event
:
React
.
MouseEvent
)
=>
{
if
(
tagSele
torRef
.
current
!==
event
.
target
&&
tagSele
torRef
.
current
?.
contains
(
event
.
target
as
Node
))
{
const
handleTagSele
c
torClick
=
useCallback
((
event
:
React
.
MouseEvent
)
=>
{
if
(
tagSele
ctorRef
.
current
!==
event
.
target
&&
tagSelec
torRef
.
current
?.
contains
(
event
.
target
as
Node
))
{
editorRef
.
current
?.
insertText
(
`#
${(
event
.
target
as
HTMLElement
).
textContent
}
`
??
""
);
handleEditorFocus
();
}
...
...
@@ -415,7 +415,7 @@ const MemoEditor = () => {
<
div
className=
"common-tools-container"
>
<
div
className=
"action-btn tag-action"
>
<
Icon
.
Hash
className=
"icon-img"
/>
<
div
ref=
{
tagSele
torRef
}
className=
"tag-list"
onClick=
{
handleTagSele
torClick
}
>
<
div
ref=
{
tagSele
ctorRef
}
className=
"tag-list"
onClick=
{
handleTagSelec
torClick
}
>
{
tags
.
length
>
0
?
(
tags
.
map
((
tag
)
=>
{
return
(
...
...
web/src/components/MemoResources.tsx
View file @
54271c15
...
...
@@ -24,7 +24,7 @@ const MemoResources: React.FC<Props> = (props: Props) => {
const
availableResourceList
=
resourceList
.
filter
((
resource
)
=>
resource
.
type
.
startsWith
(
"image"
)
||
resource
.
type
.
startsWith
(
"video"
));
const
otherResourceList
=
resourceList
.
filter
((
resource
)
=>
!
availableResourceList
.
includes
(
resource
));
const
handlPreviewBtnClick
=
(
resource
:
Resource
)
=>
{
const
handl
e
PreviewBtnClick
=
(
resource
:
Resource
)
=>
{
const
resourceUrl
=
`
${
window
.
location
.
origin
}
/o/r/
${
resource
.
id
}
/
${
resource
.
filename
}
`
;
window
.
open
(
resourceUrl
);
};
...
...
@@ -54,7 +54,7 @@ const MemoResources: React.FC<Props> = (props: Props) => {
<
div
className=
"other-resource-wrapper"
>
{
otherResourceList
.
map
((
resource
)
=>
{
return
(
<
div
className=
"other-resource-container"
key=
{
resource
.
id
}
onClick=
{
()
=>
handlPreviewBtnClick
(
resource
)
}
>
<
div
className=
"other-resource-container"
key=
{
resource
.
id
}
onClick=
{
()
=>
handl
e
PreviewBtnClick
(
resource
)
}
>
<
Icon
.
FileText
className=
"icon-img"
/>
<
span
className=
"name-text"
>
{
resource
.
filename
}
</
span
>
</
div
>
...
...
web/src/components/MemosHeader.tsx
View file @
54271c15
...
...
@@ -3,7 +3,7 @@ import { memoService, shortcutService } from "../services";
import
{
useAppSelector
}
from
"../store"
;
import
Icon
from
"./Icon"
;
import
SearchBar
from
"./SearchBar"
;
import
{
toggleSide
r
bar
}
from
"./Sidebar"
;
import
{
toggleSidebar
}
from
"./Sidebar"
;
import
"../less/memos-header.less"
;
let
prevRequestTimestamp
=
Date
.
now
();
...
...
@@ -38,7 +38,7 @@ const MemosHeader = () => {
return
(
<
div
className=
"section-header-container memos-header-container"
>
<
div
className=
"title-container"
>
<
div
className=
"action-btn"
onClick=
{
()
=>
toggleSide
r
bar
(
true
)
}
>
<
div
className=
"action-btn"
onClick=
{
()
=>
toggleSidebar
(
true
)
}
>
<
Icon
.
Menu
className=
"icon-img"
/>
</
div
>
<
span
className=
"title-text"
onClick=
{
handleTitleTextClick
}
>
...
...
web/src/components/ResourcesDialog.tsx
View file @
54271c15
...
...
@@ -83,15 +83,15 @@ const ResourcesDialog: React.FC<Props> = (props: Props) => {
inputEl
.
click
();
};
const
getResouceUrl
=
useCallback
((
resource
:
Resource
)
=>
{
const
getResou
r
ceUrl
=
useCallback
((
resource
:
Resource
)
=>
{
return
`
${
window
.
location
.
origin
}
/o/r/
${
resource
.
id
}
/
${
resource
.
filename
}
`
;
},
[]);
const
handlePreviewBtnClick
=
(
resource
:
Resource
)
=>
{
const
resourceUrl
=
getResouceUrl
(
resource
);
const
resourceUrl
=
getResou
r
ceUrl
(
resource
);
if
(
resource
.
type
.
startsWith
(
"image"
))
{
showPreviewImageDialog
(
resources
.
filter
((
r
)
=>
r
.
type
.
startsWith
(
"image"
)).
map
((
r
)
=>
getResouceUrl
(
r
)),
resources
.
filter
((
r
)
=>
r
.
type
.
startsWith
(
"image"
)).
map
((
r
)
=>
getResou
r
ceUrl
(
r
)),
resources
.
findIndex
((
r
)
=>
r
.
id
===
resource
.
id
)
);
}
else
{
...
...
web/src/components/Sidebar.tsx
View file @
54271c15
...
...
@@ -17,7 +17,7 @@ const Sidebar = () => {
const
location
=
useAppSelector
((
state
)
=>
state
.
location
);
useEffect
(()
=>
{
toggleSide
r
bar
(
false
);
toggleSidebar
(
false
);
},
[
location
.
query
]);
const
handleSettingBtnClick
=
()
=>
{
...
...
@@ -26,7 +26,7 @@ const Sidebar = () => {
return
(
<>
<
div
className=
"mask"
onClick=
{
()
=>
toggleSide
r
bar
(
false
)
}
></
div
>
<
div
className=
"mask"
onClick=
{
()
=>
toggleSidebar
(
false
)
}
></
div
>
<
aside
className=
"sidebar-wrapper"
>
<
UserBanner
/>
<
UsageHeatMap
/>
...
...
@@ -52,7 +52,7 @@ const Sidebar = () => {
);
};
export
const
toggleSide
r
bar
=
(
show
?:
boolean
)
=>
{
export
const
toggleSidebar
=
(
show
?:
boolean
)
=>
{
const
sidebarEl
=
document
.
body
.
querySelector
(
".sidebar-wrapper"
)
as
HTMLDivElement
;
const
maskEl
=
document
.
body
.
querySelector
(
".mask"
)
as
HTMLDivElement
;
...
...
web/src/components/Toast.tsx
View file @
54271c15
...
...
@@ -14,22 +14,22 @@ type ToastItemProps = {
type
:
ToastType
;
content
:
string
;
duration
:
number
;
dest
or
y
:
FunctionType
;
dest
ro
y
:
FunctionType
;
};
const
Toast
:
React
.
FC
<
ToastItemProps
>
=
(
props
:
ToastItemProps
)
=>
{
const
{
dest
or
y
,
duration
}
=
props
;
const
{
dest
ro
y
,
duration
}
=
props
;
useEffect
(()
=>
{
if
(
duration
>
0
)
{
setTimeout
(()
=>
{
dest
or
y
();
dest
ro
y
();
},
duration
);
}
},
[]);
return
(
<
div
className=
"toast-container"
onClick=
{
dest
or
y
}
>
<
div
className=
"toast-container"
onClick=
{
dest
ro
y
}
>
<
p
className=
"content-text"
>
{
props
.
content
}
</
p
>
</
div
>
);
...
...
@@ -57,8 +57,8 @@ const initialToastHelper = () => {
shownToastContainers
.
push
([
toast
,
tempDiv
]);
const
cbs
=
{
dest
or
y
:
()
=>
{
tempDiv
.
classList
.
add
(
"dest
or
y"
);
dest
ro
y
:
()
=>
{
tempDiv
.
classList
.
add
(
"dest
ro
y"
);
setTimeout
(()
=>
{
if
(
!
tempDiv
.
parentElement
)
{
...
...
@@ -77,7 +77,7 @@ const initialToastHelper = () => {
},
};
toast
.
render
(<
Toast
{
...
config
}
dest
ory=
{
cbs
.
destor
y
}
/>);
toast
.
render
(<
Toast
{
...
config
}
dest
roy=
{
cbs
.
destro
y
}
/>);
setTimeout
(()
=>
{
tempDiv
.
classList
.
add
(
"showup"
);
...
...
web/src/components/UsageHeatMap.tsx
View file @
54271c15
...
...
@@ -11,11 +11,11 @@ const tableConfig = {
height
:
7
,
};
const
getInitialUsageStat
=
(
usedDaysAmount
:
number
,
beginDayTimest
e
mp
:
number
):
DailyUsageStat
[]
=>
{
const
getInitialUsageStat
=
(
usedDaysAmount
:
number
,
beginDayTimest
a
mp
:
number
):
DailyUsageStat
[]
=>
{
const
initialUsageStat
:
DailyUsageStat
[]
=
[];
for
(
let
i
=
1
;
i
<=
usedDaysAmount
;
i
++
)
{
initialUsageStat
.
push
({
timestamp
:
beginDayTimest
e
mp
+
DAILY_TIMESTAMP
*
i
,
timestamp
:
beginDayTimest
a
mp
+
DAILY_TIMESTAMP
*
i
,
count
:
0
,
});
}
...
...
@@ -32,19 +32,19 @@ const UsageHeatMap = () => {
const
todayDay
=
new
Date
(
todayTimeStamp
).
getDay
()
+
1
;
const
nullCell
=
new
Array
(
7
-
todayDay
).
fill
(
0
);
const
usedDaysAmount
=
(
tableConfig
.
width
-
1
)
*
tableConfig
.
height
+
todayDay
;
const
beginDayTimest
e
mp
=
todayTimeStamp
-
usedDaysAmount
*
DAILY_TIMESTAMP
;
const
beginDayTimest
a
mp
=
todayTimeStamp
-
usedDaysAmount
*
DAILY_TIMESTAMP
;
const
{
memos
}
=
useAppSelector
((
state
)
=>
state
.
memo
);
const
[
allStat
,
setAllStat
]
=
useState
<
DailyUsageStat
[]
>
(
getInitialUsageStat
(
usedDaysAmount
,
beginDayTimest
e
mp
));
const
[
allStat
,
setAllStat
]
=
useState
<
DailyUsageStat
[]
>
(
getInitialUsageStat
(
usedDaysAmount
,
beginDayTimest
a
mp
));
const
[
currentStat
,
setCurrentStat
]
=
useState
<
DailyUsageStat
|
null
>
(
null
);
const
containerElRef
=
useRef
<
HTMLDivElement
>
(
null
);
useEffect
(()
=>
{
getMemoStats
(
userService
.
getCurrentUserId
())
.
then
(({
data
:
{
data
}
})
=>
{
const
newStat
:
DailyUsageStat
[]
=
getInitialUsageStat
(
usedDaysAmount
,
beginDayTimest
e
mp
);
const
newStat
:
DailyUsageStat
[]
=
getInitialUsageStat
(
usedDaysAmount
,
beginDayTimest
a
mp
);
for
(
const
record
of
data
)
{
const
index
=
(
utils
.
getDateStampByDate
(
record
*
1000
)
-
beginDayTimest
e
mp
)
/
(
1000
*
3600
*
24
)
-
1
;
const
index
=
(
utils
.
getDateStampByDate
(
record
*
1000
)
-
beginDayTimest
a
mp
)
/
(
1000
*
3600
*
24
)
-
1
;
if
(
index
>=
0
)
{
newStat
[
index
].
count
+=
1
;
}
...
...
web/src/components/common/DatePicker.tsx
View file @
54271c15
...
...
@@ -6,7 +6,7 @@ import "../../less/common/date-picker.less";
interface
DatePickerProps
{
className
?:
string
;
datestamp
:
DateStamp
;
handleDateStampChange
:
(
dat
a
stamp
:
DateStamp
)
=>
void
;
handleDateStampChange
:
(
dat
e
stamp
:
DateStamp
)
=>
void
;
}
const
DatePicker
:
React
.
FC
<
DatePickerProps
>
=
(
props
:
DatePickerProps
)
=>
{
...
...
web/src/components/common/Selector.tsx
View file @
54271c15
...
...
@@ -26,7 +26,7 @@ const Selector: React.FC<Props> = (props: Props) => {
const
{
t
}
=
useTranslation
();
const
[
showSelector
,
toggleSelectorStatus
]
=
useToggle
(
false
);
const
seletorElRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
sele
c
torElRef
=
useRef
<
HTMLDivElement
>
(
null
);
let
currentItem
=
nullItem
;
for
(
const
d
of
dataSource
)
{
...
...
@@ -39,7 +39,7 @@ const Selector: React.FC<Props> = (props: Props) => {
useEffect
(()
=>
{
if
(
showSelector
)
{
const
handleClickOutside
=
(
event
:
MouseEvent
)
=>
{
if
(
!
seletorElRef
.
current
?.
contains
(
event
.
target
as
Node
))
{
if
(
!
sele
c
torElRef
.
current
?.
contains
(
event
.
target
as
Node
))
{
toggleSelectorStatus
(
false
);
}
};
...
...
@@ -63,7 +63,7 @@ const Selector: React.FC<Props> = (props: Props) => {
};
return
(
<
div
className=
{
`selector-wrapper ${className ?? ""}`
}
ref=
{
seletorElRef
}
>
<
div
className=
{
`selector-wrapper ${className ?? ""}`
}
ref=
{
sele
c
torElRef
}
>
<
div
className=
{
`current-value-container ${showSelector ? "active" : ""}`
}
onClick=
{
handleCurrentValueClick
}
>
<
span
className=
"value-text"
>
{
currentItem
.
text
}
</
span
>
<
span
className=
"arrow-text"
>
...
...
web/src/hooks/useToggle.ts
View file @
54271c15
...
...
@@ -5,7 +5,7 @@ const useToggle = (initialState = false): [boolean, (nextState?: boolean) => voi
// Initialize the state
const
[
state
,
setState
]
=
useState
(
initialState
);
// Define and memorize toggler function in case we pass down the com
op
nent,
// Define and memorize toggler function in case we pass down the com
po
nent,
// This function change the boolean value to it's opposite value
const
toggle
=
useCallback
((
nextState
?:
boolean
)
=>
{
if
(
nextState
!==
undefined
)
{
...
...
web/src/labs/marked/parser/Blockquote.ts
View file @
54271c15
...
...
@@ -12,7 +12,7 @@ const renderer = (rawStr: string): string => {
};
export
default
{
name
:
"blockq
ou
te"
,
name
:
"blockq
uo
te"
,
regex
:
BLOCKQUOTE_REG
,
renderer
,
};
web/src/less/about-site-dialog.less
View file @
54271c15
...
...
@@ -19,7 +19,7 @@
@apply font-mono mx-1;
}
> .addtion-info-container {
> .add
i
tion-info-container {
@apply flex flex-row text-sm justify-start items-center;
> .github-badge-container {
...
...
web/src/less/home.less
View file @
54271c15
...
...
@@ -21,7 +21,7 @@
background-color: #f6f5f4;
}
> .addtion-btn-container {
> .add
i
tion-btn-container {
@apply fixed bottom-12 left-1/2 -translate-x-1/2;
> .btn {
...
...
web/src/pages/Home.tsx
View file @
54271c15
...
...
@@ -48,7 +48,7 @@ function Home() {
</
div
>
<
MemoList
/>
{
userService
.
isVisitorMode
()
&&
(
<
div
className=
"addtion-btn-container"
>
<
div
className=
"add
i
tion-btn-container"
>
{
user
?
(
<
button
className=
"btn"
onClick=
{
()
=>
(
window
.
location
.
href
=
"/"
)
}
>
<
span
className=
"icon"
>
🏠
</
span
>
{
t
(
"common.back-to-home"
)
}
...
...
web/src/services/userService.ts
View file @
54271c15
...
...
@@ -5,7 +5,7 @@ import store from "../store";
import
{
setLocale
}
from
"../store/modules/global"
;
import
{
setUser
,
patchUser
,
setHost
,
setOwner
}
from
"../store/modules/user"
;
const
defaul
e
Setting
:
Setting
=
{
const
defaul
t
Setting
:
Setting
=
{
locale
:
"en"
,
memoVisibility
:
"PRIVATE"
,
memoDisplayTsOption
:
"created_ts"
,
...
...
@@ -13,7 +13,7 @@ const defauleSetting: Setting = {
export
const
convertResponseModelUser
=
(
user
:
User
):
User
=>
{
const
setting
:
Setting
=
{
...
defaul
e
Setting
,
...
defaul
t
Setting
,
};
if
(
user
.
userSettingList
)
{
...
...
web/src/types/filter.d.ts
View file @
54271c15
type
MemoFilterR
a
lation
=
"AND"
|
"OR"
;
type
MemoFilterR
e
lation
=
"AND"
|
"OR"
;
interface
BaseFilter
{
type
:
FilterType
;
...
...
@@ -6,7 +6,7 @@ interface BaseFilter {
operator
:
string
;
value
:
string
;
};
relation
:
MemoFilterR
a
lation
;
relation
:
MemoFilterR
e
lation
;
}
interface
TagFilter
extends
BaseFilter
{
...
...
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