Calendar

A calendar, allowing you to add notes to dates.

screenshot

calendar

#!/usr/bin/pinafore
openDefault.Store >>= fn store =>
import "pinafore-gnome" in
with GTK. in
let

    dateNotesOf: Property Date Text =
    property @Date @Text !"example.calendar:dateNotes" store;

    ui: WholeModel Date -> Widget =
    fn r =>
    vertical.Widget
    [
    horizontal.Widget
        [
        button.Widget {"<"} {do d <- get r; r := pred.Date d; end},
        layoutGrow.Widget $ label.Widget {encode (unixAsText.Date "%A, %B %e, %Y") %r},
        button.Widget {">"} {do d <- get r; r := succ.Date d; end}
        ],
    layoutGrow.Widget $ textArea.Widget (fromWhole.TextModel $ dateNotesOf !$ r)
    ];

in
do
    r <- newMem.WholeModel;
    d <- getNowLocal.Date;
    r := d;
    run $ fn gtk => open.Window gtk (300,400) {show %r} $ ui r;
end