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
b884327a
Commit
b884327a
authored
Sep 03, 2022
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update eslint rules
parent
4743818f
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
69 additions
and
93 deletions
+69
-93
.eslintrc.json
web/.eslintrc.json
+0
-1
AboutSiteDialog.tsx
web/src/components/AboutSiteDialog.tsx
+1
-1
ArchivedMemoDialog.tsx
web/src/components/ArchivedMemoDialog.tsx
+1
-1
ChangePasswordDialog.tsx
web/src/components/ChangePasswordDialog.tsx
+1
-1
GitHubBadge.tsx
web/src/components/GitHubBadge.tsx
+1
-3
MemoEditor.tsx
web/src/components/MemoEditor.tsx
+1
-3
MemoFilter.tsx
web/src/components/MemoFilter.tsx
+1
-3
MemoList.tsx
web/src/components/MemoList.tsx
+1
-3
MemosHeader.tsx
web/src/components/MemosHeader.tsx
+1
-3
ResourcesDialog.tsx
web/src/components/ResourcesDialog.tsx
+1
-1
SearchBar.tsx
web/src/components/SearchBar.tsx
+1
-3
SettingDialog.tsx
web/src/components/SettingDialog.tsx
+1
-1
MemberSection.tsx
web/src/components/Settings/MemberSection.tsx
+1
-3
MyAccountSection.tsx
web/src/components/Settings/MyAccountSection.tsx
+1
-3
PreferencesSection.tsx
web/src/components/Settings/PreferencesSection.tsx
+1
-3
ShortcutList.tsx
web/src/components/ShortcutList.tsx
+1
-3
Sidebar.tsx
web/src/components/Sidebar.tsx
+1
-3
TagList.tsx
web/src/components/TagList.tsx
+1
-3
Toast.tsx
web/src/components/Toast.tsx
+42
-37
UsageHeatMap.tsx
web/src/components/UsageHeatMap.tsx
+1
-3
UserBanner.tsx
web/src/components/UserBanner.tsx
+1
-3
consts.ts
web/src/helpers/consts.ts
+0
-3
shortcut-list.less
web/src/less/shortcut-list.less
+6
-2
toast.less
web/src/less/toast.less
+1
-0
Auth.tsx
web/src/pages/Auth.tsx
+1
-3
No files found.
web/.eslintrc.json
View file @
b884327a
...
...
@@ -21,7 +21,6 @@
"endOfLine"
:
"auto"
}
],
"@typescript-eslint/no-empty-interface"
:
[
"off"
],
"@typescript-eslint/no-explicit-any"
:
[
"off"
],
"react/react-in-jsx-scope"
:
"off"
},
...
...
web/src/components/AboutSiteDialog.tsx
View file @
b884327a
...
...
@@ -7,7 +7,7 @@ import { generateDialog } from "./Dialog";
import
GitHubBadge
from
"./GitHubBadge"
;
import
"../less/about-site-dialog.less"
;
interface
Props
extends
DialogProps
{}
type
Props
=
DialogProps
;
const
AboutSiteDialog
:
React
.
FC
<
Props
>
=
({
destroy
}:
Props
)
=>
{
const
{
t
}
=
useI18n
();
...
...
web/src/components/ArchivedMemoDialog.tsx
View file @
b884327a
...
...
@@ -8,7 +8,7 @@ import toastHelper from "./Toast";
import
ArchivedMemo
from
"./ArchivedMemo"
;
import
"../less/archived-memo-dialog.less"
;
interface
Props
extends
DialogProps
{}
type
Props
=
DialogProps
;
const
ArchivedMemoDialog
:
React
.
FC
<
Props
>
=
(
props
:
Props
)
=>
{
const
{
destroy
}
=
props
;
...
...
web/src/components/ChangePasswordDialog.tsx
View file @
b884327a
...
...
@@ -14,7 +14,7 @@ const validateConfig: ValidatorConfig = {
noChinese
:
true
,
};
interface
Props
extends
DialogProps
{}
type
Props
=
DialogProps
;
const
ChangePasswordDialog
:
React
.
FC
<
Props
>
=
({
destroy
}:
Props
)
=>
{
const
{
t
}
=
useI18n
();
...
...
web/src/components/GitHubBadge.tsx
View file @
b884327a
...
...
@@ -3,9 +3,7 @@ import * as api from "../helpers/api";
import
Icon
from
"./Icon"
;
import
"../less/github-badge.less"
;
interface
Props
{}
const
GitHubBadge
:
React
.
FC
<
Props
>
=
()
=>
{
const
GitHubBadge
=
()
=>
{
const
[
starCount
,
setStarCount
]
=
useState
(
0
);
useEffect
(()
=>
{
...
...
web/src/components/MemoEditor.tsx
View file @
b884327a
...
...
@@ -9,14 +9,12 @@ import toastHelper from "./Toast";
import
Editor
,
{
EditorRefActions
}
from
"./Editor/Editor"
;
import
"../less/memo-editor.less"
;
interface
Props
{}
interface
State
{
isUploadingResource
:
boolean
;
fullscreen
:
boolean
;
}
const
MemoEditor
:
React
.
FC
<
Props
>
=
()
=>
{
const
MemoEditor
=
()
=>
{
const
{
t
,
locale
}
=
useI18n
();
const
user
=
useAppSelector
((
state
)
=>
state
.
user
.
user
);
const
editorState
=
useAppSelector
((
state
)
=>
state
.
editor
);
...
...
web/src/components/MemoFilter.tsx
View file @
b884327a
...
...
@@ -4,9 +4,7 @@ import * as utils from "../helpers/utils";
import
{
getTextWithMemoType
}
from
"../helpers/filter"
;
import
"../less/memo-filter.less"
;
interface
FilterProps
{}
const
MemoFilter
:
React
.
FC
<
FilterProps
>
=
()
=>
{
const
MemoFilter
=
()
=>
{
const
query
=
useAppSelector
((
state
)
=>
state
.
location
.
query
);
useAppSelector
((
state
)
=>
state
.
shortcut
.
shortcuts
);
const
{
tag
:
tagQuery
,
duration
,
type
:
memoType
,
text
:
textQuery
,
shortcutId
}
=
query
;
...
...
web/src/components/MemoList.tsx
View file @
b884327a
...
...
@@ -10,9 +10,7 @@ import Only from "./common/OnlyWhen";
import
Memo
from
"./Memo"
;
import
"../less/memo-list.less"
;
interface
Props
{}
const
MemoList
:
React
.
FC
<
Props
>
=
()
=>
{
const
MemoList
=
()
=>
{
const
{
t
}
=
useI18n
();
const
query
=
useAppSelector
((
state
)
=>
state
.
location
.
query
);
const
{
memos
,
isFetching
}
=
useAppSelector
((
state
)
=>
state
.
memo
);
...
...
web/src/components/MemosHeader.tsx
View file @
b884327a
...
...
@@ -8,9 +8,7 @@ import "../less/memos-header.less";
let
prevRequestTimestamp
=
Date
.
now
();
interface
Props
{}
const
MemosHeader
:
React
.
FC
<
Props
>
=
()
=>
{
const
MemosHeader
=
()
=>
{
const
query
=
useAppSelector
((
state
)
=>
state
.
location
.
query
);
const
shortcuts
=
useAppSelector
((
state
)
=>
state
.
shortcut
.
shortcuts
);
const
[
titleText
,
setTitleText
]
=
useState
(
"MEMOS"
);
...
...
web/src/components/ResourcesDialog.tsx
View file @
b884327a
...
...
@@ -11,7 +11,7 @@ import Icon from "./Icon";
import
toastHelper
from
"./Toast"
;
import
"../less/resources-dialog.less"
;
interface
Props
extends
DialogProps
{}
type
Props
=
DialogProps
;
interface
State
{
resources
:
Resource
[];
...
...
web/src/components/SearchBar.tsx
View file @
b884327a
...
...
@@ -4,9 +4,7 @@ import { memoSpecialTypes } from "../helpers/filter";
import
Icon
from
"./Icon"
;
import
"../less/search-bar.less"
;
interface
Props
{}
const
SearchBar
:
React
.
FC
<
Props
>
=
()
=>
{
const
SearchBar
=
()
=>
{
const
memoType
=
useAppSelector
((
state
)
=>
state
.
location
.
query
?.
type
);
const
handleMemoTypeItemClick
=
(
type
:
MemoSpecType
|
undefined
)
=>
{
...
...
web/src/components/SettingDialog.tsx
View file @
b884327a
...
...
@@ -8,7 +8,7 @@ import PreferencesSection from "./Settings/PreferencesSection";
import
MemberSection
from
"./Settings/MemberSection"
;
import
"../less/setting-dialog.less"
;
interface
Props
extends
DialogProps
{}
type
Props
=
DialogProps
;
type
SettingSection
=
"my-account"
|
"preferences"
|
"member"
;
...
...
web/src/components/Settings/MemberSection.tsx
View file @
b884327a
...
...
@@ -9,14 +9,12 @@ import Dropdown from "../common/Dropdown";
import
{
showCommonDialog
}
from
"../Dialog/CommonDialog"
;
import
"../../less/settings/member-section.less"
;
interface
Props
{}
interface
State
{
createUserEmail
:
string
;
createUserPassword
:
string
;
}
const
PreferencesSection
:
React
.
FC
<
Props
>
=
()
=>
{
const
PreferencesSection
=
()
=>
{
const
{
t
}
=
useI18n
();
const
currentUser
=
useAppSelector
((
state
)
=>
state
.
user
.
user
);
const
[
state
,
setState
]
=
useState
<
State
>
({
...
...
web/src/components/Settings/MyAccountSection.tsx
View file @
b884327a
...
...
@@ -15,9 +15,7 @@ const validateConfig: ValidatorConfig = {
noChinese
:
true
,
};
interface
Props
{}
const
MyAccountSection
:
React
.
FC
<
Props
>
=
()
=>
{
const
MyAccountSection
=
()
=>
{
const
{
t
}
=
useI18n
();
const
user
=
useAppSelector
((
state
)
=>
state
.
user
.
user
as
User
);
const
[
username
,
setUsername
]
=
useState
<
string
>
(
user
.
name
);
...
...
web/src/components/Settings/PreferencesSection.tsx
View file @
b884327a
...
...
@@ -6,8 +6,6 @@ import Selector from "../common/Selector";
import
BetaBadge
from
"../BetaBadge"
;
import
"../../less/settings/preferences-section.less"
;
interface
Props
{}
const
localeSelectorItems
=
[
{
text
:
"English"
,
...
...
@@ -30,7 +28,7 @@ const editorFontStyleSelectorItems = [
},
];
const
PreferencesSection
:
React
.
FC
<
Props
>
=
()
=>
{
const
PreferencesSection
=
()
=>
{
const
{
t
}
=
useI18n
();
const
{
setting
}
=
useAppSelector
((
state
)
=>
state
.
user
.
user
as
User
);
...
...
web/src/components/ShortcutList.tsx
View file @
b884327a
...
...
@@ -10,9 +10,7 @@ import toastHelper from "./Toast";
import
showCreateShortcutDialog
from
"./CreateShortcutDialog"
;
import
"../less/shortcut-list.less"
;
interface
Props
{}
const
ShortcutList
:
React
.
FC
<
Props
>
=
()
=>
{
const
ShortcutList
=
()
=>
{
const
query
=
useAppSelector
((
state
)
=>
state
.
location
.
query
);
const
shortcuts
=
useAppSelector
((
state
)
=>
state
.
shortcut
.
shortcuts
);
const
loadingState
=
useLoading
();
...
...
web/src/components/Sidebar.tsx
View file @
b884327a
...
...
@@ -12,9 +12,7 @@ import ShortcutList from "./ShortcutList";
import
TagList
from
"./TagList"
;
import
"../less/siderbar.less"
;
interface
Props
{}
const
Sidebar
:
React
.
FC
<
Props
>
=
()
=>
{
const
Sidebar
=
()
=>
{
const
{
t
}
=
useI18n
();
const
handleMyAccountBtnClick
=
()
=>
{
...
...
web/src/components/TagList.tsx
View file @
b884327a
...
...
@@ -14,9 +14,7 @@ interface Tag {
subTags
:
Tag
[];
}
interface
Props
{}
const
TagList
:
React
.
FC
<
Props
>
=
()
=>
{
const
TagList
=
()
=>
{
const
{
t
}
=
useI18n
();
const
{
memos
,
tags
:
tagsText
}
=
useAppSelector
((
state
)
=>
state
.
memo
);
const
query
=
useAppSelector
((
state
)
=>
state
.
location
.
query
);
...
...
web/src/components/Toast.tsx
View file @
b884327a
import
{
useEffect
}
from
"react"
;
import
{
createRoot
,
Root
}
from
"react-dom/client"
;
import
{
TOAST_ANIMATION_DURATION
}
from
"../helpers/consts"
;
import
"../less/toast.less"
;
type
ToastType
=
"normal"
|
"success"
|
"info"
|
"error"
;
...
...
@@ -36,42 +35,26 @@ const Toast: React.FC<ToastItemProps> = (props: ToastItemProps) => {
);
};
class
ToastHelper
{
private
shownToastAmount
=
0
;
private
toastWrapper
:
HTMLDivElement
;
private
shownToastContainers
:
[
Root
,
HTMLDivElement
][]
=
[];
// toast animation duration.
const
TOAST_ANIMATION_DURATION
=
400
;
constructor
()
{
const
wrapperClassName
=
"toast-list-container"
;
const
tempDiv
=
document
.
createElement
(
"div"
);
tempDiv
.
className
=
wrapperClassName
;
document
.
body
.
appendChild
(
tempDiv
);
this
.
toastWrapper
=
tempDiv
;
}
public
info
=
(
content
:
string
,
duration
=
3000
)
=>
{
return
this
.
showToast
({
type
:
"normal"
,
content
,
duration
});
};
const
initialToastHelper
=
()
=>
{
const
shownToastContainers
:
[
Root
,
HTMLDivElement
][]
=
[];
let
shownToastAmount
=
0
;
public
success
=
(
content
:
string
,
duration
=
3000
)
=>
{
return
this
.
showToast
({
type
:
"success"
,
content
,
duration
});
};
public
error
=
(
content
:
string
,
duration
=
3000
)
=>
{
return
this
.
showToast
({
type
:
"error"
,
content
,
duration
});
};
const
wrapperClassName
=
"toast-list-container"
;
const
tempDiv
=
document
.
createElement
(
"div"
);
tempDiv
.
className
=
wrapperClassName
;
document
.
body
.
appendChild
(
tempDiv
);
const
toastWrapper
=
tempDiv
;
private
showToast
=
(
config
:
ToastConfig
)
=>
{
const
showToast
=
(
config
:
ToastConfig
)
=>
{
const
tempDiv
=
document
.
createElement
(
"div"
);
const
toast
=
createRoot
(
tempDiv
);
tempDiv
.
className
=
`toast-wrapper
${
config
.
type
}
`
;
this
.
toastWrapper
.
appendChild
(
tempDiv
);
this
.
shownToastAmount
++
;
this
.
shownToastContainers
.
push
([
toast
,
tempDiv
]);
setTimeout
(()
=>
{
tempDiv
.
classList
.
add
(
"showup"
);
},
0
);
toastWrapper
.
appendChild
(
tempDiv
);
shownToastAmount
++
;
shownToastContainers
.
push
([
toast
,
tempDiv
]);
const
cbs
=
{
destory
:
()
=>
{
...
...
@@ -82,13 +65,13 @@ class ToastHelper {
return
;
}
this
.
shownToastAmount
--
;
if
(
this
.
shownToastAmount
===
0
)
{
for
(
const
[
root
,
tempDiv
]
of
this
.
shownToastContainers
)
{
shownToastAmount
--
;
if
(
shownToastAmount
===
0
)
{
for
(
const
[
root
,
tempDiv
]
of
shownToastContainers
)
{
root
.
unmount
();
tempDiv
.
remove
();
}
this
.
shownToastContainers
.
splice
(
0
,
this
.
shownToastContainers
.
length
);
shownToastContainers
.
splice
(
0
,
shownToastContainers
.
length
);
}
},
TOAST_ANIMATION_DURATION
);
},
...
...
@@ -96,10 +79,32 @@ class ToastHelper {
toast
.
render
(<
Toast
{
...
config
}
destory=
{
cbs
.
destory
}
/>);
setTimeout
(()
=>
{
tempDiv
.
classList
.
add
(
"showup"
);
},
10
);
return
cbs
;
};
}
const
toastHelper
=
new
ToastHelper
();
const
info
=
(
content
:
string
,
duration
=
3000
)
=>
{
return
showToast
({
type
:
"normal"
,
content
,
duration
});
};
const
success
=
(
content
:
string
,
duration
=
3000
)
=>
{
return
showToast
({
type
:
"success"
,
content
,
duration
});
};
const
error
=
(
content
:
string
,
duration
=
3000
)
=>
{
return
showToast
({
type
:
"error"
,
content
,
duration
});
};
return
{
info
,
success
,
error
,
};
};
const
toastHelper
=
initialToastHelper
();
export
default
toastHelper
;
web/src/components/UsageHeatMap.tsx
View file @
b884327a
...
...
@@ -26,9 +26,7 @@ interface DailyUsageStat {
count
:
number
;
}
interface
Props
{}
const
UsageHeatMap
:
React
.
FC
<
Props
>
=
()
=>
{
const
UsageHeatMap
=
()
=>
{
const
todayTimeStamp
=
utils
.
getDateStampByDate
(
Date
.
now
());
const
todayDay
=
new
Date
(
todayTimeStamp
).
getDay
()
+
1
;
const
nullCell
=
new
Array
(
7
-
todayDay
).
fill
(
0
);
...
...
web/src/components/UserBanner.tsx
View file @
b884327a
...
...
@@ -7,9 +7,7 @@ import Icon from "./Icon";
import
MenuBtnsPopup
from
"./MenuBtnsPopup"
;
import
"../less/user-banner.less"
;
interface
Props
{}
const
UserBanner
:
React
.
FC
<
Props
>
=
()
=>
{
const
UserBanner
=
()
=>
{
const
{
user
,
owner
}
=
useAppSelector
((
state
)
=>
state
.
user
);
const
{
memos
,
tags
}
=
useAppSelector
((
state
)
=>
state
.
memo
);
const
[
shouldShowPopupBtns
,
setShouldShowPopupBtns
]
=
useState
(
false
);
...
...
web/src/helpers/consts.ts
View file @
b884327a
...
...
@@ -4,9 +4,6 @@ export const UNKNOWN_ID = -1;
// default animation duration
export
const
ANIMATION_DURATION
=
200
;
// toast animation duration
export
const
TOAST_ANIMATION_DURATION
=
400
;
// millisecond in a day
export
const
DAILY_TIMESTAMP
=
3600
*
24
*
1000
;
...
...
web/src/less/shortcut-list.less
View file @
b884327a
...
...
@@ -54,10 +54,14 @@
@apply flex-row justify-end items-center hidden shrink-0;
> .action-btn {
@apply flex flex-row justify-center items-center
w-6 h-6 shrink-0
;
@apply flex flex-row justify-center items-center;
&.toggle-btn {
@apply w-4 h-auto text-gray-600;
@apply text-gray-600;
> .icon-img {
@apply w-4 h-auto;
}
&:hover {
& + .action-btns-wrapper {
...
...
web/src/less/toast.less
View file @
b884327a
...
...
@@ -6,6 +6,7 @@
> .toast-wrapper {
@apply flex flex-col justify-start items-start relative left-full invisible text-base cursor-pointer shadow-lg rounded bg-white mt-6 py-2 px-4;
min-width: 6em;
left: calc(100% + 32px);
transition: all 0.4s ease;
&.showup {
...
...
web/src/pages/Auth.tsx
View file @
b884327a
...
...
@@ -9,8 +9,6 @@ import Only from "../components/common/OnlyWhen";
import
toastHelper
from
"../components/Toast"
;
import
"../less/auth.less"
;
interface
Props
{}
const
validateConfig
:
ValidatorConfig
=
{
minLength
:
4
,
maxLength
:
24
,
...
...
@@ -18,7 +16,7 @@ const validateConfig: ValidatorConfig = {
noChinese
:
true
,
};
const
Auth
:
React
.
FC
<
Props
>
=
()
=>
{
const
Auth
=
()
=>
{
const
{
t
,
locale
}
=
useI18n
();
const
pageLoadingState
=
useLoading
(
true
);
const
[
siteHost
,
setSiteHost
]
=
useState
<
User
>
();
...
...
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