{
    "tailapp": 2,
    "manifest": {
        "format": 2,
        "app_id": "expenses",
        "name": "Expenses",
        "version": 1,
        "schema": "tailapps/v0",
        "exported_at": 1795564592,
        "from": "gallery",
        "connections": [],
        "files": {
            "app.json": "d88ecbb4b905db00eaf1e09ee236b0ae445e5deeb0b89ebecb5158310cfe7465"
        },
        "signature": "Un4hZK9fIxVeIM+YPrPGzdJIb1wY/a2KLMNyEYXsACUKkGsyrW7C9fPJViRz/Nj2zG5APkOegIkV5ULFUex/Dg==",
        "key_id": "gallery-1"
    },
    "app": {
        "schema": "tailapps/v0",
        "app": "expenses",
        "name": "Expenses",
        "description": "Jot down what you spend and see the total, what's still to pay, the five biggest and a split by category. On the Mac and iPhone.",
        "icon": "creditcard",
        "version": 1,
        "permissions": [],
        "state": {
            "expenses": {
                "type": "list",
                "default": [
                    {
                        "id": "1",
                        "title": "Train to Leeds",
                        "amount": 64.5,
                        "category": "Travel",
                        "paid": true
                    },
                    {
                        "id": "2",
                        "title": "Team lunch",
                        "amount": 92,
                        "category": "Food",
                        "paid": true
                    },
                    {
                        "id": "3",
                        "title": "Hotel",
                        "amount": 189,
                        "category": "Travel",
                        "paid": false
                    },
                    {
                        "id": "4",
                        "title": "Coffee",
                        "amount": 3.4,
                        "category": "Food",
                        "paid": true
                    },
                    {
                        "id": "5",
                        "title": "Conference ticket",
                        "amount": 249,
                        "category": "Work",
                        "paid": false
                    },
                    {
                        "id": "6",
                        "title": "Taxi",
                        "amount": 18.2,
                        "category": "Travel",
                        "paid": true
                    }
                ]
            },
            "draft": {
                "type": "text",
                "default": ""
            },
            "next_id": {
                "type": "number",
                "default": 7
            },
            "amount": {
                "type": "number",
                "default": 0
            },
            "category": {
                "type": "text",
                "default": "Food"
            }
        },
        "actions": {
            "add": {
                "steps": [
                    {
                        "if": "$draft",
                        "then": [
                            {
                                "push": {
                                    "expenses": {
                                        "id": "e{$next_id}",
                                        "title": "$draft",
                                        "amount": "$amount",
                                        "category": "$category",
                                        "paid": false
                                    }
                                }
                            },
                            {
                                "set": {
                                    "draft": "",
                                    "amount": 0
                                }
                            },
                            {
                                "increment": {
                                    "next_id": 1
                                }
                            }
                        ]
                    }
                ]
            },
            "toggle_paid": {
                "args": {
                    "id": "text"
                },
                "steps": [
                    {
                        "update": {
                            "expenses": {
                                "match": {
                                    "id": "$args.id"
                                },
                                "set": {
                                    "paid": "$args.value"
                                }
                            }
                        }
                    }
                ]
            },
            "remove_expense": {
                "args": {
                    "id": "text"
                },
                "steps": [
                    {
                        "remove": {
                            "expenses": {
                                "match": {
                                    "id": "$args.id"
                                }
                            }
                        }
                    }
                ]
            }
        },
        "cards": [
            {
                "id": "main",
                "layout": {
                    "column": [
                        {
                            "row": [
                                {
                                    "stat": "$expenses | sum:'amount' | currency:'GBP':'full'",
                                    "label": "Total"
                                },
                                {
                                    "spacer": true
                                },
                                {
                                    "stat": "$expenses | where:{paid:false} | sum:'amount' | currency:'GBP':'full'",
                                    "label": "To pay",
                                    "tone": "warn"
                                },
                                {
                                    "spacer": true
                                },
                                {
                                    "stat": "$expenses | avg:'amount' | currency:'GBP' | default:'\u2014'",
                                    "label": "Average"
                                }
                            ],
                            "align": "start"
                        },
                        {
                            "text": "Categories: {$expenses | pluck:'category' | unique | sort | join:' \u00b7 '}",
                            "size": "s",
                            "emphasis": "subtle",
                            "when": "$expenses"
                        },
                        {
                            "row": [
                                {
                                    "field": "",
                                    "type": "text",
                                    "bind": "$draft",
                                    "placeholder": "What for?",
                                    "on_submit": "add"
                                },
                                {
                                    "field": "",
                                    "type": "number",
                                    "bind": "$amount",
                                    "placeholder": "\u00a3"
                                },
                                {
                                    "field": "",
                                    "type": "select",
                                    "bind": "$category",
                                    "options": [
                                        "Food",
                                        "Travel",
                                        "Work",
                                        "Home"
                                    ]
                                }
                            ]
                        },
                        {
                            "column": [
                                {
                                    "text": "Biggest five",
                                    "size": "s",
                                    "emphasis": "subtle"
                                },
                                {
                                    "list": "$expenses | sort:'-amount' | limit:5",
                                    "empty": "Nothing yet. Add one above.",
                                    "item": {
                                        "cell": "$item.title",
                                        "subtitle": "{$item.category} \u00b7 {$item.amount | currency:'GBP':'full'}",
                                        "check": "$item.paid",
                                        "on_check": "toggle_paid",
                                        "args": {
                                            "id": "$item.id"
                                        },
                                        "trailing": {
                                            "menu": "More for {$item.title}",
                                            "icon": "ellipsis",
                                            "icon_only": true,
                                            "items": [
                                                {
                                                    "label": "Delete",
                                                    "on": "remove_expense",
                                                    "args": {
                                                        "id": "$item.id"
                                                    },
                                                    "style": "destructive"
                                                }
                                            ]
                                        }
                                    }
                                }
                            ],
                            "style": "inset"
                        }
                    ],
                    "gap": "m"
                },
                "footer": {
                    "row": [
                        {
                            "text": "{$expenses | count} expenses, largest {$expenses | max:'amount' | currency:'GBP'}",
                            "size": "s",
                            "emphasis": "subtle",
                            "when": "$expenses"
                        }
                    ]
                }
            }
        ],
        "views": {
            "menubar": {
                "icon": "creditcard",
                "label": "{$expenses | where:{paid:false} | sum:'amount' | currency:'GBP'} to pay",
                "in_menu": "card"
            },
            "floating": {
                "card": "main",
                "width": "default"
            }
        }
    },
    "app_json": "{\n  \"schema\": \"tailapps/v0\",\n  \"app\": \"expenses\",\n  \"name\": \"Expenses\",\n  \"description\": \"Jot down what you spend and see the total, what's still to pay, the five biggest and a split by category. On the Mac and iPhone.\",\n  \"icon\": \"creditcard\",\n  \"version\": 1,\n  \"permissions\": [],\n  \"state\": {\n    \"expenses\": {\n      \"type\": \"list\",\n      \"default\": [\n        { \"id\": \"1\", \"title\": \"Train to Leeds\", \"amount\": 64.5, \"category\": \"Travel\", \"paid\": true },\n        { \"id\": \"2\", \"title\": \"Team lunch\", \"amount\": 92, \"category\": \"Food\", \"paid\": true },\n        { \"id\": \"3\", \"title\": \"Hotel\", \"amount\": 189, \"category\": \"Travel\", \"paid\": false },\n        { \"id\": \"4\", \"title\": \"Coffee\", \"amount\": 3.4, \"category\": \"Food\", \"paid\": true },\n        { \"id\": \"5\", \"title\": \"Conference ticket\", \"amount\": 249, \"category\": \"Work\", \"paid\": false },\n        { \"id\": \"6\", \"title\": \"Taxi\", \"amount\": 18.2, \"category\": \"Travel\", \"paid\": true }\n      ]\n    },\n    \"draft\": { \"type\": \"text\", \"default\": \"\" },\n    \"next_id\": { \"type\": \"number\", \"default\": 7 },\n    \"amount\": { \"type\": \"number\", \"default\": 0 },\n    \"category\": { \"type\": \"text\", \"default\": \"Food\" }\n  },\n  \"actions\": {\n    \"add\": {\n      \"steps\": [\n        {\n          \"if\": \"$draft\",\n          \"then\": [\n            {\n              \"push\": {\n                \"expenses\": { \"id\": \"e{$next_id}\", \"title\": \"$draft\", \"amount\": \"$amount\", \"category\": \"$category\", \"paid\": false }\n              }\n            },\n            { \"set\": { \"draft\": \"\", \"amount\": 0 } },\n            { \"increment\": { \"next_id\": 1 } }\n          ]\n        }\n      ]\n    },\n    \"toggle_paid\": {\n      \"args\": { \"id\": \"text\" },\n      \"steps\": [\n        { \"update\": { \"expenses\": { \"match\": { \"id\": \"$args.id\" }, \"set\": { \"paid\": \"$args.value\" } } } }\n      ]\n    },\n    \"remove_expense\": {\n      \"args\": { \"id\": \"text\" },\n      \"steps\": [\n        { \"remove\": { \"expenses\": { \"match\": { \"id\": \"$args.id\" } } } }\n      ]\n    }\n  },\n  \"cards\": [\n    {\n      \"id\": \"main\",\n      \"layout\": {\n        \"column\": [\n          {\n            \"row\": [\n              { \"stat\": \"$expenses | sum:'amount' | currency:'GBP':'full'\", \"label\": \"Total\" },\n              { \"spacer\": true },\n              { \"stat\": \"$expenses | where:{paid:false} | sum:'amount' | currency:'GBP':'full'\", \"label\": \"To pay\", \"tone\": \"warn\" },\n              { \"spacer\": true },\n              { \"stat\": \"$expenses | avg:'amount' | currency:'GBP' | default:'\u2014'\", \"label\": \"Average\" }\n            ],\n            \"align\": \"start\"\n          },\n          {\n            \"text\": \"Categories: {$expenses | pluck:'category' | unique | sort | join:' \u00b7 '}\",\n            \"size\": \"s\",\n            \"emphasis\": \"subtle\",\n            \"when\": \"$expenses\"\n          },\n          {\n            \"row\": [\n              { \"field\": \"\", \"type\": \"text\", \"bind\": \"$draft\", \"placeholder\": \"What for?\", \"on_submit\": \"add\" },\n              { \"field\": \"\", \"type\": \"number\", \"bind\": \"$amount\", \"placeholder\": \"\u00a3\" },\n              { \"field\": \"\", \"type\": \"select\", \"bind\": \"$category\", \"options\": [\"Food\", \"Travel\", \"Work\", \"Home\"] }\n            ]\n          },\n          {\n            \"column\": [\n              { \"text\": \"Biggest five\", \"size\": \"s\", \"emphasis\": \"subtle\" },\n              {\n                \"list\": \"$expenses | sort:'-amount' | limit:5\",\n                \"empty\": \"Nothing yet. Add one above.\",\n                \"item\": {\n                  \"cell\": \"$item.title\",\n                  \"subtitle\": \"{$item.category} \u00b7 {$item.amount | currency:'GBP':'full'}\",\n                  \"check\": \"$item.paid\",\n                  \"on_check\": \"toggle_paid\",\n                  \"args\": { \"id\": \"$item.id\" },\n                  \"trailing\": {\n                    \"menu\": \"More for {$item.title}\",\n                    \"icon\": \"ellipsis\",\n                    \"icon_only\": true,\n                    \"items\": [\n                      { \"label\": \"Delete\", \"on\": \"remove_expense\", \"args\": { \"id\": \"$item.id\" }, \"style\": \"destructive\" }\n                    ]\n                  }\n                }\n              }\n            ],\n            \"style\": \"inset\"\n          }\n        ],\n        \"gap\": \"m\"\n      },\n      \"footer\": {\n        \"row\": [\n          { \"text\": \"{$expenses | count} expenses, largest {$expenses | max:'amount' | currency:'GBP'}\", \"size\": \"s\", \"emphasis\": \"subtle\", \"when\": \"$expenses\" }\n        ]\n      }\n    }\n  ],\n  \"views\": {\n    \"menubar\": {\n      \"icon\": \"creditcard\",\n      \"label\": \"{$expenses | where:{paid:false} | sum:'amount' | currency:'GBP'} to pay\",\n      \"in_menu\": \"card\"\n    },\n    \"floating\": { \"card\": \"main\", \"width\": \"default\" }\n  }\n}\n",
    "files": []
}