package main import ( "bytes" "context" "git.dev.alexdunmow.com/block/core/blocks" ) // AsciiHeaderBlockMeta defines metadata for the TTY ascii header block. var AsciiHeaderBlockMeta = blocks.BlockMeta{ Key: "ascii_header", Title: "ASCII Header", Description: "Figlet-style TTY banner with a shell prompt line", Source: "terminal", Category: blocks.CategoryLayout, } // AsciiHeaderData is the parsed content for the ascii_header block. type AsciiHeaderData struct { Title string Prompt string AsciiArt string } // AsciiHeaderBlock renders the TTY banner. // Content shape: {title, prompt, asciiArt}. func AsciiHeaderBlock(ctx context.Context, content map[string]any) string { data := AsciiHeaderData{ Title: getString(content, "title"), Prompt: getString(content, "prompt"), AsciiArt: getString(content, "asciiArt"), } // Sensible empty-state defaults so unconfigured blocks still render // something terminal-flavoured rather than an empty surface. if data.Title == "" && data.AsciiArt == "" { data.Title = "~" } if data.Prompt == "" { data.Prompt = "$ " } var buf bytes.Buffer _ = asciiHeaderComponent(data).Render(ctx, &buf) return buf.String() }