module web

import veb
import web.components.carousel
import freeflowuniverse.crystallib.ui.console
import freeflowuniverse.crystallib.core.playbook
import os

pub fn (app &App) carousel(mut ctx Context) veb.Result {
	mut plbook := playbook.new(text: carousel.example_heroscript) or {
		return ctx.server_error(err.str())
	}
	components := carousel.play(mut plbook) or {
		return ctx.server_error(err.str())
	}
	return ctx.html(components['intro1.myintro'].html())
}

// // Custom 404 handler
pub fn (mut ctx Context) not_found() veb.Result {
	ctx.res.set_status(.not_found)
	return ctx.html('<h1>Page not found!</h1>')
}
