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
196ddfe4
Commit
196ddfe4
authored
4 months ago
by
Dima Rifai
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#382
- Add rank, URL, and show if witness is deactivated
parent
7af9d9c3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
components/account/MobileAccountNameCard.tsx
+55
-13
55 additions, 13 deletions
components/account/MobileAccountNameCard.tsx
with
55 additions
and
13 deletions
components/account/MobileAccountNameCard.tsx
+
55
−
13
View file @
196ddfe4
import
Image
from
"
next/image
"
;
import
{
getHiveAvatarUrl
}
from
"
@/utils/HiveBlogUtils
"
;
import
{
Card
,
CardHeader
}
from
"
../ui/card
"
;
import
Explorer
from
"
@/types/Explorer
"
;
import
{
config
}
from
"
@/Config
"
;
import
{
cn
}
from
"
@/lib/utils
"
;
import
{
FontAwesomeIcon
}
from
"
@fortawesome/react-fontawesome
"
;
import
{
faLink
,
faStar
}
from
"
@fortawesome/free-solid-svg-icons
"
;
import
useWitnessDetails
from
"
@/hooks/api/common/useWitnessDetails
"
;
interface
MobileAccountNameCardProps
{
accountName
:
string
;
...
...
@@ -15,29 +19,67 @@ const MobileAccountNameCard: React.FC<MobileAccountNameCardProps> = ({
liveDataEnabled
,
accountDetails
,
})
=>
{
const
{
witnessDetails
}
=
useWitnessDetails
(
accountName
,
accountDetails
.
is_witness
);
const
isWitnessActive
=
witnessDetails
?.
witness
.
signing_key
!==
config
.
inactiveWitnessKey
;
if
(
!
accountDetails
)
return
;
return
(
<
Card
>
<
CardHeader
>
<
div
className
=
"flex justify-between bg-theme dark:bg-theme text-explorer-orange text-2xl my-4"
>
{
accountDetails
.
is_witness
?
(
<
div
data-testid
=
"account-name"
>
{
accountDetails
.
name
}
<
span
className
=
"text-sm"
>
(witness)
</
span
>
</
div
>
)
:
(
<
div
>
{
accountDetails
.
name
}
</
div
>
)
}
<
span
>
<
div
className
=
"flex flex-wrap items-center justify-between gap-4 bg-theme dark:bg-theme"
>
{
/* Avatar and Name */
}
<
div
className
=
"flex items-center gap-4"
>
<
Image
className
=
"rounded-full border-2 border-explorer-orange"
src
=
{
getHiveAvatarUrl
(
accountName
)
}
alt
=
"avatar"
width
=
{
5
0
}
height
=
{
5
0
}
width
=
{
6
0
}
height
=
{
6
0
}
data-testid
=
"user-avatar"
/>
</
span
>
<
div
>
<
h2
className
=
"text-lg font-semibold text-gray-800 dark:text-white"
>
{
accountDetails
.
name
}
</
h2
>
{
accountDetails
.
is_witness
&&
(
<
div
className
=
"flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400"
>
<
span
className
=
{
cn
({
"
line-through text-red-500
"
:
!
isWitnessActive
,
})
}
>
Witness
</
span
>
{
witnessDetails
?.
witness
.
rank
&&
isWitnessActive
&&
(
<
span
className
=
"flex items-center gap-1"
>
<
FontAwesomeIcon
icon
=
{
faStar
}
data-testid
=
"witness-rank-icon"
/>
<
span
>
{
witnessDetails
.
witness
.
rank
}
</
span
>
</
span
>
)
}
{
witnessDetails
?.
witness
.
url
&&
isWitnessActive
&&
(
<
a
href
=
{
witnessDetails
.
witness
.
url
}
target
=
"_blank"
rel
=
"noopener noreferrer"
>
<
FontAwesomeIcon
icon
=
{
faLink
}
data-testid
=
"witness-url-icon"
/>
</
a
>
)
}
</
div
>
)
}
</
div
>
</
div
>
</
div
>
</
CardHeader
>
</
Card
>
...
...
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