Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
Block Explorer UI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container 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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
Block Explorer UI
Commits
3b364ba5
Commit
3b364ba5
authored
4 months ago
by
Dima Rifai
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#377
- use formatAndDelocalizeFromTime for displaying human-readable text
parent
ff99ba3f
No related branches found
No related tags found
2 merge requests
!481
bring recent develop changes to mater to match the backend
,
!472
Delrifai/#377 solve tooltip issues
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
components/LastUpdatedTooltip.tsx
+4
-6
4 additions, 6 deletions
components/LastUpdatedTooltip.tsx
with
4 additions
and
6 deletions
components/LastUpdatedTooltip.tsx
+
4
−
6
View file @
3b364ba5
...
...
@@ -8,6 +8,7 @@ import {
import
{
FontAwesomeIcon
}
from
"
@fortawesome/react-fontawesome
"
;
import
{
faClock
}
from
"
@fortawesome/free-solid-svg-icons
"
;
import
moment
from
"
moment
"
;
import
{
formatAndDelocalizeFromTime
}
from
"
@/utils/TimeUtils
"
;
type
LastUpdatedProps
=
{
lastUpdatedAt
:
string
|
Date
;
...
...
@@ -28,6 +29,7 @@ const LastUpdatedTooltip: React.FC<LastUpdatedProps> = ({ lastUpdatedAt }) => {
?
Number
(
lastUpdatedAt
.
split
(
"
"
)[
0
])
:
calculateTimeDiff
(
lastUpdatedAt
);
const
iconRef
=
useRef
<
SVGSVGElement
|
null
>
(
null
);
const
formattedTime
=
formatAndDelocalizeFromTime
(
lastUpdatedAt
);
// Get the human-readable time.
const
getIconColor
=
(
timeDiff
:
number
)
=>
{
let
colorClass
=
""
;
...
...
@@ -61,9 +63,7 @@ const LastUpdatedTooltip: React.FC<LastUpdatedProps> = ({ lastUpdatedAt }) => {
},
[
timeDiff
]);
const
{
colorClass
}
=
getIconColor
(
timeDiff
);
const
tooltipMessage
=
`Last Updated -
${
timeDiff
}
${
timeDiff
===
1
?
"
min
"
:
"
mins
"
}
ago`
;
const
tooltipMessage
=
`Last Updated -
${
formattedTime
}
`
;
return
(
<
div
className
=
"flex items-center space-x-2"
>
...
...
@@ -78,9 +78,7 @@ const LastUpdatedTooltip: React.FC<LastUpdatedProps> = ({ lastUpdatedAt }) => {
ref
=
{
iconRef
}
className
=
{
colorClass
}
/>
<
span
className
=
{
`
${
colorClass
}
font-bold ml-2`
}
>
{
`
${
timeDiff
}
${
timeDiff
===
1
?
"
min
"
:
"
mins
"
}
ago`
}
</
span
>
<
span
className
=
{
`
${
colorClass
}
font-bold ml-2`
}
>
{
formattedTime
}
</
span
>
</
span
>
</
TooltipTrigger
>
<
TooltipContent
...
...
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