SPB Git

Repository Public License

evolve-budget.blueprint.json 13.5 KB 631 lines json

1{2  "entrypoint": "home",3  "id": "app_expense_tracker",4  "name": "Expense Tracker",5  "objects": [6    {7      "id": "transactions",8      "name": "Transactions",9      "props": {10        "columns": [11          {12            "label": "Date",13            "name": "date",14            "required": true,15            "type": "date"16          },17          {18            "label": "Description",19            "name": "description",20            "required": true,21            "type": "text"22          },23          {24            "default": "Other",25            "label": "Category",26            "name": "category",27            "options": [28              "Food",29              "Housing",30              "Transport",31              "Fun",32              "Health",33              "Other"34            ],35            "type": "text"36          },37          {38            "label": "Amount",39            "name": "amount",40            "required": true,41            "type": "currency"42          }43        ]44      },45      "schemaVersion": 1,46      "type": "prism.data.table",47      "version": 148    },49    {50      "dependencies": [51        "transactions"52      ],53      "id": "q_total",54      "name": "Total of the filtered transactions",55      "props": {56        "query": {57          "aggregates": [58            {59              "as": "total",60              "column": "amount",61              "fn": "sum"62            },63            {64              "as": "n",65              "fn": "count"66            }67          ],68          "filters": [69            {70              "column": "category",71              "op": "eq",72              "unless": {73                "$expr": "state.category == 'All'"74              },75              "value": {76                "$bind": "category"77              }78            }79          ],80          "search": {81            "columns": [82              "description",83              "category"84            ],85            "text": {86              "$bind": "search"87            }88          },89          "table": "transactions"90        }91      },92      "schemaVersion": 1,93      "type": "prism.data.query",94      "version": 195    },96    {97      "dependencies": [98        "transactions"99      ],100      "id": "q_this_month",101      "name": "Spending this month",102      "props": {103        "query": {104          "aggregates": [105            {106              "as": "total",107              "column": "amount",108              "fn": "sum"109            }110          ],111          "filters": [112            {113              "column": "date",114              "op": "startsWith",115              "value": {116                "$expr": "month(today())"117              }118            }119          ],120          "table": "transactions"121        }122      },123      "schemaVersion": 1,124      "type": "prism.data.query",125      "version": 1126    },127    {128      "children": [129        "root"130      ],131      "id": "home",132      "name": "Transactions",133      "schemaVersion": 1,134      "type": "prism.page",135      "version": 1136    },137    {138      "children": [139        "bar",140        "stats",141        "budget_alert",142        "main",143        "editor_sheet"144      ],145      "id": "root",146      "name": "Page layout",147      "props": {148        "align": "stretch",149        "grow": true,150        "spacing": 14151      },152      "schemaVersion": 1,153      "type": "prism.stack",154      "version": 1155    },156    {157      "children": [158        "search",159        "category_filter",160        "edit_button",161        "add_button",162        "budget_field",163        "import_button",164        "export_button"165      ],166      "id": "bar",167      "name": "Toolbar",168      "schemaVersion": 1,169      "type": "prism.toolbar",170      "version": 1171    },172    {173      "id": "search",174      "name": "Search",175      "props": {176        "grow": true,177        "placeholder": "Search transactions",178        "value": {179          "$bind": "search"180        }181      },182      "schemaVersion": 1,183      "type": "prism.search",184      "version": 1185    },186    {187      "id": "category_filter",188      "name": "Category filter",189      "props": {190        "accessibilityLabel": "Category filter",191        "includeAll": "All",192        "optionsFrom": {193          "column": "category",194          "table": "transactions"195        },196        "value": {197          "$bind": "category"198        }199      },200      "schemaVersion": 1,201      "type": "prism.dropdown",202      "version": 1203    },204    {205      "events": {206        "click": [207          {208            "key": "showEditor",209            "type": "setState",210            "value": true211          }212        ]213      },214      "id": "edit_button",215      "name": "Edit",216      "props": {217        "disabled": {218          "$expr": "state.selectedId == null"219        },220        "icon": "pencil",221        "title": "Edit"222      },223      "schemaVersion": 1,224      "type": "prism.button",225      "version": 1226    },227    {228      "events": {229        "click": [230          {231            "key": "selectedId",232            "type": "setState",233            "value": null234          },235          {236            "key": "showEditor",237            "type": "setState",238            "value": true239          }240        ]241      },242      "id": "add_button",243      "name": "Add",244      "props": {245        "icon": "plus",246        "style": "primary",247        "title": "Add"248      },249      "schemaVersion": 1,250      "type": "prism.button",251      "version": 1252    },253    {254      "id": "import_button",255      "name": "Import CSV",256      "props": {257        "table": "transactions",258        "title": "Import CSV…"259      },260      "schemaVersion": 1,261      "type": "prism.csvImport",262      "version": 1263    },264    {265      "id": "export_button",266      "name": "Export CSV",267      "props": {268        "filename": "transactions.csv",269        "query": {270          "sort": [271            {272              "column": "date",273              "descending": true274            }275          ],276          "table": "transactions"277        },278        "title": "Export…"279      },280      "schemaVersion": 1,281      "type": "prism.csvExport",282      "version": 1283    },284    {285      "children": [286        "stat_total",287        "stat_count",288        "stat_month"289      ],290      "id": "stats",291      "name": "Statistics",292      "props": {293        "columns": 3294      },295      "schemaVersion": 1,296      "type": "prism.grid",297      "version": 1298    },299    {300      "id": "stat_total",301      "name": "Total shown",302      "props": {303        "format": "currency",304        "icon": "sum",305        "label": "Total shown",306        "query": {307          "$ref": "q_total"308        },309        "valueColumn": "total"310      },311      "schemaVersion": 1,312      "type": "prism.aggregation",313      "version": 1314    },315    {316      "id": "stat_count",317      "name": "Transactions shown",318      "props": {319        "format": "number",320        "icon": "list.number",321        "label": "Transactions shown",322        "query": {323          "$ref": "q_total"324        },325        "valueColumn": "n"326      },327      "schemaVersion": 1,328      "type": "prism.aggregation",329      "version": 1330    },331    {332      "id": "stat_month",333      "name": "This month",334      "props": {335        "format": "currency",336        "icon": "calendar",337        "label": "This month",338        "query": {339          "$ref": "q_this_month"340        },341        "valueColumn": "total"342      },343      "schemaVersion": 1,344      "type": "prism.aggregation",345      "version": 1346    },347    {348      "children": [349        "transactions_table",350        "charts"351      ],352      "id": "main",353      "name": "Table and chart",354      "props": {355        "grow": true356      },357      "schemaVersion": 1,358      "type": "prism.split",359      "version": 1360    },361    {362      "dependencies": [363        "transactions"364      ],365      "id": "transactions_table",366      "name": "Transactions table",367      "props": {368        "columns": [369          {370            "column": "date",371            "format": "date",372            "width": 110373          },374          {375            "column": "description"376          },377          {378            "column": "category",379            "format": "badge",380            "width": 110381          },382          {383            "align": "trailing",384            "column": "amount",385            "format": "currency",386            "width": 110387          }388        ],389        "emptyMessage": "Import a CSV file or add one by hand.",390        "emptyTitle": "No transactions",391        "query": {392          "filters": [393            {394              "column": "category",395              "op": "eq",396              "unless": {397                "$expr": "state.category == 'All'"398              },399              "value": {400                "$bind": "category"401              }402            }403          ],404          "search": {405            "columns": [406              "description",407              "category"408            ],409            "text": {410              "$bind": "search"411            }412          },413          "sort": [414            {415              "column": "date",416              "descending": true417            }418          ],419          "table": "transactions"420        },421        "selection": {422          "$bind": "selectedId"423        }424      },425      "schemaVersion": 1,426      "type": "prism.table",427      "version": 1428    },429    {430      "dependencies": [431        "transactions"432      ],433      "id": "monthly_chart",434      "name": "Monthly chart",435      "props": {436        "format": "currency",437        "query": {438          "aggregates": [439            {440              "as": "total",441              "column": "amount",442              "fn": "sum"443            }444          ],445          "groupBy": {446            "as": "month",447            "bucket": "month",448            "column": "date"449          },450          "table": "transactions"451        },452        "title": "Spending per month",453        "x": "month",454        "y": "total"455      },456      "schemaVersion": 1,457      "type": "prism.chart.bar",458      "version": 1459    },460    {461      "children": [462        "editor"463      ],464      "id": "editor_sheet",465      "name": "Editor sheet",466      "props": {467        "presented": {468          "$bind": "showEditor"469        },470        "title": {471          "$expr": "state.selectedId == null ? 'New transaction' : 'Edit transaction'"472        }473      },474      "schemaVersion": 1,475      "type": "prism.modal",476      "version": 1477    },478    {479      "dependencies": [480        "transactions"481      ],482      "events": {483        "cancelled": [484          {485            "key": "showEditor",486            "type": "setState",487            "value": false488          }489        ],490        "deleted": [491          {492            "key": "showEditor",493            "type": "setState",494            "value": false495          }496        ],497        "saved": [498          {499            "key": "showEditor",500            "type": "setState",501            "value": false502          }503        ]504      },505      "id": "editor",506      "name": "Transaction editor",507      "props": {508        "recordId": {509          "$bind": "selectedId"510        },511        "table": "transactions"512      },513      "schemaVersion": 1,514      "type": "prism.recordEditor",515      "version": 1516    },517    {518      "id": "budget_field",519      "name": "Monthly budget",520      "props": {521        "label": "Monthly budget",522        "value": {523          "$bind": "budget"524        },525        "width": 160526      },527      "provenance": {528        "source": "agent"529      },530      "schemaVersion": 1,531      "type": "prism.currencyField",532      "version": 1533    },534    {535      "id": "budget_alert",536      "name": "Budget alert",537      "props": {538        "message": {539          "$expr": "concat('Spent ', formatCurrency(coalesce(sum(queries.q_this_month, 'total'), 0)), ' of your ', formatCurrency(state.budget), ' monthly budget — ', formatCurrency(coalesce(sum(queries.q_this_month, 'total'), 0) - state.budget), ' over.')"540        },541        "title": "Over budget this month",542        "tone": "danger",543        "visible": {544          "$expr": "state.budget > 0 && coalesce(sum(queries.q_this_month, 'total'), 0) > state.budget"545        }546      },547      "provenance": {548        "source": "agent"549      },550      "schemaVersion": 1,551      "type": "prism.alert",552      "version": 1553    },554    {555      "children": [556        "monthly_chart",557        "category_chart"558      ],559      "id": "charts",560      "name": "Charts",561      "props": {562        "align": "stretch",563        "spacing": 12564      },565      "provenance": {566        "source": "agent"567      },568      "schemaVersion": 1,569      "type": "prism.stack",570      "version": 1571    },572    {573      "dependencies": [574        "transactions"575      ],576      "id": "category_chart",577      "name": "Category chart",578      "props": {579        "format": "currency",580        "label": "category",581        "query": {582          "aggregates": [583            {584              "as": "total",585              "column": "amount",586              "fn": "sum"587            }588          ],589          "filters": [590            {591              "column": "date",592              "op": "startsWith",593              "value": {594                "$expr": "month(today())"595              }596            }597          ],598          "groupBy": {599            "as": "category",600            "bucket": "none",601            "column": "category"602          },603          "table": "transactions"604        },605        "title": "This month by category",606        "value": "total"607      },608      "provenance": {609        "source": "agent"610      },611      "schemaVersion": 1,612      "type": "prism.chart.pie",613      "version": 1614    }615  ],616  "permissions": [617    "storage.local",618    "files.import.userSelected",619    "files.export.userSelected"620  ],621  "schemaVersion": 1,622  "state": {623    "budget": 2000,624    "category": "All",625    "search": "",626    "selectedId": null,627    "showEditor": false628  },629  "summary": "Track spending locally: import bank CSVs, filter by category, edit records and see monthly totals.",630  "version": 1631}
Files main
Menu

Theme