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
2b8078a1
Commit
2b8078a1
authored
Jul 28, 2022
by
boojack
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: add `CommonDialog`
parent
5617118f
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
220 additions
and
114 deletions
+220
-114
AboutSiteDialog.tsx
web/src/components/AboutSiteDialog.tsx
+2
-2
ArchivedMemoDialog.tsx
web/src/components/ArchivedMemoDialog.tsx
+2
-2
ChangePasswordDialog.tsx
web/src/components/ChangePasswordDialog.tsx
+2
-2
ConfirmResetOpenIdDialog.tsx
web/src/components/ConfirmResetOpenIdDialog.tsx
+0
-75
CreateShortcutDialog.tsx
web/src/components/CreateShortcutDialog.tsx
+2
-2
DailyReviewDialog.tsx
web/src/components/DailyReviewDialog.tsx
+2
-2
BaseDialog.tsx
web/src/components/Dialog/BaseDialog.tsx
+4
-4
CommonDialog.tsx
web/src/components/Dialog/CommonDialog.tsx
+84
-0
index.ts
web/src/components/Dialog/index.ts
+1
-0
MemoCardDialog.tsx
web/src/components/MemoCardDialog.tsx
+12
-10
PreviewImageDialog.tsx
web/src/components/PreviewImageDialog.tsx
+2
-2
SettingDialog.tsx
web/src/components/SettingDialog.tsx
+2
-2
MemberSection.tsx
web/src/components/Settings/MemberSection.tsx
+12
-5
MyAccountSection.tsx
web/src/components/Settings/MyAccountSection.tsx
+6
-2
ShareMemoImageDialog.tsx
web/src/components/ShareMemoImageDialog.tsx
+2
-2
base-dialog.less
web/src/less/base-dialog.less
+40
-0
common-dialog.less
web/src/less/common-dialog.less
+31
-0
memo-card-dialog.less
web/src/less/memo-card-dialog.less
+14
-2
No files found.
web/src/components/AboutSiteDialog.tsx
View file @
2b8078a1
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
*
as
api
from
"../helpers/api"
;
import
*
as
api
from
"../helpers/api"
;
import
Only
from
"./common/OnlyWhen"
;
import
Only
from
"./common/OnlyWhen"
;
import
{
show
Dialog
}
from
"./Dialog"
;
import
{
generate
Dialog
}
from
"./Dialog"
;
import
GitHubBadge
from
"./GitHubBadge"
;
import
GitHubBadge
from
"./GitHubBadge"
;
import
"../less/about-site-dialog.less"
;
import
"../less/about-site-dialog.less"
;
...
@@ -63,7 +63,7 @@ const AboutSiteDialog: React.FC<Props> = ({ destroy }: Props) => {
...
@@ -63,7 +63,7 @@ const AboutSiteDialog: React.FC<Props> = ({ destroy }: Props) => {
};
};
export
default
function
showAboutSiteDialog
():
void
{
export
default
function
showAboutSiteDialog
():
void
{
show
Dialog
(
generate
Dialog
(
{
{
className
:
"about-site-dialog"
,
className
:
"about-site-dialog"
,
},
},
...
...
web/src/components/ArchivedMemoDialog.tsx
View file @
2b8078a1
...
@@ -2,7 +2,7 @@ import { useEffect, useState } from "react";
...
@@ -2,7 +2,7 @@ import { useEffect, useState } from "react";
import
useLoading
from
"../hooks/useLoading"
;
import
useLoading
from
"../hooks/useLoading"
;
import
{
memoService
}
from
"../services"
;
import
{
memoService
}
from
"../services"
;
import
{
useAppSelector
}
from
"../store"
;
import
{
useAppSelector
}
from
"../store"
;
import
{
show
Dialog
}
from
"./Dialog"
;
import
{
generate
Dialog
}
from
"./Dialog"
;
import
toastHelper
from
"./Toast"
;
import
toastHelper
from
"./Toast"
;
import
ArchivedMemo
from
"./ArchivedMemo"
;
import
ArchivedMemo
from
"./ArchivedMemo"
;
import
"../less/archived-memo-dialog.less"
;
import
"../less/archived-memo-dialog.less"
;
...
@@ -62,7 +62,7 @@ const ArchivedMemoDialog: React.FC<Props> = (props: Props) => {
...
@@ -62,7 +62,7 @@ const ArchivedMemoDialog: React.FC<Props> = (props: Props) => {
};
};
export
default
function
showArchivedMemo
():
void
{
export
default
function
showArchivedMemo
():
void
{
show
Dialog
(
generate
Dialog
(
{
{
className
:
"archived-memo-dialog"
,
className
:
"archived-memo-dialog"
,
useAppContext
:
true
,
useAppContext
:
true
,
...
...
web/src/components/ChangePasswordDialog.tsx
View file @
2b8078a1
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
validate
,
ValidatorConfig
}
from
"../helpers/validator"
;
import
{
validate
,
ValidatorConfig
}
from
"../helpers/validator"
;
import
{
userService
}
from
"../services"
;
import
{
userService
}
from
"../services"
;
import
{
show
Dialog
}
from
"./Dialog"
;
import
{
generate
Dialog
}
from
"./Dialog"
;
import
toastHelper
from
"./Toast"
;
import
toastHelper
from
"./Toast"
;
import
"../less/change-password-dialog.less"
;
import
"../less/change-password-dialog.less"
;
...
@@ -96,7 +96,7 @@ const ChangePasswordDialog: React.FC<Props> = ({ destroy }: Props) => {
...
@@ -96,7 +96,7 @@ const ChangePasswordDialog: React.FC<Props> = ({ destroy }: Props) => {
};
};
function
showChangePasswordDialog
()
{
function
showChangePasswordDialog
()
{
show
Dialog
(
generate
Dialog
(
{
{
className
:
"change-password-dialog"
,
className
:
"change-password-dialog"
,
},
},
...
...
web/src/components/ConfirmResetOpenIdDialog.tsx
deleted
100644 → 0
View file @
5617118f
import
{
useEffect
}
from
"react"
;
import
{
userService
}
from
"../services"
;
import
useLoading
from
"../hooks/useLoading"
;
import
{
showDialog
}
from
"./Dialog"
;
import
toastHelper
from
"./Toast"
;
import
"../less/confirm-reset-openid-dialog.less"
;
interface
Props
extends
DialogProps
{}
const
ConfirmResetOpenIdDialog
:
React
.
FC
<
Props
>
=
({
destroy
}:
Props
)
=>
{
const
resetBtnClickLoadingState
=
useLoading
(
false
);
useEffect
(()
=>
{
// do nth
},
[]);
const
handleCloseBtnClick
=
()
=>
{
destroy
();
};
const
handleConfirmBtnClick
=
async
()
=>
{
if
(
resetBtnClickLoadingState
.
isLoading
)
{
return
;
}
resetBtnClickLoadingState
.
setLoading
();
try
{
const
user
=
userService
.
getState
().
user
as
User
;
await
userService
.
patchUser
({
id
:
user
.
id
,
resetOpenId
:
true
,
});
}
catch
(
error
)
{
toastHelper
.
error
(
"Request reset open API failed."
);
return
;
}
toastHelper
.
success
(
"Reset open API succeeded."
);
handleCloseBtnClick
();
};
return
(
<>
<
div
className=
"dialog-header-container"
>
<
p
className=
"title-text"
>
Reset Open API
</
p
>
<
button
className=
"btn close-btn"
onClick=
{
handleCloseBtnClick
}
>
<
i
className=
"fa-solid fa-xmark fa-lg"
></
i
>
</
button
>
</
div
>
<
div
className=
"dialog-content-container"
>
<
p
className=
"warn-text"
>
❗️The existing API will be invalidated and a new one will be generated, are you sure you want to reset?
</
p
>
<
div
className=
"btns-container"
>
<
span
className=
"btn cancel-btn"
onClick=
{
handleCloseBtnClick
}
>
Cancel
</
span
>
<
span
className=
{
`btn confirm-btn ${resetBtnClickLoadingState.isLoading ? "loading" : ""}`
}
onClick=
{
handleConfirmBtnClick
}
>
Reset!
</
span
>
</
div
>
</
div
>
</>
);
};
function
showConfirmResetOpenIdDialog
()
{
showDialog
(
{
className
:
"confirm-reset-openid-dialog"
,
},
ConfirmResetOpenIdDialog
);
}
export
default
showConfirmResetOpenIdDialog
;
web/src/components/CreateShortcutDialog.tsx
View file @
2b8078a1
...
@@ -2,7 +2,7 @@ import { memo, useCallback, useEffect, useState } from "react";
...
@@ -2,7 +2,7 @@ import { memo, useCallback, useEffect, useState } from "react";
import
{
memoService
,
shortcutService
}
from
"../services"
;
import
{
memoService
,
shortcutService
}
from
"../services"
;
import
{
checkShouldShowMemoWithFilters
,
filterConsts
,
getDefaultFilter
,
relationConsts
}
from
"../helpers/filter"
;
import
{
checkShouldShowMemoWithFilters
,
filterConsts
,
getDefaultFilter
,
relationConsts
}
from
"../helpers/filter"
;
import
useLoading
from
"../hooks/useLoading"
;
import
useLoading
from
"../hooks/useLoading"
;
import
{
show
Dialog
}
from
"./Dialog"
;
import
{
generate
Dialog
}
from
"./Dialog"
;
import
toastHelper
from
"./Toast"
;
import
toastHelper
from
"./Toast"
;
import
Selector
from
"./common/Selector"
;
import
Selector
from
"./common/Selector"
;
import
"../less/create-shortcut-dialog.less"
;
import
"../less/create-shortcut-dialog.less"
;
...
@@ -304,7 +304,7 @@ const FilterInputer: React.FC<MemoFilterInputerProps> = (props: MemoFilterInpute
...
@@ -304,7 +304,7 @@ const FilterInputer: React.FC<MemoFilterInputerProps> = (props: MemoFilterInpute
const
MemoFilterInputer
:
React
.
FC
<
MemoFilterInputerProps
>
=
memo
(
FilterInputer
);
const
MemoFilterInputer
:
React
.
FC
<
MemoFilterInputerProps
>
=
memo
(
FilterInputer
);
export
default
function
showCreateShortcutDialog
(
shortcutId
?:
ShortcutId
):
void
{
export
default
function
showCreateShortcutDialog
(
shortcutId
?:
ShortcutId
):
void
{
show
Dialog
(
generate
Dialog
(
{
{
className
:
"create-shortcut-dialog"
,
className
:
"create-shortcut-dialog"
,
},
},
...
...
web/src/components/DailyReviewDialog.tsx
View file @
2b8078a1
...
@@ -4,7 +4,7 @@ import toImage from "../labs/html2image";
...
@@ -4,7 +4,7 @@ import toImage from "../labs/html2image";
import
useToggle
from
"../hooks/useToggle"
;
import
useToggle
from
"../hooks/useToggle"
;
import
{
DAILY_TIMESTAMP
}
from
"../helpers/consts"
;
import
{
DAILY_TIMESTAMP
}
from
"../helpers/consts"
;
import
*
as
utils
from
"../helpers/utils"
;
import
*
as
utils
from
"../helpers/utils"
;
import
{
show
Dialog
}
from
"./Dialog"
;
import
{
generate
Dialog
}
from
"./Dialog"
;
import
DatePicker
from
"./common/DatePicker"
;
import
DatePicker
from
"./common/DatePicker"
;
import
showPreviewImageDialog
from
"./PreviewImageDialog"
;
import
showPreviewImageDialog
from
"./PreviewImageDialog"
;
import
DailyMemo
from
"./DailyMemo"
;
import
DailyMemo
from
"./DailyMemo"
;
...
@@ -108,7 +108,7 @@ const DailyReviewDialog: React.FC<Props> = (props: Props) => {
...
@@ -108,7 +108,7 @@ const DailyReviewDialog: React.FC<Props> = (props: Props) => {
};
};
export
default
function
showDailyReviewDialog
(
datestamp
:
DateStamp
=
Date
.
now
()):
void
{
export
default
function
showDailyReviewDialog
(
datestamp
:
DateStamp
=
Date
.
now
()):
void
{
show
Dialog
(
generate
Dialog
(
{
{
className
:
"daily-review-dialog"
,
className
:
"daily-review-dialog"
,
useAppContext
:
true
,
useAppContext
:
true
,
...
...
web/src/components/Dialog.tsx
→
web/src/components/Dialog
/BaseDialog
.tsx
View file @
2b8078a1
import
{
createRoot
}
from
"react-dom/client"
;
import
{
createRoot
}
from
"react-dom/client"
;
import
{
ANIMATION_DURATION
}
from
"../helpers/consts"
;
import
{
Provider
}
from
"react-redux"
;
import
{
Provider
}
from
"react-redux"
;
import
store
from
"../store"
;
import
{
ANIMATION_DURATION
}
from
"../../helpers/consts"
;
import
"../less/dialog.less"
;
import
store
from
"../../store"
;
import
"../../less/base-dialog.less"
;
interface
DialogConfig
{
interface
DialogConfig
{
className
:
string
;
className
:
string
;
...
@@ -32,7 +32,7 @@ const BaseDialog: React.FC<Props> = (props: Props) => {
...
@@ -32,7 +32,7 @@ const BaseDialog: React.FC<Props> = (props: Props) => {
);
);
};
};
export
function
show
Dialog
<
T
extends
DialogProps
>
(
export
function
generate
Dialog
<
T
extends
DialogProps
>
(
config
:
DialogConfig
,
config
:
DialogConfig
,
DialogComponent
:
React
.
FC
<
T
>
,
DialogComponent
:
React
.
FC
<
T
>
,
props
?:
Omit
<
T
,
"destroy"
>
props
?:
Omit
<
T
,
"destroy"
>
...
...
web/src/components/Dialog/CommonDialog.tsx
0 → 100644
View file @
2b8078a1
import
{
generateDialog
}
from
"./BaseDialog"
;
import
"../../less/common-dialog.less"
;
type
DialogStyle
=
"info"
|
"warning"
;
interface
Props
extends
DialogProps
{
title
:
string
;
content
:
string
;
style
?:
DialogStyle
;
closeBtnText
?:
string
;
confirmBtnText
?:
string
;
onClose
?:
()
=>
void
;
onConfirm
?:
()
=>
void
;
}
const
defaultProps
=
{
title
:
""
,
content
:
""
,
style
:
"info"
,
closeBtnText
:
"Close"
,
confirmBtnText
:
"Confirm"
,
onClose
:
()
=>
null
,
onConfirm
:
()
=>
null
,
};
const
CommonDialog
:
React
.
FC
<
Props
>
=
(
props
:
Props
)
=>
{
const
{
title
,
content
,
destroy
,
closeBtnText
,
confirmBtnText
,
onClose
,
onConfirm
,
style
}
=
{
...
defaultProps
,
...
props
,
};
const
handleCloseBtnClick
=
()
=>
{
onClose
();
destroy
();
};
const
handleConfirmBtnClick
=
async
()
=>
{
onConfirm
();
destroy
();
};
return
(
<>
<
div
className=
"dialog-header-container"
>
<
p
className=
"title-text"
>
{
title
}
</
p
>
<
button
className=
"btn close-btn"
onClick=
{
handleCloseBtnClick
}
>
<
i
className=
"fa-solid fa-xmark fa-lg"
></
i
>
</
button
>
</
div
>
<
div
className=
"dialog-content-container"
>
<
p
className=
"content-text"
>
{
content
}
</
p
>
<
div
className=
"btns-container"
>
<
span
className=
"btn cancel-btn"
onClick=
{
handleCloseBtnClick
}
>
{
closeBtnText
}
</
span
>
<
span
className=
{
`btn confirm-btn ${style}`
}
onClick=
{
handleConfirmBtnClick
}
>
{
confirmBtnText
}
</
span
>
</
div
>
</
div
>
</>
);
};
interface
CommonDialogProps
{
title
:
string
;
content
:
string
;
className
?:
string
;
style
?:
DialogStyle
;
closeBtnText
?:
string
;
confirmBtnText
?:
string
;
onClose
?:
()
=>
void
;
onConfirm
?:
()
=>
void
;
}
export
const
showCommonDialog
=
(
props
:
CommonDialogProps
)
=>
{
generateDialog
(
{
className
:
`common-dialog
${
props
?.
className
??
""
}
`,
},
CommonDialog,
props
);
};
web/src/components/Dialog/index.ts
0 → 100644
View file @
2b8078a1
export
{
generateDialog
}
from
"./BaseDialog"
;
web/src/components/MemoCardDialog.tsx
View file @
2b8078a1
...
@@ -5,7 +5,7 @@ import * as utils from "../helpers/utils";
...
@@ -5,7 +5,7 @@ import * as utils from "../helpers/utils";
import
{
parseHtmlToRawText
}
from
"../helpers/marked"
;
import
{
parseHtmlToRawText
}
from
"../helpers/marked"
;
import
Only
from
"./common/OnlyWhen"
;
import
Only
from
"./common/OnlyWhen"
;
import
toastHelper
from
"./Toast"
;
import
toastHelper
from
"./Toast"
;
import
{
show
Dialog
}
from
"./Dialog"
;
import
{
generate
Dialog
}
from
"./Dialog"
;
import
Image
from
"./Image"
;
import
Image
from
"./Image"
;
import
{
formatMemoContent
}
from
"./Memo"
;
import
{
formatMemoContent
}
from
"./Memo"
;
import
"../less/memo-card-dialog.less"
;
import
"../less/memo-card-dialog.less"
;
...
@@ -127,14 +127,16 @@ const MemoCardDialog: React.FC<Props> = (props: Props) => {
...
@@ -127,14 +127,16 @@ const MemoCardDialog: React.FC<Props> = (props: Props) => {
return
(
return
(
<>
<>
<
Only
when=
{
!
userService
.
isVisitorMode
()
}
>
<
Only
when=
{
!
userService
.
isVisitorMode
()
}
>
<
div
className=
"visibility-selector-container"
>
<
div
className=
"card-header-container"
>
<
i
className=
"fa-solid fa-eye text-white mr-2"
></
i
>
<
div
className=
"visibility-selector-container"
>
<
Selector
<
i
className=
"fa-solid fa-eye mr-2"
></
i
>
className=
"w-32"
<
Selector
dataSource=
{
visibilityList
}
className=
"visibility-selector"
value=
{
memo
.
visibility
}
dataSource=
{
visibilityList
}
handleValueChanged=
{
(
value
)
=>
handleVisibilitySelectorChange
(
value
as
Visibility
)
}
value=
{
memo
.
visibility
}
/>
handleValueChanged=
{
(
value
)
=>
handleVisibilitySelectorChange
(
value
as
Visibility
)
}
/>
</
div
>
</
div
>
</
div
>
</
Only
>
</
Only
>
<
div
className=
"memo-card-container"
>
<
div
className=
"memo-card-container"
>
...
@@ -221,7 +223,7 @@ const MemoCardDialog: React.FC<Props> = (props: Props) => {
...
@@ -221,7 +223,7 @@ const MemoCardDialog: React.FC<Props> = (props: Props) => {
};
};
export
default
function
showMemoCardDialog
(
memo
:
Memo
):
void
{
export
default
function
showMemoCardDialog
(
memo
:
Memo
):
void
{
show
Dialog
(
generate
Dialog
(
{
{
className
:
"memo-card-dialog"
,
className
:
"memo-card-dialog"
,
},
},
...
...
web/src/components/PreviewImageDialog.tsx
View file @
2b8078a1
import
{
show
Dialog
}
from
"./Dialog"
;
import
{
generate
Dialog
}
from
"./Dialog"
;
import
*
as
utils
from
"../helpers/utils"
;
import
*
as
utils
from
"../helpers/utils"
;
import
"../less/preview-image-dialog.less"
;
import
"../less/preview-image-dialog.less"
;
...
@@ -36,7 +36,7 @@ const PreviewImageDialog: React.FC<Props> = ({ destroy, imgUrl }: Props) => {
...
@@ -36,7 +36,7 @@ const PreviewImageDialog: React.FC<Props> = ({ destroy, imgUrl }: Props) => {
};
};
export
default
function
showPreviewImageDialog
(
imgUrl
:
string
):
void
{
export
default
function
showPreviewImageDialog
(
imgUrl
:
string
):
void
{
show
Dialog
(
generate
Dialog
(
{
{
className
:
"preview-image-dialog"
,
className
:
"preview-image-dialog"
,
},
},
...
...
web/src/components/SettingDialog.tsx
View file @
2b8078a1
import
{
useState
}
from
"react"
;
import
{
useState
}
from
"react"
;
import
{
useAppSelector
}
from
"../store"
;
import
{
useAppSelector
}
from
"../store"
;
import
{
show
Dialog
}
from
"./Dialog"
;
import
{
generate
Dialog
}
from
"./Dialog"
;
import
MyAccountSection
from
"./Settings/MyAccountSection"
;
import
MyAccountSection
from
"./Settings/MyAccountSection"
;
import
PreferencesSection
from
"./Settings/PreferencesSection"
;
import
PreferencesSection
from
"./Settings/PreferencesSection"
;
import
MemberSection
from
"./Settings/MemberSection"
;
import
MemberSection
from
"./Settings/MemberSection"
;
...
@@ -76,7 +76,7 @@ const SettingDialog: React.FC<Props> = (props: Props) => {
...
@@ -76,7 +76,7 @@ const SettingDialog: React.FC<Props> = (props: Props) => {
};
};
export
default
function
showSettingDialog
():
void
{
export
default
function
showSettingDialog
():
void
{
show
Dialog
(
generate
Dialog
(
{
{
className
:
"setting-dialog"
,
className
:
"setting-dialog"
,
useAppContext
:
true
,
useAppContext
:
true
,
...
...
web/src/components/Settings/MemberSection.tsx
View file @
2b8078a1
...
@@ -5,6 +5,7 @@ import { useAppSelector } from "../../store";
...
@@ -5,6 +5,7 @@ import { useAppSelector } from "../../store";
import
*
as
api
from
"../../helpers/api"
;
import
*
as
api
from
"../../helpers/api"
;
import
toastHelper
from
"../Toast"
;
import
toastHelper
from
"../Toast"
;
import
"../../less/settings/member-section.less"
;
import
"../../less/settings/member-section.less"
;
import
{
showCommonDialog
}
from
"../Dialog/CommonDialog"
;
interface
Props
{}
interface
Props
{}
...
@@ -85,12 +86,18 @@ const PreferencesSection: React.FC<Props> = () => {
...
@@ -85,12 +86,18 @@ const PreferencesSection: React.FC<Props> = () => {
fetchUserList
();
fetchUserList
();
};
};
// TODO: show a dialog to confirm delete user.
const
handleDeleteUserClick
=
(
user
:
User
)
=>
{
const
handleDeleteUserClick
=
async
(
user
:
User
)
=>
{
showCommonDialog
({
await
userService
.
deleteUser
({
title
:
`Delete
${
user
.
name
}
`
,
id
:
user
.
id
,
content
:
"❗️Are you sure you want to delete?"
,
style
:
"warning"
,
onConfirm
:
async
()
=>
{
await
userService
.
deleteUser
({
id
:
user
.
id
,
});
fetchUserList
();
},
});
});
fetchUserList
();
};
};
return
(
return
(
...
...
web/src/components/Settings/MyAccountSection.tsx
View file @
2b8078a1
...
@@ -3,8 +3,8 @@ import { useAppSelector } from "../../store";
...
@@ -3,8 +3,8 @@ import { useAppSelector } from "../../store";
import
{
userService
}
from
"../../services"
;
import
{
userService
}
from
"../../services"
;
import
{
validate
,
ValidatorConfig
}
from
"../../helpers/validator"
;
import
{
validate
,
ValidatorConfig
}
from
"../../helpers/validator"
;
import
toastHelper
from
"../Toast"
;
import
toastHelper
from
"../Toast"
;
import
{
showCommonDialog
}
from
"../Dialog/CommonDialog"
;
import
showChangePasswordDialog
from
"../ChangePasswordDialog"
;
import
showChangePasswordDialog
from
"../ChangePasswordDialog"
;
import
showConfirmResetOpenIdDialog
from
"../ConfirmResetOpenIdDialog"
;
import
"../../less/settings/my-account-section.less"
;
import
"../../less/settings/my-account-section.less"
;
const
validateConfig
:
ValidatorConfig
=
{
const
validateConfig
:
ValidatorConfig
=
{
...
@@ -53,7 +53,11 @@ const MyAccountSection: React.FC<Props> = () => {
...
@@ -53,7 +53,11 @@ const MyAccountSection: React.FC<Props> = () => {
};
};
const
handleResetOpenIdBtnClick
=
async
()
=>
{
const
handleResetOpenIdBtnClick
=
async
()
=>
{
showConfirmResetOpenIdDialog
();
showCommonDialog
({
title
:
"Reset Open API"
,
content
:
"❗️The existing API will be invalidated and a new one will be generated, are you sure you want to reset?"
,
style
:
"warning"
,
});
};
};
const
handlePreventDefault
=
(
e
:
React
.
MouseEvent
)
=>
{
const
handlePreventDefault
=
(
e
:
React
.
MouseEvent
)
=>
{
...
...
web/src/components/ShareMemoImageDialog.tsx
View file @
2b8078a1
...
@@ -3,7 +3,7 @@ import { userService } from "../services";
...
@@ -3,7 +3,7 @@ import { userService } from "../services";
import
toImage
from
"../labs/html2image"
;
import
toImage
from
"../labs/html2image"
;
import
{
ANIMATION_DURATION
,
IMAGE_URL_REG
}
from
"../helpers/consts"
;
import
{
ANIMATION_DURATION
,
IMAGE_URL_REG
}
from
"../helpers/consts"
;
import
*
as
utils
from
"../helpers/utils"
;
import
*
as
utils
from
"../helpers/utils"
;
import
{
show
Dialog
}
from
"./Dialog"
;
import
{
generate
Dialog
}
from
"./Dialog"
;
import
Only
from
"./common/OnlyWhen"
;
import
Only
from
"./common/OnlyWhen"
;
import
toastHelper
from
"./Toast"
;
import
toastHelper
from
"./Toast"
;
import
{
formatMemoContent
}
from
"./Memo"
;
import
{
formatMemoContent
}
from
"./Memo"
;
...
@@ -107,7 +107,7 @@ const ShareMemoImageDialog: React.FC<Props> = (props: Props) => {
...
@@ -107,7 +107,7 @@ const ShareMemoImageDialog: React.FC<Props> = (props: Props) => {
};
};
export
default
function
showShareMemoImageDialog
(
memo
:
Memo
):
void
{
export
default
function
showShareMemoImageDialog
(
memo
:
Memo
):
void
{
show
Dialog
(
generate
Dialog
(
{
{
className
:
"share-memo-image-dialog"
,
className
:
"share-memo-image-dialog"
,
},
},
...
...
web/src/less/dialog.less
→
web/src/less/
base-
dialog.less
View file @
2b8078a1
@import "./mixin.less";
@import "./mixin.less";
.dialog-wrapper {
.dialog-wrapper {
.flex(column, flex-start, center);
@apply fixed top-0 left-0 flex flex-col justify-start items-center w-full h-full pt-16 z-100 overflow-x-hidden overflow-y-scroll bg-transparent transition-all;
@apply fixed top-0 left-0 w-full h-full pt-16 z-100 overflow-x-hidden overflow-y-scroll bg-transparent transition-all;
.hide-scroll-bar();
.hide-scroll-bar();
&.showup {
&.showup {
...
@@ -14,12 +13,10 @@
...
@@ -14,12 +13,10 @@
}
}
> .dialog-container {
> .dialog-container {
.flex(column, flex-start, flex-start);
@apply flex flex-col justify-start items-start bg-white p-4 rounded-lg;
@apply bg-white p-4 rounded-lg;
> .dialog-header-container {
> .dialog-header-container {
.flex(row, space-between, center);
@apply flex flex-row justify-between items-center w-full mb-4;
@apply w-full mb-4;
> .title-text {
> .title-text {
> .icon-text {
> .icon-text {
...
@@ -28,19 +25,16 @@
...
@@ -28,19 +25,16 @@
}
}
.btn {
.btn {
.flex(column, center, center);
@apply flex flex-col justify-center items-center w-6 h-6 rounded hover:bg-gray-100 hover:shadow;
@apply w-6 h-6 rounded hover:bg-gray-100 hover:shadow;
}
}
}
}
> .dialog-content-container {
> .dialog-content-container {
.flex(column, flex-start, flex-start);
@apply flex flex-col justify-start items-start w-full;
@apply w-full;
}
}
> .dialog-footer-container {
> .dialog-footer-container {
.flex(row, flex-end, center);
@apply flex flex-row justify-end items-center w-full mt-4;
@apply w-full mt-4;
}
}
}
}
}
}
web/src/less/co
nfirm-reset-openid
-dialog.less
→
web/src/less/co
mmon
-dialog.less
View file @
2b8078a1
@import "./mixin.less";
@import "./mixin.less";
.co
nfirm-reset-openid
-dialog {
.co
mmon
-dialog {
> .dialog-container {
> .dialog-container {
@apply w-80;
@apply w-80;
> .dialog-content-container {
> .dialog-content-container {
.flex(column, flex-start, flex-start)
;
@apply flex flex-col justify-start items-start
;
> .
warn
-text {
> .
content
-text {
@apply pt-2;
@apply pt-2;
}
}
> .btns-container {
> .btns-container {
.flex(row, flex-end, center);
@apply flex flex-row justify-end items-center w-full mt-3;
@apply w-full mt-3;
> .btn {
> .btn {
@apply text-sm py-1 px-3 mr-2 rounded-md;
@apply text-sm py-1 px-3 mr-2 rounded-md hover:opacity-80;
&:hover {
@apply opacity-80;
}
&.confirm-btn {
&.confirm-btn {
@apply bg-red-100 border border-solid border-
red-600 text-red
-600;
@apply bg-red-100 border border-solid border-
blue-600 text-blue
-600;
&.
load
ing {
&.
warn
ing {
@apply
opacity-80 cursor-wait
;
@apply
border-red-600 text-red-600
;
}
}
}
}
}
}
...
...
web/src/less/memo-card-dialog.less
View file @
2b8078a1
...
@@ -6,8 +6,20 @@
...
@@ -6,8 +6,20 @@
> .dialog-container {
> .dialog-container {
@apply w-full p-0 bg-transparent flex flex-col justify-start items-center;
@apply w-full p-0 bg-transparent flex flex-col justify-start items-center;
> .visibility-selector-container {
> .card-header-container {
@apply z-10 w-128 mb-2 flex flex-row justify-start items-center;
@apply z-10 w-128 max-w-full flex flex-row justify-start items-center mb-2;
> .visibility-selector-container {
@apply bg-white px-2 py-1 rounded-lg flex flex-row justify-start items-center;
> .visibility-selector {
@apply w-32;
> .current-value-container {
@apply border-none;
}
}
}
}
}
> .memo-card-container {
> .memo-card-container {
...
...
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