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
fb9333d7
Commit
fb9333d7
authored
Dec 22, 2020
by
Stefan Probst
Browse files
fix: add source and licenses to item metadata list
parent
6bc254eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/screens/item/ItemLayout.tsx
View file @
fb9333d7
...
...
@@ -75,7 +75,7 @@ export default function ItemLayout({
label
:
itemCategories
[
item
.
category
],
},
{
pathname
:
`/
${
item
.
category
}
/
${
item
.
i
d
}
`
,
pathname
:
`/
${
item
.
category
}
/
${
item
.
persistentI
d
}
`
,
label
:
item
.
label
,
},
]
}
...
...
@@ -107,6 +107,8 @@ export default function ItemLayout({
<
ItemPropertiesList
properties
=
{
item
.
properties
as
ItemProperties
}
contributors
=
{
item
.
contributors
as
ItemContributors
}
licenses
=
{
item
.
licenses
}
source
=
{
item
.
source
}
/>
</
VStack
>
</
SideColumn
>
...
...
@@ -325,9 +327,13 @@ function ItemMedia({ properties }: { properties: ItemProperties }) {
function
ItemPropertiesList
({
properties
,
contributors
,
licenses
,
source
,
}:
{
properties
:
ItemProperties
contributors
:
ItemContributors
licenses
?:
Item
[
'
licenses
'
]
source
?:
Item
[
'
source
'
]
})
{
const
groupedProperties
=
useMemo
(()
=>
{
if
(
properties
===
undefined
||
properties
.
length
===
0
)
return
null
...
...
@@ -352,29 +358,49 @@ function ItemPropertiesList({
<
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 */
}
<
div
>
<
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
>
</
div
>
{
contributors
!==
undefined
&&
contributors
.
length
>
0
?
(
<
div
>
<
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
>
</
div
>
)
:
null
}
{
/* source is a top-level field, not a property */
}
{
source
!==
undefined
?
(
<
div
>
<
dt
className
=
"inline mr-2 text-gray-500"
>
Source:
</
dt
>
<
dd
className
=
"inline"
>
<
Fragment
key
=
{
source
.
id
}
>
{
source
.
url
!=
null
?
(
<
a
href
=
{
source
.
url
}
>
{
source
.
label
}
</
a
>
)
:
(
source
.
label
)
}
</
Fragment
>
</
dd
>
</
div
>
)
:
null
}
{
/* properties */
}
{
sortedLabels
.
map
((
label
)
=>
{
const
properties
=
groupedProperties
[
label
]
return
(
...
...
@@ -393,6 +419,27 @@ function ItemPropertiesList({
</
div
>
)
})
}
{
/* licenses are a top-level field, not a property */
}
{
licenses
!==
undefined
&&
licenses
.
length
>
0
?
(
<
div
>
<
dt
className
=
"inline mr-2 text-gray-500"
>
Licenses:
</
dt
>
<
dd
className
=
"inline"
>
{
licenses
.
map
((
license
,
index
)
=>
{
return
(
<
Fragment
key
=
{
license
.
code
}
>
{
index
!==
0
?
<
span
>
,
</
span
>
:
null
}
{
license
.
accessibleAt
!=
null
?
(
<
a
href
=
{
license
.
accessibleAt
}
>
{
license
.
label
}
</
a
>
)
:
(
license
.
label
)
}
</
Fragment
>
)
})
}
</
dd
>
</
div
>
)
:
null
}
</
VStack
>
</
VStack
>
)
...
...
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