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
778282ae
Commit
778282ae
authored
Oct 03, 2022
by
steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update resource dialog
parent
85dc29bf
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
15 deletions
+24
-15
MemoEditor.tsx
web/src/components/MemoEditor.tsx
+6
-7
ResourcesDialog.tsx
web/src/components/ResourcesDialog.tsx
+6
-1
UserBanner.tsx
web/src/components/UserBanner.tsx
+7
-4
memo-editor.less
web/src/less/memo-editor.less
+3
-3
resource.d.ts
web/src/types/modules/resource.d.ts
+2
-0
No files found.
web/src/components/MemoEditor.tsx
View file @
778282ae
import
{
IEmojiData
}
from
"emoji-picker-react"
;
import
{
IEmojiData
}
from
"emoji-picker-react"
;
import
React
,
{
useCallback
,
useEffect
,
useMemo
,
useRef
,
useState
}
from
"react"
;
import
React
,
{
useCallback
,
useEffect
,
useMemo
,
useRef
,
useState
}
from
"react"
;
import
{
useTranslation
}
from
"react-i18next"
;
import
{
useTranslation
}
from
"react-i18next"
;
import
{
deleteMemoResource
,
getMemoResourceList
,
upsertMemoResource
}
from
"../helpers/api"
;
import
{
deleteMemoResource
,
upsertMemoResource
}
from
"../helpers/api"
;
import
{
UNKNOWN_ID
}
from
"../helpers/consts"
;
import
{
UNKNOWN_ID
}
from
"../helpers/consts"
;
import
{
editorStateService
,
locationService
,
memoService
,
resourceService
}
from
"../services"
;
import
{
editorStateService
,
locationService
,
memoService
,
resourceService
}
from
"../services"
;
import
{
useAppSelector
}
from
"../store"
;
import
{
useAppSelector
}
from
"../store"
;
...
@@ -64,11 +64,9 @@ const MemoEditor: React.FC = () => {
...
@@ -64,11 +64,9 @@ const MemoEditor: React.FC = () => {
)
{
)
{
const
memo
=
memoService
.
getMemoById
(
editorState
.
editMemoId
??
UNKNOWN_ID
);
const
memo
=
memoService
.
getMemoById
(
editorState
.
editMemoId
??
UNKNOWN_ID
);
if
(
memo
)
{
if
(
memo
)
{
getMemoResourceList
(
memo
.
id
).
then
(({
data
:
{
data
}
})
=>
{
setState
({
setState
({
...
state
,
...
state
,
resourceList
:
memo
.
resourceList
,
resourceList
:
data
,
});
});
});
editorRef
.
current
?.
setContent
(
memo
.
content
??
""
);
editorRef
.
current
?.
setContent
(
memo
.
content
??
""
);
editorRef
.
current
?.
focus
();
editorRef
.
current
?.
focus
();
...
@@ -341,7 +339,8 @@ const MemoEditor: React.FC = () => {
...
@@ -341,7 +339,8 @@ const MemoEditor: React.FC = () => {
</
div
>
</
div
>
<
div
className=
"btns-container"
>
<
div
className=
"btns-container"
>
<
button
className=
"action-btn confirm-btn"
disabled=
{
!
allowSave
}
onClick=
{
handleSaveBtnClick
}
>
<
button
className=
"action-btn confirm-btn"
disabled=
{
!
allowSave
}
onClick=
{
handleSaveBtnClick
}
>
{
t
(
"editor.save"
)
}
<
span
className=
"icon-text"
>
✍️
</
span
>
{
t
(
"editor.save"
)
}
<
img
className=
"icon-img"
src=
"/logo.webp"
/>
</
button
>
</
button
>
</
div
>
</
div
>
</
div
>
</
div
>
...
...
web/src/components/ResourcesDialog.tsx
View file @
778282ae
...
@@ -104,9 +104,14 @@ const ResourcesDialog: React.FC<Props> = (props: Props) => {
...
@@ -104,9 +104,14 @@ const ResourcesDialog: React.FC<Props> = (props: Props) => {
};
};
const
handleDeleteResourceBtnClick
=
(
resource
:
Resource
)
=>
{
const
handleDeleteResourceBtnClick
=
(
resource
:
Resource
)
=>
{
let
warningText
=
"Are you sure to delete this resource? THIS ACTION IS IRREVERSIABLE.❗️"
;
if
(
resource
.
linkedMemoAmount
>
0
)
{
warningText
=
warningText
+
`\nLinked memo amount:
${
resource
.
linkedMemoAmount
}
`
;
}
showCommonDialog
({
showCommonDialog
({
title
:
`Delete Resource`
,
title
:
`Delete Resource`
,
content
:
`Are you sure to delete this resource? THIS ACTION IS IRREVERSIABLE.❗️`
,
content
:
warningText
,
style
:
"warning"
,
style
:
"warning"
,
onConfirm
:
async
()
=>
{
onConfirm
:
async
()
=>
{
await
resourceService
.
deleteResourceById
(
resource
.
id
);
await
resourceService
.
deleteResourceById
(
resource
.
id
);
...
...
web/src/components/UserBanner.tsx
View file @
778282ae
...
@@ -76,25 +76,28 @@ const UserBanner = () => {
...
@@ -76,25 +76,28 @@ const UserBanner = () => {
{
!
userService
.
isVisitorMode
()
&&
(
{
!
userService
.
isVisitorMode
()
&&
(
<>
<>
<
button
<
button
className=
"w-full px-3 text-left leading-10 cursor-pointer rounded hover:bg-gray-100"
className=
"w-full px-3
whitespace-nowrap
text-left leading-10 cursor-pointer rounded hover:bg-gray-100"
onClick=
{
handleResourcesBtnClick
}
onClick=
{
handleResourcesBtnClick
}
>
>
<
span
className=
"mr-1"
>
🌄
</
span
>
{
t
(
"sidebar.resources"
)
}
<
span
className=
"mr-1"
>
🌄
</
span
>
{
t
(
"sidebar.resources"
)
}
</
button
>
</
button
>
<
button
<
button
className=
"w-full px-3 text-left leading-10 cursor-pointer rounded hover:bg-gray-100"
className=
"w-full px-3
whitespace-nowrap
text-left leading-10 cursor-pointer rounded hover:bg-gray-100"
onClick=
{
handleArchivedBtnClick
}
onClick=
{
handleArchivedBtnClick
}
>
>
<
span
className=
"mr-1"
>
🗂
</
span
>
{
t
(
"sidebar.archived"
)
}
<
span
className=
"mr-1"
>
🗂
</
span
>
{
t
(
"sidebar.archived"
)
}
</
button
>
</
button
>
</>
</>
)
}
)
}
<
button
className=
"w-full px-3 text-left leading-10 cursor-pointer rounded hover:bg-gray-100"
onClick=
{
handleAboutBtnClick
}
>
<
button
className=
"w-full px-3 whitespace-nowrap text-left leading-10 cursor-pointer rounded hover:bg-gray-100"
onClick=
{
handleAboutBtnClick
}
>
<
span
className=
"mr-1"
>
🤠
</
span
>
{
t
(
"common.about"
)
}
<
span
className=
"mr-1"
>
🤠
</
span
>
{
t
(
"common.about"
)
}
</
button
>
</
button
>
{
!
userService
.
isVisitorMode
()
&&
(
{
!
userService
.
isVisitorMode
()
&&
(
<
button
<
button
className=
"w-full px-3 text-left leading-10 cursor-pointer rounded hover:bg-gray-100"
className=
"w-full px-3
whitespace-nowrap
text-left leading-10 cursor-pointer rounded hover:bg-gray-100"
onClick=
{
handleSignOutBtnClick
}
onClick=
{
handleSignOutBtnClick
}
>
>
<
span
className=
"mr-1"
>
👋
</
span
>
{
t
(
"common.sign-out"
)
}
<
span
className=
"mr-1"
>
👋
</
span
>
{
t
(
"common.sign-out"
)
}
...
...
web/src/less/memo-editor.less
View file @
778282ae
...
@@ -128,10 +128,10 @@
...
@@ -128,10 +128,10 @@
}
}
> .confirm-btn {
> .confirm-btn {
@apply shadow cursor-pointer px-3 py-0 leading-8 bg-green-600 text-white text-sm hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-60;
@apply
flex flex-row justify-center items-center
shadow cursor-pointer px-3 py-0 leading-8 bg-green-600 text-white text-sm hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-60;
> .icon-
text
{
> .icon-
img
{
@apply
text-base ml-1
;
@apply
ml-1 w-6 h-auto
;
}
}
}
}
}
}
...
...
web/src/types/modules/resource.d.ts
View file @
778282ae
...
@@ -9,4 +9,6 @@ interface Resource {
...
@@ -9,4 +9,6 @@ interface Resource {
filename
:
string
;
filename
:
string
;
type
:
string
;
type
:
string
;
size
:
string
;
size
:
string
;
linkedMemoAmount
:
number
;
}
}
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