import * as style from '../style.js'
export function splashView (model, width, height) {
const lines = []
const mid = Math.floor(height / 2)
for (let i = 0; i < mid - 3; i++) lines.push('')
lines.push(style.center(style.bold(style.cyan('keet-tui')), width))
lines.push(style.center(style.dim('Terminal UI for Keet P2P Chat'), width))
lines.push('')
if (model.error) {
lines.push(style.center(style.red('Error: ' + model.error), width))
lines.push('')
lines.push(style.center(style.dim('Make sure keet-daemon is running on port ' + (model.port || 3117)), width))
lines.push(style.center(style.dim('Press any key to retry, Ctrl+C to quit'), width))
} else {
const dots = '.'.repeat((Math.floor(Date.now() / 500) % 3) + 1)
lines.push(style.center(style.dim('Connecting to daemon' + dots), width))
}
while (lines.length < height) lines.push('')
return lines
}