Skip to content
GitLab
Explore
Sign in
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
c0cbaa5d
Commit
c0cbaa5d
authored
3 months ago
by
Lukas
Committed by
mcfarhat
3 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Render vote details table
parent
9f683711
No related branches found
No related tags found
1 merge request
!505
Lbudginas/#404 part2 create vote details table
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
components/post/PostContentCard.tsx
+17
-2
17 additions, 2 deletions
components/post/PostContentCard.tsx
components/post/PostPageContent.tsx
+11
-1
11 additions, 1 deletion
components/post/PostPageContent.tsx
components/post/PostPropertiesTable.tsx
+7
-1
7 additions, 1 deletion
components/post/PostPropertiesTable.tsx
with
35 additions
and
4 deletions
components/post/PostContentCard.tsx
+
17
−
2
View file @
c0cbaa5d
...
@@ -8,13 +8,17 @@ import Hive from "@/types/Hive";
...
@@ -8,13 +8,17 @@ import Hive from "@/types/Hive";
interface
PostContentCardProps
{
interface
PostContentCardProps
{
isPropertiesOpen
:
boolean
;
isPropertiesOpen
:
boolean
;
isVoteDetailsOpen
:
boolean
;
handlePropertiesToggle
:
()
=>
void
;
handlePropertiesToggle
:
()
=>
void
;
handleVoteDetailsToggle
:
()
=>
void
;
data
:
Hive
.
Content
;
data
:
Hive
.
Content
;
}
}
const
PostContentCard
:
React
.
FC
<
PostContentCardProps
>
=
({
const
PostContentCard
:
React
.
FC
<
PostContentCardProps
>
=
({
isPropertiesOpen
,
isPropertiesOpen
,
isVoteDetailsOpen
,
handlePropertiesToggle
,
handlePropertiesToggle
,
handleVoteDetailsToggle
,
data
,
data
,
})
=>
{
})
=>
{
if
(
!
data
)
return
;
if
(
!
data
)
return
;
...
@@ -47,10 +51,10 @@ const PostContentCard: React.FC<PostContentCardProps> = ({
...
@@ -47,10 +51,10 @@ const PostContentCard: React.FC<PostContentCardProps> = ({
</
CardContent
>
</
CardContent
>
<
CardFooter
className
=
"p-0"
>
<
CardFooter
className
=
"p-0"
>
<
div
className
=
"flex w-full py-
2
px-4 border-t-[1px] border-slate-400"
>
<
div
className
=
"flex w-full py-
1
px-4 border-t-[1px] border-slate-400"
>
<
button
<
button
onClick
=
{
handlePropertiesToggle
}
onClick
=
{
handlePropertiesToggle
}
className
=
"flex items-center text-xs p-2 hover:bg-buttonHover"
className
=
"flex items-center text-xs p
x
-2 hover:bg-buttonHover"
>
>
Properties
Properties
{
isPropertiesOpen
?
(
{
isPropertiesOpen
?
(
...
@@ -59,6 +63,17 @@ const PostContentCard: React.FC<PostContentCardProps> = ({
...
@@ -59,6 +63,17 @@ const PostContentCard: React.FC<PostContentCardProps> = ({
<
ChevronDown
className
=
"w-4 ml-1"
/>
<
ChevronDown
className
=
"w-4 ml-1"
/>
)
}
)
}
</
button
>
</
button
>
<
button
onClick
=
{
handleVoteDetailsToggle
}
className
=
"flex items-center text-xs px-2 hover:bg-buttonHover"
>
Vote Details
{
isVoteDetailsOpen
?
(
<
ChevronUp
className
=
"w-4 ml-1"
/>
)
:
(
<
ChevronDown
className
=
"w-4 ml-1"
/>
)
}
</
button
>
</
div
>
</
div
>
</
CardFooter
>
</
CardFooter
>
</
Card
>
</
Card
>
...
...
This diff is collapsed.
Click to expand it.
components/post/PostPageContent.tsx
+
11
−
1
View file @
c0cbaa5d
...
@@ -5,6 +5,7 @@ import Link from "next/link";
...
@@ -5,6 +5,7 @@ import Link from "next/link";
import
usePostContent
from
"
@/hooks/api/postPage/usePostContent
"
;
import
usePostContent
from
"
@/hooks/api/postPage/usePostContent
"
;
import
PostContentCard
from
"
./PostContentCard
"
;
import
PostContentCard
from
"
./PostContentCard
"
;
import
PostPropertiesTable
from
"
./PostPropertiesTable
"
;
import
PostPropertiesTable
from
"
./PostPropertiesTable
"
;
import
VoteDetailsTable
from
"
./VoteDetailsTable
"
;
const
HIVE_BLOG_URL
=
"
https://hive.blog
"
;
const
HIVE_BLOG_URL
=
"
https://hive.blog
"
;
const
PEAKD_URL
=
"
https://peakd.com
"
;
const
PEAKD_URL
=
"
https://peakd.com
"
;
...
@@ -20,12 +21,15 @@ const PostPageContent = () => {
...
@@ -20,12 +21,15 @@ const PostPageContent = () => {
const
{
data
}
=
usePostContent
(
accountName
,
permlink
);
const
{
data
}
=
usePostContent
(
accountName
,
permlink
);
const
[
isPropertiesOpen
,
setIsPropertiesOpen
]
=
useState
(
false
);
const
[
isPropertiesOpen
,
setIsPropertiesOpen
]
=
useState
(
false
);
const
[
isVoteDetailsOpen
,
setIsVoteDetailsOpen
]
=
useState
(
false
);
const
handlePropertiesToggle
=
()
=>
setIsPropertiesOpen
(
!
isPropertiesOpen
);
const
handlePropertiesToggle
=
()
=>
setIsPropertiesOpen
(
!
isPropertiesOpen
);
const
handleVoteDetailsToggle
=
()
=>
setIsVoteDetailsOpen
(
!
isVoteDetailsOpen
);
if
(
!
data
)
return
;
if
(
!
data
)
return
;
const
{
title
,
author
}
=
data
;
const
{
title
,
author
,
active_votes
}
=
data
;
return
(
return
(
<
div
className
=
"w-full h-full p-10"
>
<
div
className
=
"w-full h-full p-10"
>
...
@@ -63,13 +67,19 @@ const PostPageContent = () => {
...
@@ -63,13 +67,19 @@ const PostPageContent = () => {
<
PostContentCard
<
PostContentCard
isPropertiesOpen
=
{
isPropertiesOpen
}
isPropertiesOpen
=
{
isPropertiesOpen
}
isVoteDetailsOpen
=
{
isVoteDetailsOpen
}
handlePropertiesToggle
=
{
handlePropertiesToggle
}
handlePropertiesToggle
=
{
handlePropertiesToggle
}
handleVoteDetailsToggle
=
{
handleVoteDetailsToggle
}
data
=
{
data
}
data
=
{
data
}
/>
/>
<
PostPropertiesTable
<
PostPropertiesTable
isPropertiesOpen
=
{
isPropertiesOpen
}
isPropertiesOpen
=
{
isPropertiesOpen
}
data
=
{
data
}
data
=
{
data
}
/>
/>
<
VoteDetailsTable
isVoteDetailsOpen
=
{
isVoteDetailsOpen
}
voteDetails
=
{
active_votes
}
/>
</
div
>
</
div
>
);
);
};
};
...
...
This diff is collapsed.
Click to expand it.
components/post/PostPropertiesTable.tsx
+
7
−
1
View file @
c0cbaa5d
...
@@ -29,7 +29,13 @@ const PROPERTY_KEYS = [
...
@@ -29,7 +29,13 @@ const PROPERTY_KEYS = [
];
];
const
renderParam
=
(
const
renderParam
=
(
value
:
string
|
number
|
boolean
|
string
[]
|
number
[]
value
:
|
string
|
number
|
boolean
|
string
[]
|
number
[]
|
Hive
.
PostPageVoteDetails
[]
)
=>
{
)
=>
{
if
(
typeof
value
===
"
string
"
)
{
if
(
typeof
value
===
"
string
"
)
{
return
value
.
toString
();
return
value
.
toString
();
...
...
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