5875
Os
ollama-space-molt-player / files
ollama-space-molt-player / packages / tui / tests / manual / layout-preview.tsx
3.5 KB
1#!/usr/bin/env bun 2 3import React from "react"; 4import { Box, Text } from "ink"; 5import { runTests, createMockData } from "./test-harness.tsx"; 6import { colors, boxChars, ascii, layout } from "../../src/theme.ts"; 7 8interface LayoutPreviewProps { 9 width: number; 10 height: number; 11} 12 13function LayoutPreview({ width, height }: LayoutPreviewProps) { 14 const headerHeight = layout.headerHeight; 15 const contentHeight = height - headerHeight - 2; 16 const sidebarWidth = layout.sidebarWidth; 17 const mainWidth = width - sidebarWidth - 4; 18 19 return ( 20 <Box flexDirection="column" width={width} height={height}> 21 <Box borderStyle="double" borderColor={colors.primary} height={headerHeight} width={width}> 22 <Text bold color={colors.primary}> 23 {" "} 24 SPACEMOLT TERMINAL {ascii.separator} TICK: 1337 {ascii.separator} STATUS: ACTIVE{" "} 25 </Text> 26 </Box> 27 28 <Box flexDirection="row" height={contentHeight}> 29 <Box flexDirection="column" width={mainWidth}> 30 <Box 31 borderStyle="single" 32 borderColor={colors.border} 33 height={Math.floor(contentHeight / 2)} 34 flexGrow={1} 35 > 36 <Box flexDirection="column" padding={1}> 37 <Text bold color={colors.accent}> 38 {ascii.diamond} PLAYER ACTIONS & RESPONSES 39 </Text> 40 <Text dimColor>{ascii.arrow} Last action: travel sector-7</Text> 41 <Text color={colors.success}>{ascii.bullet} Success: Travel initiated</Text> 42 </Box> 43 </Box> 44 45 <Box 46 borderStyle="single" 47 borderColor={colors.border} 48 height={Math.floor(contentHeight / 2)} 49 flexGrow={1} 50 > 51 <Box flexDirection="column" padding={1}> 52 <Text bold color={colors.accent}> 53 {ascii.diamond} SOCIAL [CHAT | FORUM] 54 </Text> 55 <Text dimColor>{ascii.bullet} local | Trader_01: Anyone selling fuel?</Text> 56 <Text dimColor>{ascii.bullet} Forum: Welcome to SpaceMolt! (42 replies)</Text> 57 </Box> 58 </Box> 59 </Box> 60 61 <Box flexDirection="column" width={sidebarWidth}> 62 <Box 63 borderStyle="single" 64 borderColor={colors.border} 65 height={Math.floor(contentHeight / 2)} 66 flexGrow={1} 67 > 68 <Box flexDirection="column" padding={1}> 69 <Text bold color={colors.info}> 70 {ascii.star} SHIP STATUS 71 </Text> 72 <Text>Health: 85%</Text> 73 <Text>Fuel: 42%</Text> 74 <Text dimColor>Location: Alpha Centauri</Text> 75 </Box> 76 </Box> 77 78 <Box 79 borderStyle="single" 80 borderColor={colors.border} 81 height={Math.floor(contentHeight / 2)} 82 flexGrow={1} 83 > 84 <Box flexDirection="column" padding={1}> 85 <Text bold color={colors.warning}> 86 {ascii.triangle} SERVER MESSAGES 87 </Text> 88 <Text dimColor>{ascii.bullet} Combat: Enemy detected</Text> 89 <Text dimColor>{ascii.bullet} Trade: Market updated</Text> 90 </Box> 91 </Box> 92 </Box> 93 </Box> 94 </Box> 95 ); 96} 97 98runTests("Layout Preview Tests", [ 99 { 100 name: "Standard Terminal (120x30)", 101 description: "Typical terminal size for desktop development", 102 component: <LayoutPreview width={120} height={30} />, 103 }, 104 { 105 name: "Wide Terminal (160x40)", 106 description: "Large monitor or split-screen setup", 107 component: <LayoutPreview width={160} height={40} />, 108 }, 109 { 110 name: "Compact Terminal (80x24)", 111 description: "Minimal viable size for the UI", 112 component: <LayoutPreview width={80} height={24} />, 113 }, 114 { 115 name: "Narrow Terminal (100x30)", 116 description: "Laptop or smaller screen", 117 component: <LayoutPreview width={100} height={30} />, 118 }, 119]);