import Categories from "./Categories"; import Header from "./Header"; import TabRouter from "./Tabs/TabRouter"; interface FrontProps { columns: number; rows: number; selectedTab: "About" | "Projects" | "Contact"; scrollPosition: number; } const minimumWidth = 90; const minimumHeight = 20; const terminalTooSmall = (width: number, height: number) => { return ( `\x1b[31mOh no!\x1b[0m Your terminal window is too small!${newLine}` + `Minimum size required: ${minimumWidth}x${minimumHeight}${newLine}` + `Current size: ${width >= minimumWidth ? width : `\x1b[31m${width}\x1b[0m`}x${ height >= minimumHeight ? height : `\x1b[31m${height}\x1b[0m` }${newLine}` ); }; const Front = async ({ columns, rows, selectedTab, scrollPosition }: FrontProps) => { if (columns < minimumWidth || rows < minimumHeight) { return terminalTooSmall(columns, rows); } return ( `${Header({ width: columns, height: 3 })}${newLine}` + `${Categories({ width: columns, height: 3, selectedTab })}${newLine}` + `${await TabRouter({ width: columns, height: rows - 6, selectedTab, scrollPosition })}` ); }; const newLine = "\n\r"; export default Front; export { newLine };