Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Clash Verge
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Clash Verge
Commits
794d3763
There was an error fetching the commit references. Please try again later.
Unverified
Commit
794d3763
authored
3 years ago
by
GyDi
Browse files
Options
Downloads
Patches
Plain Diff
feat: adjust profile item ui
parent
c60578f5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/assets/styles/index.scss
+1
-0
1 addition, 0 deletions
src/assets/styles/index.scss
src/components/profile/profile-item.tsx
+47
-39
47 additions, 39 deletions
src/components/profile/profile-item.tsx
with
48 additions
and
39 deletions
src/assets/styles/index.scss
+
1
−
0
View file @
794d3763
...
...
@@ -4,6 +4,7 @@ body {
"Ubuntu"
,
"Cantarell"
,
"Fira Sans"
,
"Droid Sans"
,
"Helvetica Neue"
,
sans-serif
;
-webkit-font-smoothing
:
antialiased
;
user-select
:
none
;
}
:root
{
...
...
This diff is collapsed.
Click to expand it.
src/components/profile/profile-item.tsx
+
47
−
39
View file @
794d3763
...
...
@@ -59,8 +59,11 @@ const ProfileItem: React.FC<Props> = (props) => {
const
progress
=
Math
.
round
(((
download
+
upload
)
*
100
)
/
(
total
+
0.1
));
const
fromnow
=
updated
>
0
?
dayjs
(
updated
*
1000
).
fromNow
()
:
""
;
// url or file mode
const
isUrlMode
=
itemData
.
url
&&
extra
;
// local file mode
// remote file mode
// subscription url mode
const
hasUrl
=
!!
itemData
.
url
;
const
hasExtra
=
!!
extra
;
// only subscription url has extra info
const
onView
=
async
()
=>
{
setAnchorEl
(
null
);
...
...
@@ -178,7 +181,8 @@ const ProfileItem: React.FC<Props> = (props) => {
{
name
}
</
Typography
>
{
isUrlMode
&&
(
{
/* only if has url can it be updated */
}
{
hasUrl
&&
(
<
IconButton
sx
=
{
{
width
:
26
,
...
...
@@ -197,43 +201,43 @@ const ProfileItem: React.FC<Props> = (props) => {
)
}
</
Box
>
{
isUrlMode
?
(
<>
<
Box
sx
=
{
boxStyle
}
>
<
Typography
noWrap
title
=
{
`From:
${
from
}
`
}
>
{
from
}
</
Typography
>
{
/* the second line show url's info or description */
}
{
hasUrl
?
(
<
Box
sx
=
{
boxStyle
}
>
<
Typography
noWrap
title
=
{
`From:
${
from
}
`
}
>
{
from
}
</
Typography
>
<
Typography
noWrap
flex
=
"1 0 auto"
fontSize
=
{
14
}
textAlign
=
"right"
title
=
"updated time"
>
{
fromnow
}
</
Typography
>
</
Box
>
<
Box
sx
=
{
{
...
boxStyle
,
fontSize
:
14
}
}
>
<
span
title
=
"used / total"
>
{
parseTraffic
(
upload
+
download
)
}
/
{
parseTraffic
(
total
)
}
</
span
>
<
span
title
=
"expire time"
>
{
expire
}
</
span
>
</
Box
>
</>
<
Typography
noWrap
flex
=
"1 0 auto"
fontSize
=
{
14
}
textAlign
=
"right"
title
=
"updated time"
>
{
fromnow
}
</
Typography
>
</
Box
>
)
:
(
<>
<
Box
sx
=
{
boxStyle
}
>
<
Typography
noWrap
title
=
{
itemData
.
desc
}
>
{
itemData
.
desc
}
</
Typography
>
</
Box
>
<
Box
sx
=
{
boxStyle
}
>
<
Typography
noWrap
title
=
{
itemData
.
desc
}
>
{
itemData
.
desc
}
</
Typography
>
</
Box
>
)
}
<
Box
sx
=
{
{
...
boxStyle
,
fontSize
:
14
,
justifyContent
:
"
flex-end
"
}
}
>
<
span
title
=
"updated time"
>
{
parseExpire
(
updated
)
}
</
span
>
</
Box
>
</>
{
/* the third line show extra info or last updated time */
}
{
hasExtra
?
(
<
Box
sx
=
{
{
...
boxStyle
,
fontSize
:
14
}
}
>
<
span
title
=
"used / total"
>
{
parseTraffic
(
upload
+
download
)
}
/
{
parseTraffic
(
total
)
}
</
span
>
<
span
title
=
"expire time"
>
{
expire
}
</
span
>
</
Box
>
)
:
(
<
Box
sx
=
{
{
...
boxStyle
,
fontSize
:
14
,
justifyContent
:
"
flex-end
"
}
}
>
<
span
title
=
"updated time"
>
{
parseExpire
(
updated
)
}
</
span
>
</
Box
>
)
}
<
LinearProgress
...
...
@@ -250,8 +254,12 @@ const ProfileItem: React.FC<Props> = (props) => {
anchorPosition
=
{
position
}
anchorReference
=
"anchorPosition"
>
{
(
isUrlMode
?
urlModeMenu
:
fileModeMenu
).
map
((
item
)
=>
(
<
MenuItem
key
=
{
item
.
label
}
onClick
=
{
item
.
handler
}
>
{
(
hasUrl
?
urlModeMenu
:
fileModeMenu
).
map
((
item
)
=>
(
<
MenuItem
key
=
{
item
.
label
}
onClick
=
{
item
.
handler
}
sx
=
{
{
minWidth
:
133
}
}
>
{
item
.
label
}
</
MenuItem
>
))
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment