{ "format_version": 1, "id": "album", "name": "Album", "plural": "Albums", "builtin": true, "visibility": "owner", "date": "starts_at", "title": "title", "columns": [ { "key": "kind", "name": "Kind", "type": "choice", "choices": [ "trip", "event" ], "labels": { "trip": "Trip", "event": "Event" }, "readonly": true }, { "key": "state", "name": "State", "type": "choice", "choices": [ "open", "kept", "dismissed" ], "labels": { "open": "Suggested", "kept": "Kept", "dismissed": "Not this" }, "readonly": true }, { "key": "decided_at", "name": "Decided", "type": "date", "readonly": true }, { "key": "title", "name": "Name", "type": "text", "required": true, "placeholder": "Name this album" }, { "key": "title_by", "type": "text", "readonly": true }, { "key": "starts_at", "name": "Days", "type": "date", "readonly": true, "until": "ends_at" }, { "key": "ends_at", "name": "To", "type": "date", "readonly": true }, { "key": "home_label", "name": "Home", "type": "text", "readonly": true }, { "key": "cover_id", "name": "Cover picture", "type": "text", "readonly": true }, { "key": "origin_handle", "type": "text", "readonly": true }, { "key": "trashed_at", "type": "date", "format": "calendar-datetime", "readonly": true }, { "key": "cover_key", "name": "Cover", "type": "photo", "readonly": true, "size": [ "cover_width", "cover_height" ] }, { "key": "cover_width", "name": "Cover width", "type": "number", "readonly": true }, { "key": "cover_height", "name": "Cover height", "type": "number", "readonly": true }, { "key": "member_count", "name": "Pictures", "type": "number", "readonly": true, "units": { "one": "picture", "other": "pictures" } } ], "instructions": "An album groups photos and videos from one trip or event, between two local days. Albums are usually suggested: open until the owner keeps or dismisses one, and renaming a suggestion keeps it.", "tables": [ { "name": "cotton_media_albums", "columns": [ { "name": "id", "type": "TEXT", "default": null, "nullable": true, "primary_key": true, "declaration": "\n id TEXT PRIMARY KEY", "position": 0 }, { "name": "workspace_id", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n workspace_id TEXT NOT NULL", "position": 1 }, { "name": "kind", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n kind TEXT NOT NULL", "position": 2 }, { "name": "state", "type": "TEXT", "default": "'open'", "nullable": false, "primary_key": false, "declaration": "\n state TEXT NOT NULL DEFAULT 'open'", "position": 3 }, { "name": "decided_at", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n decided_at TEXT", "position": 4 }, { "name": "title", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n title TEXT NOT NULL", "position": 5 }, { "name": "title_by", "type": "TEXT", "default": "'derived'", "nullable": false, "primary_key": false, "declaration": "\n title_by TEXT NOT NULL DEFAULT 'derived'", "position": 6 }, { "name": "starts_at", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n starts_at TEXT NOT NULL", "position": 7 }, { "name": "ends_at", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n ends_at TEXT NOT NULL", "position": 8 }, { "name": "home_label", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n home_label TEXT", "position": 9 }, { "name": "cover_id", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n cover_id TEXT", "position": 10 }, { "name": "created_at", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n created_at TEXT NOT NULL", "position": 11 }, { "name": "updated_at", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n updated_at TEXT NOT NULL", "position": 12 }, { "name": "_hlc", "type": "TEXT", "default": "''", "nullable": false, "primary_key": false, "declaration": "\n _hlc TEXT NOT NULL DEFAULT ''", "position": 13 }, { "name": "origin_handle", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": " origin_handle TEXT CHECK (origin_handle IS NULL OR length(origin_handle) > 0)", "position": 14 }, { "name": "_born", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n _born TEXT", "position": 15 }, { "name": "trashed_at", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": " trashed_at TEXT", "position": 16 } ], "constraints": [ { "declaration": "\n CHECK (kind IN ('trip', 'event'))", "position": 17 }, { "declaration": "\n CHECK (state IN ('open', 'kept', 'dismissed'))", "position": 18 }, { "declaration": "\n CHECK ((state = 'open') = (decided_at IS NULL))", "position": 19 }, { "declaration": "\n CHECK (title_by IN ('derived', 'user'))", "position": 20 }, { "declaration": "\n CHECK (starts_at <= ends_at)", "position": 21 }, { "declaration": "\n FOREIGN KEY (workspace_id) REFERENCES cotton_workspaces(id) ON DELETE CASCADE\n ", "position": 22 } ], "prefix": "CREATE TABLE cotton_media_albums (", "suffix": ")", "indexes": [ "CREATE INDEX idx_cotton_media_albums_open ON cotton_media_albums (workspace_id, starts_at DESC) WHERE state = 'open'", "CREATE INDEX idx_cotton_media_albums_time ON cotton_media_albums (workspace_id, starts_at DESC)", "CREATE INDEX idx_cotton_media_albums_origin ON cotton_media_albums (origin_handle) WHERE origin_handle IS NOT NULL", "CREATE INDEX IF NOT EXISTS idx_cotton_media_albums_author ON cotton_media_albums (substr(_hlc, 20), _hlc)" ], "full_text": [], "triggers": [] } ], "picture": null, "engine": "media", "project": null, "order": null, "slip": { "title": "title", "subtitle": "starts_at", "trailing": "member_count", "photo": "cover_key", "toggle": null, "byline": { "column": "state", "words": { "open": "suggested" }, "ink": "red" }, "answers": { "column": "state", "values": { "kept": "Keep", "dismissed": "Not this" }, "when": [ "open" ], "leaves": false } }, "tile": { "face": "polaroid-grid" }, "page": [ { "heading": null, "columns": [ "cover_key", "title" ], "hand": [ "starts_at", "member_count", "Away from {home_label}" ] }, { "heading": null, "when": { "column": "state", "values": [ "open" ] }, "note": "Cotton put these together — keep the album?", "answers": { "column": "state", "values": { "kept": "Keep", "dismissed": "Not this" }, "when": [ "open" ] } }, { "heading": null, "when": { "column": "state", "values": [ "dismissed" ] }, "note": "You said not this one.", "ink": "red", "answers": { "column": "state", "values": { "open": "Bring it back" }, "when": [ "dismissed" ] } }, { "heading": "Pictures", "list": { "table": "album_item", "link": "album_id", "empty": { "title": "No pictures in this album", "message": "Add some from your photos with the + circle." }, "columns": 3, "add": "Add photos" } }, { "heading": "Details", "columns": [ "kind", "state", "decided_at" ] } ], "add": false, "record_route": "/photos/album/[id]", "group": { "column": "state", "sections": [ { "heading": null, "values": [ "open" ] }, { "heading": null, "values": [ "kept" ] } ] }, "layout": "cards", "grid": { "columns": 2 }, "empty": { "title": "No albums yet", "message": "Cotton looks through your pictures each night and suggests a trip or an evening when it finds one." }, "delete": false, "polaroid": { "caption": "member_count", "title": "title", "subtitle": "starts_at" }, "hidden": { "column": "state", "values": [ "dismissed" ] }, "parts": { "shape": "sheet", "head": { "facts": [] }, "links": [], "lists": [ { "table": "album_item", "relation": "album_id", "heading": "Pictures", "face": "photos" } ], "acts": { "more": [] }, "cards": [ { "column": "starts_at", "until": "ends_at" }, { "column": "member_count" }, { "column": "state" } ], "opens": "facts" }, "card": { "face": "album.board", "fields": [ { "slot": "photo", "column": "cover_key" }, { "slot": "title", "column": "title" }, { "slot": "count", "column": "member_count" }, { "slot": "span", "column": "starts_at", "also": [ "ends_at" ] }, { "slot": "subtitle", "column": "home_label" } ], "offers": [ "album.board", "album" ] } }