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
2c8ff279
Commit
2c8ff279
authored
Jun 24, 2022
by
boojack
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: add `ping` button
parent
d1a7527c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
MenuBtnsPopup.tsx
web/src/components/MenuBtnsPopup.tsx
+19
-0
toast.less
web/src/less/toast.less
+3
-6
No files found.
web/src/components/MenuBtnsPopup.tsx
View file @
2c8ff279
import
{
useEffect
,
useRef
}
from
"react"
;
import
*
as
api
from
"../helpers/api"
;
import
{
locationService
,
userService
}
from
"../services"
;
import
showAboutSiteDialog
from
"./AboutSiteDialog"
;
import
toastHelper
from
"./Toast"
;
import
"../less/menu-btns-popup.less"
;
interface
Props
{
...
...
@@ -27,6 +29,20 @@ const MenuBtnsPopup: React.FC<Props> = (props: Props) => {
}
},
[
shownStatus
]);
const
handlePingBtnClick
=
()
=>
{
api
.
getSystemStatus
()
.
then
(({
data
})
=>
{
const
{
data
:
{
profile
},
}
=
data
;
toastHelper
.
info
(
JSON
.
stringify
(
profile
,
null
,
4
));
})
.
catch
((
error
)
=>
{
toastHelper
.
error
(
"Failed to ping
\n
"
+
JSON
.
stringify
(
error
,
null
,
4
));
});
};
const
handleAboutBtnClick
=
()
=>
{
showAboutSiteDialog
();
};
...
...
@@ -41,6 +57,9 @@ const MenuBtnsPopup: React.FC<Props> = (props: Props) => {
return
(
<
div
className=
{
`menu-btns-popup ${shownStatus ? "" : "hidden"}`
}
ref=
{
popupElRef
}
>
<
button
className=
"btn action-btn"
onClick=
{
handlePingBtnClick
}
>
<
span
className=
"icon"
>
🎯
</
span
>
Ping
</
button
>
<
button
className=
"btn action-btn"
onClick=
{
handleAboutBtnClick
}
>
<
span
className=
"icon"
>
🤠
</
span
>
About
</
button
>
...
...
web/src/less/toast.less
View file @
2c8ff279
@import "./mixin.less";
.toast-list-container {
.flex(column, flex-start, flex-end);
@apply fixed top-2 right-4 z-1000 max-h-full;
@apply flex flex-col justify-start items-end fixed top-2 right-4 z-1000 max-h-full;
> .toast-wrapper {
.flex(column, flex-start, flex-start);
@apply relative left-full invisible text-base cursor-pointer shadow rounded bg-white mt-6 py-2 px-4;
@apply flex flex-col justify-start items-start relative left-full invisible text-base cursor-pointer shadow rounded bg-white mt-6 py-2 px-4;
min-width: 6em;
transition: all 0.4s ease;
...
...
@@ -21,8 +19,7 @@
> .toast-container {
> .content-text {
@apply text-sm whitespace-pre-wrap leading-6;
max-width: 240px;
@apply text-sm whitespace-pre-wrap break-all leading-6 max-w-xs;
}
}
}
...
...
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