Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
SSHOC
sshoc-marketplace-frontend
Commits
b99d331a
Commit
b99d331a
authored
Dec 10, 2020
by
Stefan Probst
Browse files
fix: add contributors to details list
parent
f4019030
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/screens/item/ItemLayout.tsx
View file @
b99d331a
...
...
@@ -34,6 +34,8 @@ const Markdown = dynamic(() => import('@/modules/markdown/Markdown'))
type
ItemCategory
=
Exclude
<
ItemCategoryWithStep
,
'
step
'
>
type
ItemProperties
=
Exclude
<
Item
[
'
properties
'
],
undefined
>
type
ItemProperty
=
ItemProperties
[
number
]
type
ItemContributors
=
Exclude
<
Item
[
'
contributors
'
],
undefined
>
type
ItemContributor
=
ItemContributors
[
number
]
type
RelatedItems
=
Exclude
<
Item
[
'
relatedItems
'
],
undefined
>
/**
...
...
@@ -105,6 +107,7 @@ export default function ItemLayout({
/>
<
ItemPropertiesList
properties
=
{
item
.
properties
as
ItemProperties
}
contributors
=
{
item
.
contributors
as
ItemContributors
}
/>
</
VStack
>
</
SideColumn
>
...
...
@@ -320,7 +323,13 @@ function ItemMedia({ properties }: { properties: ItemProperties }) {
/**
* Properties.
*/
function
ItemPropertiesList
({
properties
}:
{
properties
:
ItemProperties
})
{
function
ItemPropertiesList
({
properties
,
contributors
,
}:
{
properties
:
ItemProperties
contributors
:
ItemContributors
})
{
const
groupedProperties
=
useMemo
(()
=>
{
if
(
properties
===
undefined
||
properties
.
length
===
0
)
return
null
...
...
@@ -343,6 +352,28 @@ function ItemPropertiesList({ properties }: { properties: ItemProperties }) {
<
VStack
className
=
"space-y-4"
>
<
SubSectionTitle
as
=
"h2"
>
Details
</
SubSectionTitle
>
<
VStack
as
=
"dl"
className
=
"space-y-2 text-sm leading-7"
>
{
/* contributors are a top-level field, not a property */
}
<
dt
className
=
"inline mr-2 text-gray-500"
>
Contributors:
</
dt
>
<
dd
className
=
"inline"
>
{
contributors
.
map
((
contributor
,
index
)
=>
{
if
(
contributor
==
null
||
contributor
.
actor
==
null
)
return
null
return
(
<
Fragment
key
=
{
`
${
contributor
.
actor
.
id
}${
contributor
.
role
?.
code
}
`
}
>
{
index
!==
0
?
<
span
>
,
</
span
>
:
null
}
{
contributor
.
actor
?.
website
!=
null
?
(
<
a
href
=
{
contributor
.
actor
.
website
}
>
{
contributor
.
actor
.
name
}
</
a
>
)
:
(
contributor
.
actor
.
name
)
}
</
Fragment
>
)
})
}
</
dd
>
{
sortedLabels
.
map
((
label
)
=>
{
const
properties
=
groupedProperties
[
label
]
return
(
...
...
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