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.
>>
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.
>>
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.
>>
Possibly of interest to those #React #JavaScript 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
Ok, all good. But WHY #BING?? It's like hitching a sheep trailer on a Lambo.
#AI #JonyIves #neuralink #wearables
20 minutes start to finish.
Scan 4 songs and edit OCR, switch to development version of app and copy from iCloud Notes into add-track form and thence into json. Copy from json into JS hardcoded songs array which means the app will work offline in airplane mode.
Do a production build and upload. Test in device. 20 minutes. Not at all shabby for an update workflow if I say so myself.
One version of the app, using #React state management, is already completed in development. That will mean when all the popular songs are in the json the user will be able to search and compile their own set list. Just not much point switching this feature on when there are so few songs encoded thus far.
As an academic exercise for my training work I will be doing another version of the searchable app using #Redux state management with #RTK. When I started this I was less enthusiastic about adding Redux to the project so soon. Yesterday it only took one level of prop drilling - passing a different click handler function down to the table in the search component - to make me considerably more enthusiastic about the Redux option.
It's an exercise, for me, myself, I alone, to see which I prefer among #React state management architecture patterns - lifting state up or plumbing in #Redux. With the help of some nifty conditional rendering here, my #choros home page component either displays hardcoded songs (this was a requirement so the app could run during Mass with choristers' devices switched to airplane mode), or custom songs chosen from the search form component. But to make this work, re-using the same (dumb) table component, I have had to do a bit of prop drilling. And that's with only TWO state "little trees" - songs and custom songs. Much as I deplore the extra complexity of Redux, even with #RTK, in a training context, I have commented in the search component that :
// when prop drilling is a solution, redux becomes an option...
Life really is getting more #BlackMirror by the day. Thinking of that one where Miley Cyrus downloads her consciousness into a plastic toy.
{song.words.substr(0, song.words.indexOf(‘<‘).substr(0, 30).concat("...")}
nifty string manipulation cuts off after the first line, truncates to max 30 chars, adds ellipsis
It detects the beginning of a line break tag in the React render (rendered using dangerouslySetInnerHTML)
Java & Web Development Trainer, London & virtual. Author: The Frontend Cookbook. https://FrontendCookbook.com 25+ years’ prior in photography, filmmaking, web development & design for print. Someday would like to do something humanitarian with codeforireland.org and codefortheuk.com. 🌐