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
ae61ade2
Unverified
Commit
ae61ade2
authored
Feb 27, 2023
by
boojack
Committed by
GitHub
Feb 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: add my account entry in user dropdown (#1187)
parent
977e7f55
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
7 deletions
+22
-7
SettingDialog.tsx
web/src/components/SettingDialog.tsx
+10
-6
UserBanner.tsx
web/src/components/UserBanner.tsx
+12
-1
No files found.
web/src/components/SettingDialog.tsx
View file @
ae61ade2
...
@@ -13,21 +13,23 @@ import StorageSection from "./Settings/StorageSection";
...
@@ -13,21 +13,23 @@ import StorageSection from "./Settings/StorageSection";
import
SSOSection
from
"./Settings/SSOSection"
;
import
SSOSection
from
"./Settings/SSOSection"
;
import
"../less/setting-dialog.less"
;
import
"../less/setting-dialog.less"
;
type
Props
=
DialogProps
;
type
SettingSection
=
"my-account"
|
"preference"
|
"member"
|
"system"
|
"storage"
|
"sso"
;
type
SettingSection
=
"my-account"
|
"preference"
|
"member"
|
"system"
|
"storage"
|
"sso"
;
interface
Props
extends
DialogProps
{
selectedSection
?:
SettingSection
;
}
interface
State
{
interface
State
{
selectedSection
:
SettingSection
;
selectedSection
:
SettingSection
;
}
}
const
SettingDialog
:
React
.
FC
<
Props
>
=
(
props
:
Props
)
=>
{
const
SettingDialog
:
React
.
FC
<
Props
>
=
(
props
:
Props
)
=>
{
const
{
destroy
}
=
props
;
const
{
destroy
,
selectedSection
}
=
props
;
const
{
t
}
=
useTranslation
();
const
{
t
}
=
useTranslation
();
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
>
({
selectedSection
:
"my-account"
,
selectedSection
:
selectedSection
||
"my-account"
,
});
});
const
isHost
=
user
?.
role
===
"HOST"
;
const
isHost
=
user
?.
role
===
"HOST"
;
...
@@ -128,13 +130,15 @@ const SettingDialog: React.FC<Props> = (props: Props) => {
...
@@ -128,13 +130,15 @@ const SettingDialog: React.FC<Props> = (props: Props) => {
);
);
};
};
export
default
function
showSettingDialog
():
void
{
export
default
function
showSettingDialog
(
selectedSection
?:
SettingSection
):
void
{
generateDialog
(
generateDialog
(
{
{
className
:
"setting-dialog"
,
className
:
"setting-dialog"
,
dialogName
:
"setting-dialog"
,
dialogName
:
"setting-dialog"
,
},
},
SettingDialog
,
SettingDialog
,
{}
{
selectedSection
,
}
);
);
}
}
web/src/components/UserBanner.tsx
View file @
ae61ade2
...
@@ -7,6 +7,7 @@ import Dropdown from "./common/Dropdown";
...
@@ -7,6 +7,7 @@ import Dropdown from "./common/Dropdown";
import
showArchivedMemoDialog
from
"./ArchivedMemoDialog"
;
import
showArchivedMemoDialog
from
"./ArchivedMemoDialog"
;
import
showAboutSiteDialog
from
"./AboutSiteDialog"
;
import
showAboutSiteDialog
from
"./AboutSiteDialog"
;
import
UserAvatar
from
"./UserAvatar"
;
import
UserAvatar
from
"./UserAvatar"
;
import
showSettingDialog
from
"./SettingDialog"
;
const
UserBanner
=
()
=>
{
const
UserBanner
=
()
=>
{
const
{
t
}
=
useTranslation
();
const
{
t
}
=
useTranslation
();
...
@@ -44,6 +45,10 @@ const UserBanner = () => {
...
@@ -44,6 +45,10 @@ const UserBanner = () => {
});
});
},
[
memos
]);
},
[
memos
]);
const
handleMyAccountClick
=
()
=>
{
showSettingDialog
(
"my-account"
);
};
const
handleArchivedBtnClick
=
()
=>
{
const
handleArchivedBtnClick
=
()
=>
{
showArchivedMemoDialog
();
showArchivedMemoDialog
();
};
};
...
@@ -77,6 +82,12 @@ const UserBanner = () => {
...
@@ -77,6 +82,12 @@ const UserBanner = () => {
<>
<>
{
!
userStore
.
isVisitorMode
()
&&
(
{
!
userStore
.
isVisitorMode
()
&&
(
<>
<>
<
button
className=
"w-full px-3 truncate text-left leading-10 cursor-pointer rounded dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-zinc-800"
onClick=
{
handleMyAccountClick
}
>
<
span
className=
"mr-1"
>
🤠
</
span
>
{
t
(
"setting.my-account"
)
}
</
button
>
<
button
<
button
className=
"w-full px-3 truncate text-left leading-10 cursor-pointer rounded dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-zinc-800"
className=
"w-full px-3 truncate text-left leading-10 cursor-pointer rounded dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-zinc-800"
onClick=
{
handleArchivedBtnClick
}
onClick=
{
handleArchivedBtnClick
}
...
@@ -89,7 +100,7 @@ const UserBanner = () => {
...
@@ -89,7 +100,7 @@ const UserBanner = () => {
className=
"w-full px-3 truncate text-left leading-10 cursor-pointer rounded dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-zinc-800"
className=
"w-full px-3 truncate text-left leading-10 cursor-pointer rounded dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-zinc-800"
onClick=
{
handleAboutBtnClick
}
onClick=
{
handleAboutBtnClick
}
>
>
<
span
className=
"mr-1"
>
🤠
</
span
>
{
t
(
"common.about"
)
}
<
span
className=
"mr-1"
>
🏂
</
span
>
{
t
(
"common.about"
)
}
</
button
>
</
button
>
{
!
userStore
.
isVisitorMode
()
&&
(
{
!
userStore
.
isVisitorMode
()
&&
(
<
button
<
button
...
...
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