mirror of
https://github.com/streamwall/streamwall.git
synced 2026-04-03 20:32:08 -04:00
Orientation icons in grid labels
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
|||||||
useState,
|
useState,
|
||||||
} from 'preact/hooks'
|
} from 'preact/hooks'
|
||||||
import { useHotkeys } from 'react-hotkeys-hook'
|
import { useHotkeys } from 'react-hotkeys-hook'
|
||||||
|
import { IconType } from 'react-icons'
|
||||||
import {
|
import {
|
||||||
FaExchangeAlt,
|
FaExchangeAlt,
|
||||||
FaRedoAlt,
|
FaRedoAlt,
|
||||||
@@ -740,7 +741,13 @@ export function ControlUI({
|
|||||||
isError={matchesState('displaying.error', state.state)}
|
isError={matchesState('displaying.error', state.state)}
|
||||||
>
|
>
|
||||||
<StyledGridInfo>
|
<StyledGridInfo>
|
||||||
<StyledGridLabel>{streamId}</StyledGridLabel>
|
<StyledGridLabel>
|
||||||
|
{streamId}
|
||||||
|
<OrientationIndicator
|
||||||
|
orientation={data?.orientation ?? null}
|
||||||
|
className={`orientation-${(data?.orientation ?? 'unknown').toLowerCase()}`}
|
||||||
|
/>
|
||||||
|
</StyledGridLabel>
|
||||||
<div>{data?.source}</div>
|
<div>{data?.source}</div>
|
||||||
{data?.city && (
|
{data?.city && (
|
||||||
<StyledGridLocation>
|
<StyledGridLocation>
|
||||||
@@ -987,6 +994,19 @@ function StreamDelayBox({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function OrientationIndicator({
|
||||||
|
orientation,
|
||||||
|
...props
|
||||||
|
}: { orientation: 'V' | 'H' | null } & React.ComponentProps<IconType>) {
|
||||||
|
if (orientation === 'V') {
|
||||||
|
return <MdOutlineStayCurrentPortrait {...props} />
|
||||||
|
} else if (orientation === 'H') {
|
||||||
|
return <MdOutlineStayCurrentLandscape {...props} />
|
||||||
|
} else {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function StreamLine({
|
function StreamLine({
|
||||||
id,
|
id,
|
||||||
row: { label, source, link, notes, city, state, orientation },
|
row: { label, source, link, notes, city, state, orientation },
|
||||||
@@ -1017,13 +1037,7 @@ function StreamLine({
|
|||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<strong>{source}</strong>{' '}
|
<strong>{source}</strong>{' '}
|
||||||
{orientation === 'V' ? (
|
<OrientationIndicator orientation={orientation} />{' '}
|
||||||
<MdOutlineStayCurrentPortrait />
|
|
||||||
) : orientation === 'H' ? (
|
|
||||||
<MdOutlineStayCurrentLandscape />
|
|
||||||
) : (
|
|
||||||
''
|
|
||||||
)}{' '}
|
|
||||||
{city ? `(${city} ${state}) ` : ''}
|
{city ? `(${city} ${state}) ` : ''}
|
||||||
<a href={link} target="_blank">
|
<a href={link} target="_blank">
|
||||||
{truncate(link, { length: 55 })}
|
{truncate(link, { length: 55 })}
|
||||||
@@ -1482,7 +1496,15 @@ const StyledGridInfo = styled.div`
|
|||||||
`
|
`
|
||||||
|
|
||||||
const StyledGridLabel = styled.div`
|
const StyledGridLabel = styled.div`
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 8px;
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
|
|
||||||
|
.orientation-v {
|
||||||
|
margin-left: -4px;
|
||||||
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const StyledGridLocation = styled.div`
|
const StyledGridLocation = styled.div`
|
||||||
|
|||||||
Reference in New Issue
Block a user