- JavaScript 67%
- Elm 25%
- CSS 8%
- HTML <1%
- Shell <1%
Con-Goer #
Dumb little app for use at conventions
A mobile-first tracker for what you want to buy at a collector convention and what you actually paid.
I built this using Elm because its great, the reason is because I wanted to have a "at a glance" idea of the ballpark for items I wanted to get through conventions could be, I ended up adding more as nice to haves though and I dig it
Sample Data #
The app has some sample data in place to give you an idea of how things look and feel, this data is just populated on your first time using the app, once removed it will not re populate.
If you wipe localStorage it will re-seed but you will also lose your saved conventions
Running it #
./build.sh # debug
./build.sh --optimize # smaller, for the phone
or if you just want to use elm:
elm make src/Main.elm --output=elm.js
You can use elm reactor if you want to hot swap elm components as you make edits/changes to the source, this will live build the elm code and you can just refresh index.html
localStorage may be unreliable on just the file:// path, but you can run a small python getup if elm reactor is not enough.
Deploying it #
This repo is configured for Tangled Sites, which is why the elm.js is comitted to the repo, if you want to self host the app just make sure it runs the build:
./build.sh --optimize
or
elm make src/Main.elm --output=elm.js
However the elm.js comitted should be built for the latest changes so you can probably just ship it as is.
Required files for hosting:
index.html: The primary page served up for the appapp.js: This is our port so we can use localstorage in elm required byindex.htmlelm.js: The bread and butter of the whole thing, also required byindex.htmlstyles.css: for obvious reasons, can be replaced with your own if you like!
.tangled/workflows/build.yml does not deploy anything. It checks two things
on every push, that we pass the elm-format gods watchful eye, and that the
committed elm.js matches what the sources produce.
Why don't you just use the elm.js generated for the diff?
Is what I hear you ask, well that requires write access and a whole lot of keys that are not repo specific sadly, so this wouldn't work out. Once Sites is fleshed out a bit more I can probably achieve this!
Formatting #
Everything under src/ is elm-format clean, and CI fails the build if it is
not.
To fix a file:
elm-format --yes src/
There is also a hook you can use! Remember, cloning does not setup hooks automatically. You'll need to run the following:
git config core.hooksPath .githooks
It skips itself if elm-format is not on your PATH, so it will not get in the
way of a machine that does not have it.
Layout #
| File | What lives there |
|---|---|
src/Data.elm |
The domain: conventions, sections, items, money-free helpers, and the sample data you see on a fresh install |
src/Money.elm |
The only place cents become strings and back |
src/Budget.elm |
Every derived number, not meant for storing |
src/Codec.elm |
JSON encode/decode for the saved half of the model, and the transfer format |
src/Types.elm |
App state Model, Msg, Screen, the log sheet |
src/Main.elm |
Wiring: init, update, the save and clipboard ports, view dispatch |
src/View/*.elm |
One module per screen |
styles.css |
An amalgamation of ideas smashed into a css file, the :root block is the source of truth for every color |
app.js |
The entire JavaScript side: read localStorage at boot, write it on save, and reach the clipboard |
elm.json |
Dependencies. justinmimbs/date is the only one outside elm/* |
.tangled/workflows/ |
CI only. Nothing here affects the app |
.githooks/ |
A pre-commit format check. Opt in with git config core.hooksPath .githooks |
elm.js |
Compiled output, committed because Sites serves it from git. Never edit by hand |
Storage #
This app does not use a database or send data anywhere, it simply uses your browsers localStorage to keep track of the conventions and data within them
This also means that if localstorage is cleared the data is also cleared and you will be back at the starting point of the app.
Moving data between devices #
I built out this feature because personally, I like to plan on my desktop with a bigger screen, then benefit from that planning on my phone with quick access.
Planning a convention is a big-screen job and walking the floor is a phone job, so there is a way to carry a page from one to the other. There is still no server involved: you move the data yourself.
On the shelf, the new ↗ icon on any convention sends just that one convention
But if you want to move all of them, you can click the Move data between devices at the bottom sends the whole shelf
Each opens a panel offering two ways to move data:
- Save a file / Open a file. You get a
con-goer-<name>.jsonfile you can send wherever, however - Copy and paste. The panel shows the same JSON in a box with a Copy to clipboard button, send it off ezpz!
- This panel also has the ability for you to import a file or paste the json directly to bring data into it
Importing always appends. Bringing in a file adds its pages next to what you already have and overwrites nothing. So if you import the same file twice you will get it twice
This is because convention Ids are just Ints within Elm, so you can have two different conventions with the same ID based on how out of sync the data is, the codec itself will handle fixing the id on imported conventions you don't have to do anything else other than give it the data.
One important note: The file carries a version, and an import from a newer con-goer is refused by
name rather than failing somewhere deep in a field list.
Some Hardset Design Disciplines and Rules Within the App #
- Money is
Intcents everywhere. Never aFloat.Money.parseandMoney.formatare the only conversions.Intscan be exact - Derived values are never stored.
spent,projectedandmustFindShortfallare recomputed from the items on every render. We can afford the recomputation because a convention item list is usually a few dozen items at most ItemStatusis a union on purpose.Hunting,Acquired, andPassed, having these state means the compiler makes every new screen decide what all three look like.- Dates are
Datevalues, not strings. ISO strings exist on disk and at three parse boundaries: thetodayflag, the JSON decoder, and the date editor. Nowhere else. Inside the app a date is always a real date. - A port never claims a browser capability worked. The clipboard write reports back through a second port and the panel says what happened.
- Saving is automatic.
Main.updatediffs the saved half of the model before and after every message and fires thesaveport if it moved. You cannot add a feature that changes an item and forgets to persist it. - Unreadable saved data is never overwritten on load. It shows a banner and starts empty, leaving whatever is in localStorage alone. Silently starting fresh looks exactly like losing a weekend of logged purchases.
- Importing appends, never merges. Two devices hand out convention ids from their own counters, so there is no honest way to tell a copy of a page you already have from a different weekend that landed on the same number. Removing duped data is easier than losing all your data
- One price field decides status. In the log sheet, a parseable price means
Acquired, while blank meansHunting. Nothing else in the sheet decides it. - The log sheet reorders itself. Tapping an item you already listed is logging, so "what you actually paid" is the first field and the plan drops to a labelled group at the foot. Tapping an empty pocket is planning, so the estimate leads instead.
How a pocket reads #
Four states, and the color of the strip along the top is the whole shabang:
| State | Top edge | Looks like |
|---|---|---|
| Acquired | foil | the real card. white, glossy, raised, very slightly tilted |
| Hunting | amber | a paper proxy slip. matte, flat, dashed, square to the sleeve |
| Passed | grey | the same slip, ghosted, name struck through |
| Empty | none | bare vinyl and a + |
Color rules #
There are some loose color rules around the color pallette, these are just their reasonings why I did it this way. You can obviously change these however you please.
- Foil teal is ACQUIRED and nothing else.
- White means a physical object: cards, the divider you have flipped to, the booth verdict
- Amber is action or something in motion: estimates, projections, the still-to-buy bar
- Alert red is over budget, over estimate, or must-find priority
- Grey for items that don't fall under a must find, or hunting, more of a if you see it type of deal
Typeface Quirks #
Bricolage Grotesque is the base font, I used Silkscreen for the pixel font,
Two things about Silkscreen:
- It ships 400 and 700 and nothing between
- It is drawn wide and has no true lowercase the lowercase glyphs are small capitals
The vertical budget #
I wanted to stick to a fairly strict budget for space, this is supposed to be for your phone afterall.
I wanted the "pockets" of your binder to be visible right away, as well as other important information aspects across the design
The idea and rules behind it are simple:
I want to enjoy this convention I am at, and the app is quick and easy to use as I need to.
Entering information is easy, quick, and requires as little interaction as possible.
So taking it in at a glance is important, and a verticle budget played an important role here.
The very simple rule of "Always measure never guess" applied pretty heavily here
Interactions that aren't obvious #
- Tap the thing to change it. Convention name, date, venue and budget are all inline editors. There is no settings screen.
- Tap the section tab you are already on to rename it.
+adds a section. - Tap the status chip to cycle upcoming → on the floor → closed.
- Tap an empty sleeve to add an item straight into that section.
- Removing a convention on the shelf is a two-tap confirm.
Maybe Future Ideas #
- Editing a convention's date is still a raw
yyyy-mm-ddtext field. It is validated now, but a date it cannot parse is rejected silently. The edit just does not take. I'd like to implement a date picker maybe, but I am quickly running out of time - Fonts come from Google Fonts, so the first load needs a network. I'd rather just have them live in the repo if I want them that bad so I don't need to rely on a network call
- No reordering of items or sections yet
- Debating if I want to take my wild CSS ramblings and convert this into BEM architecture or not, do I care enough? Is this big enough that it makes sense? Who knows!