Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously an unversioned directory inside ~/src/blockninja-themes/kindergarten. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
54 lines
1.2 KiB
Go
54 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
|
|
"git.dev.alexdunmow.com/block/core/blocks"
|
|
)
|
|
|
|
// ScheduleBlockMeta defines metadata for the day schedule block.
|
|
var ScheduleBlockMeta = blocks.BlockMeta{
|
|
Key: "schedule",
|
|
Title: "Day Schedule",
|
|
Description: "Daycare/classroom day plan with crayon time-pills.",
|
|
Category: blocks.CategoryContent,
|
|
Source: "kindergarten",
|
|
}
|
|
|
|
// ScheduleItem is a single time/activity row.
|
|
type ScheduleItem struct {
|
|
Time string
|
|
Activity string
|
|
Icon string
|
|
}
|
|
|
|
// ScheduleData is the renderer's strongly-typed input.
|
|
type ScheduleData struct {
|
|
Title string
|
|
Items []ScheduleItem
|
|
}
|
|
|
|
// ScheduleBlock renders the day-schedule block.
|
|
// Content shape: {title,items:[{time,activity,icon}]}.
|
|
func ScheduleBlock(ctx context.Context, content map[string]any) string {
|
|
raw := getSlice(content, "items")
|
|
items := make([]ScheduleItem, 0, len(raw))
|
|
for _, m := range raw {
|
|
items = append(items, ScheduleItem{
|
|
Time: getString(m, "time"),
|
|
Activity: getString(m, "activity"),
|
|
Icon: getString(m, "icon"),
|
|
})
|
|
}
|
|
|
|
data := ScheduleData{
|
|
Title: getString(content, "title"),
|
|
Items: items,
|
|
}
|
|
|
|
var buf bytes.Buffer
|
|
_ = scheduleComponent(data).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|