SPB Git

Repository Public License

blueprint.json 7.2 KB 95 lines json

1{2  "schemaVersion": 1,3  "id": "app_expense_tracker",4  "name": "Expense Tracker",5  "summary": "Track spending locally: import bank CSVs, filter by category, edit records and see monthly totals.",6  "version": 1,7  "entrypoint": "home",8  "permissions": ["storage.local", "files.import.userSelected", "files.export.userSelected"],9  "state": {"category": "All", "search": "", "selectedId": null, "showEditor": false},10  "objects": [11    {"id": "transactions", "type": "prism.data.table", "schemaVersion": 1, "version": 1, "name": "Transactions",12     "props": {"columns": [13       {"name": "date", "type": "date", "label": "Date", "required": true},14       {"name": "description", "type": "text", "label": "Description", "required": true},15       {"name": "category", "type": "text", "label": "Category", "default": "Other",16        "options": ["Food", "Housing", "Transport", "Fun", "Health", "Other"]},17       {"name": "amount", "type": "currency", "label": "Amount", "required": true}18     ]}},19    {"id": "q_total", "type": "prism.data.query", "schemaVersion": 1, "version": 1, "name": "Total of the filtered transactions",20     "dependencies": ["transactions"],21     "props": {"query": {"table": "transactions",22       "filters": [{"column": "category", "op": "eq", "value": {"$bind": "category"}, "unless": {"$expr": "state.category == 'All'"}}],23       "search": {"columns": ["description", "category"], "text": {"$bind": "search"}},24       "aggregates": [{"fn": "sum", "column": "amount", "as": "total"}, {"fn": "count", "as": "n"}]}}},25    {"id": "q_this_month", "type": "prism.data.query", "schemaVersion": 1, "version": 1, "name": "Spending this month",26     "dependencies": ["transactions"],27     "props": {"query": {"table": "transactions",28       "filters": [{"column": "date", "op": "startsWith", "value": {"$expr": "month(today())"}}],29       "aggregates": [{"fn": "sum", "column": "amount", "as": "total"}]}}},3031    {"id": "home", "type": "prism.page", "schemaVersion": 1, "version": 1, "name": "Transactions", "children": ["root"]},32    {"id": "root", "type": "prism.stack", "schemaVersion": 1, "version": 1, "name": "Page layout",33     "props": {"align": "stretch", "spacing": 14, "grow": true},34     "children": ["bar", "stats", "main", "editor_sheet"]},3536    {"id": "bar", "type": "prism.toolbar", "schemaVersion": 1, "version": 1, "name": "Toolbar",37     "children": ["search", "category_filter", "edit_button", "add_button", "import_button", "export_button"]},38    {"id": "search", "type": "prism.search", "schemaVersion": 1, "version": 1, "name": "Search",39     "props": {"placeholder": "Search transactions", "value": {"$bind": "search"}, "grow": true}},40    {"id": "category_filter", "type": "prism.dropdown", "schemaVersion": 1, "version": 1, "name": "Category filter",41     "props": {"value": {"$bind": "category"}, "optionsFrom": {"table": "transactions", "column": "category"},42               "includeAll": "All", "accessibilityLabel": "Category filter"}},43    {"id": "edit_button", "type": "prism.button", "schemaVersion": 1, "version": 1, "name": "Edit",44     "props": {"title": "Edit", "icon": "pencil", "disabled": {"$expr": "state.selectedId == null"}},45     "events": {"click": [{"type": "setState", "key": "showEditor", "value": true}]}},46    {"id": "add_button", "type": "prism.button", "schemaVersion": 1, "version": 1, "name": "Add",47     "props": {"title": "Add", "icon": "plus", "style": "primary"},48     "events": {"click": [{"type": "setState", "key": "selectedId", "value": null},49                          {"type": "setState", "key": "showEditor", "value": true}]}},50    {"id": "import_button", "type": "prism.csvImport", "schemaVersion": 1, "version": 1, "name": "Import CSV",51     "props": {"table": "transactions", "title": "Import CSV…"}},52    {"id": "export_button", "type": "prism.csvExport", "schemaVersion": 1, "version": 1, "name": "Export CSV",53     "props": {"title": "Export…", "filename": "transactions.csv",54               "query": {"table": "transactions", "sort": [{"column": "date", "descending": true}]}}},5556    {"id": "stats", "type": "prism.grid", "schemaVersion": 1, "version": 1, "name": "Statistics",57     "props": {"columns": 3}, "children": ["stat_total", "stat_count", "stat_month"]},58    {"id": "stat_total", "type": "prism.aggregation", "schemaVersion": 1, "version": 1, "name": "Total shown",59     "props": {"label": "Total shown", "format": "currency", "icon": "sum", "query": {"$ref": "q_total"}, "valueColumn": "total"}},60    {"id": "stat_count", "type": "prism.aggregation", "schemaVersion": 1, "version": 1, "name": "Transactions shown",61     "props": {"label": "Transactions shown", "format": "number", "icon": "list.number", "query": {"$ref": "q_total"}, "valueColumn": "n"}},62    {"id": "stat_month", "type": "prism.aggregation", "schemaVersion": 1, "version": 1, "name": "This month",63     "props": {"label": "This month", "format": "currency", "icon": "calendar", "query": {"$ref": "q_this_month"}, "valueColumn": "total"}},6465    {"id": "main", "type": "prism.split", "schemaVersion": 1, "version": 1, "name": "Table and chart",66     "props": {"grow": true}, "children": ["transactions_table", "monthly_chart"]},67    {"id": "transactions_table", "type": "prism.table", "schemaVersion": 1, "version": 1, "name": "Transactions table",68     "dependencies": ["transactions"],69     "props": {70       "query": {"table": "transactions",71         "filters": [{"column": "category", "op": "eq", "value": {"$bind": "category"}, "unless": {"$expr": "state.category == 'All'"}}],72         "search": {"columns": ["description", "category"], "text": {"$bind": "search"}},73         "sort": [{"column": "date", "descending": true}]},74       "columns": [{"column": "date", "format": "date", "width": 110}, {"column": "description"},75                   {"column": "category", "format": "badge", "width": 110}, {"column": "amount", "format": "currency", "align": "trailing", "width": 110}],76       "selection": {"$bind": "selectedId"},77       "emptyTitle": "No transactions", "emptyMessage": "Import a CSV file or add one by hand."}},78    {"id": "monthly_chart", "type": "prism.chart.bar", "schemaVersion": 1, "version": 1, "name": "Monthly chart",79     "dependencies": ["transactions"],80     "props": {"title": "Spending per month", "x": "month", "y": "total", "format": "currency",81       "query": {"table": "transactions", "groupBy": {"column": "date", "bucket": "month", "as": "month"},82                 "aggregates": [{"fn": "sum", "column": "amount", "as": "total"}]}}},8384    {"id": "editor_sheet", "type": "prism.modal", "schemaVersion": 1, "version": 1, "name": "Editor sheet",85     "props": {"title": {"$expr": "state.selectedId == null ? 'New transaction' : 'Edit transaction'"}, "presented": {"$bind": "showEditor"}},86     "children": ["editor"]},87    {"id": "editor", "type": "prism.recordEditor", "schemaVersion": 1, "version": 1, "name": "Transaction editor",88     "dependencies": ["transactions"],89     "props": {"table": "transactions", "recordId": {"$bind": "selectedId"}},90     "events": {"saved": [{"type": "setState", "key": "showEditor", "value": false}],91                "deleted": [{"type": "setState", "key": "showEditor", "value": false}],92                "cancelled": [{"type": "setState", "key": "showEditor", "value": false}]}}93  ]94}95
Files main
Menu

Theme