Show newer

...And paste them into the hardcoded JavaScript array. VS Code automatically re-formats for me (if it didn't, that would have been a deal-breaker for this workflow!!).
>>

Show thread

So after previewing on the Vite dev server, I just grab the songs from the JSON for the json-server...
>>

Show thread

...And this is my production mode, where the data is copied over to a hardcoded JS array of songs.

I trialled a version of the app with a search functionality where users search a JSON file of all the songs and load up their own selection. This was the way it was envisaged from the start, with partial first line or partial title search functionality. Part of the use case for the app was because it was impossible to decide whether to index hardcopies on first line or title. And a double-entry cross-referenced system would be the only solution on paper, doubling the bulk of photocopies. But after the trial the choir decided they preferred the songs ready-loaded with no search and add function.
>>

Show thread

This is the dev mode, hitting up an endpoint in the JSON on port 4000...
>>

Show thread

Here's some of the JSX for my Songs component. This is the stateful part of the app where I can switch from my own dev mode to production.
>>

Show thread

With the other songs for the night, the front end of the app should load like this on the dev server:
>>

Show thread

But all being well the json-server will show a successful POST request.
>>

Show thread

Trailing commas after the last item of the songs array must also be removed.
>>

Show thread

PDFs very often copy across with unusual line terminators. JSON is a very fussy format but that's partly what makes it so popular as a "glue" language format between different scripts or parts of a app. It's easy to remove them: they are highlighted in Visual Studio Code.
>>

Show thread

There are fields for Song Title, Words, Usage, Key, Capo, and YouTube embed video link for learning new songs from the web. Mostly it's just Title and Words, but that enables a search on EITHER Title or first line in another version of the app. Handy.
>>

Show thread

Next, fire up the React app, made in Vite, in development mode, also with a json-server loading the songs table JSON. Copy/paste new song into form in the app.
>>

Show thread

Possibly of interest to those developers among you, here is today's workflow for updating a new song in my choir app. End-to-end 20 mins or less. Start by texting the song to myself from PDF supplied. It works from a photocopy too, using scan text OCR in Mac Notes. >> THREAD

The DRM-free ebooks for my pre-apocalyptic, hopeful climate emergency novel *The Lost Cause* is on sale in the USA!

Today, you can get the Kobo edition for $2.99:

kobo.com/us/en/ebook/the-lost-

And all month, the Kindle edition is also $2.99:

amazon.com/Lost-Cause-Cory-Doc

Think I'm gonna hang here a while longer this time. X's engagement is still good but my tweets are protected so I can't ask questions over there of super interesting looking coders like @notwoods. Still, would be nice even to just follow them... :blobfoxcomputer:

Show thread
Show older
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.