diff --git a/js/app/components/container.tsx b/js/app/components/container.tsx index ea44c6a4..aaf92f8d 100644 --- a/js/app/components/container.tsx +++ b/js/app/components/container.tsx @@ -23,6 +23,7 @@ function getMaxWidth(width: number): number { if (width >= 800) return maxContainerWidths.xl; if (width >= 740) return maxContainerWidths.lg; if (width >= 660) return maxContainerWidths.md; + if (width >= 440) return width; return maxContainerWidths.sm; } @@ -33,6 +34,7 @@ export default function Container({ }: ContainerProps) { const { width } = useWindowDimensions(); const maxWidth = getMaxWidth(width); + const isMobile = width < 768; return ( { const layoutHorizontal = horizontal; + const inMobileMode = horizontal && !showAvatar; const { url } = useStreamplaceNode(); const { theme } = useTheme(); const isWeb = Platform.OS === "web"; @@ -95,8 +98,8 @@ const StreamCard = ({ const contentPaddingHoriz = 12; const contentPaddingVertical = 2.65; const avatarSize = 40; - const livePillHeight = 30; - const livePillPaddingHorizontal = 4; + const livePillHeight = inMobileMode ? 20 : 30; + const livePillPaddingHorizontal = inMobileMode ? 2 : 4; const contentSectionHeight = avatarSize + 2 * contentPaddingVertical; const contentSectionWidth = avatarSize * 2 + contentPaddingHoriz; @@ -123,7 +126,11 @@ const StreamCard = ({ style={[ { flex: layoutHorizontal ? 0 : undefined, - minWidth: layoutHorizontal ? "63%" : "100%", + minWidth: layoutHorizontal + ? inMobileMode + ? "40%" + : "63%" + : "100%", // native seems to be unable to adjust widths properly? maxHeight: !isWeb ? "76.5%" : "100%", position: "relative", @@ -146,8 +153,8 @@ const StreamCard = ({ style={[ { position: "absolute", - top: contentPaddingHoriz, - right: contentPaddingVertical, + top: contentPaddingVertical * 2, + right: contentPaddingVertical * 2, backgroundColor: "rgba(0, 0, 0, 0.75)", borderRadius: 999, borderWidth: 1, @@ -161,7 +168,10 @@ const StreamCard = ({ }, ]} > - + )} @@ -182,42 +192,46 @@ const StreamCard = ({ ]} > {/* Avatar */} - - {/* dynamically switching between these src crashes android */} - {avatarUrl && ( - - - - )} - {!avatarUrl && ( - - - - )} - + {showAvatar && ( + + {/* dynamically switching between these src crashes android */} + {avatarUrl && ( + + + + )} + {!avatarUrl && ( + + + + )} + + )} {/* Text content */} @@ -264,12 +279,13 @@ const StreamCard = ({ {((activity && category.length > 0) || tags.length > 0) && ( { const width = e.nativeEvent?.layout?.width; @@ -283,7 +299,7 @@ const StreamCard = ({ { @@ -300,7 +316,10 @@ const StreamCard = ({ {activity} )} - {tagItems.slice(0, visibleTagCount).map((cat, index) => ( + {(inMobileMode + ? tagItems + : tagItems.slice(0, visibleTagCount) + ).map((cat, index) => ( = 3; const firstRowCols = useHorizontalFirst ? cols - 1 : cols; @@ -336,7 +341,7 @@ export default function HomeScreen({ { flexDirection: "row" }, { gap: 24, - marginBottom: 24, + marginBottom: useHorizontalAll ? 12 : 24, width: "100%", }, ]} @@ -358,7 +363,10 @@ export default function HomeScreen({ item={item} size={size} avatarUrl={avis[item.author.did]?.avatar} - horizontal={itemIndex == 0 && useHorizontalFirst} + horizontal={ + useHorizontalAll || (itemIndex == 0 && useHorizontalFirst) + } + showAvatar={!useHorizontalAll} /> ))} @@ -384,7 +392,7 @@ export default function HomeScreen({ key={`row-${rowIndex}`} style={[ { flexDirection: "row" }, - { gap: 24, marginBottom: 24 }, + { gap: 24, marginBottom: useHorizontalAll ? 12 : 24 }, ]} > {row.map((item, itemIndex) => @@ -397,6 +405,8 @@ export default function HomeScreen({ item={item} size={size} avatarUrl={avis[item.author.did]?.avatar} + horizontal={useHorizontalAll} + showAvatar={!useHorizontalAll} /> ) : ( diff --git a/js/components/src/components/mobile-player/ui/viewers.tsx b/js/components/src/components/mobile-player/ui/viewers.tsx index aea7b81d..688a5d7a 100644 --- a/js/components/src/components/mobile-player/ui/viewers.tsx +++ b/js/components/src/components/mobile-player/ui/viewers.tsx @@ -9,18 +9,29 @@ export function Viewers() { return ; } -export function DehydratedViewers({ viewers }: { viewers: number }) { +export function DehydratedViewers({ + viewers, + size = "md", +}: { + viewers: number; + size?: "sm" | "md"; +}) { + const iconSize = size === "sm" ? 12 : 24; + const fontSize = size === "sm" ? 11 : 16; return ( - - + + ); }