import
{
Block
,
DataList
,
Text
,
useDeviceInfo
}
from
'@platform-blocks/react-ui-library'
;
const
{
runtime
,
system
,
screen
,
appearance
,
locale
,
input
,
safeArea
,
helpers
,
network
,
meta
}
=
useDeviceInfo
(
{
enableExtendedData
:
true
}
)
;
<Text
size
=
"sm"
weight
=
"semibold"
>
Platform
&
runtime
</Text
>
<DataList
labelWidth
=
{
150
}
withDivider
>
value
=
{
`${system.os.name ?? 'Unknown'} ${system.os.version ?? ''}`
.
trim
(
)
}
value
=
{
[
system
.
device
.
type
,
system
.
device
.
brand
,
system
.
device
.
model
]
.
filter
(
Boolean
)
.
join
(
' • '
)
}
value
=
{
runtime
.
browserName
?
`${runtime.browserName} ${runtime.browserVersion ?? ''}`
.
trim
(
)
:
runtime
.
jsEngine
??
'Native'
}
<Text
size
=
"sm"
weight
=
"semibold"
>
Screen
&
appearance
</Text
>
<DataList
labelWidth
=
{
150
}
withDivider
>
value
=
{
`${Math.round(screen.width)} × ${Math.round(screen.height)} @${screen.scale}x`
}
<DataList.Item
label
=
"Orientation"
value
=
{
screen
.
orientation
}
/>
value
=
{
`${safeArea.top} / ${safeArea.right} / ${safeArea.bottom} / ${safeArea.left}`
}
<DataList.Item
label
=
"Color scheme"
value
=
{
`${appearance.colorScheme} • contrast ${appearance.contrast}`
}
/>
<DataList.Item
label
=
"Reduced motion"
value
=
{
appearance
.
reducedMotion
?
'Enabled'
:
'Disabled'
}
/>
<Text
size
=
"sm"
weight
=
"semibold"
>
Locale
&
input
</Text
>
<DataList
labelWidth
=
{
150
}
withDivider
>
<DataList.Item
label
=
"Locale"
value
=
{
`${locale.language}-${locale.region ?? '??'}`
.
toUpperCase
(
)
}
/>
value
=
{
`${locale.timeZone} • ${locale.uses24HourClock ? '24h' : '12h'} clock`
}
<DataList.Item
label
=
"Pointers"
value
=
{
input
.
pointerTypes
.
join
(
', '
)
||
'None'
}
/>
value
=
{
helpers
.
isMobile
?
'Mobile / touch-first'
:
helpers
.
isDesktop
?
'Desktop'
:
'Unknown'
}
?
`${network.connectionType} • ${network.downlink.toFixed(1)} Mbps`
:
network
?
.
connectionType
??
(
meta
.
ready
?
'Unavailable'
:
'Loading…'
)
}