zio_
zio_
TTCTheo's Typesafe Cult
Created by zio_ on 5/10/2023 in #questions
What's the best way to store translation data for an app?
Currently we have everything hardcoded in English. We have some translators that will write out the translations but I'm wondering what the best way is to store this data and make it easy to implement. My initial thought was a JSON file and have the data be structured like ENG -> introBlock1 -> title: 'title goes here', subtopic1: 'something here'. BTW this is a very tiny app not and not for consumers.
3 replies
TTCTheo's Typesafe Cult
Created by zio_ on 4/18/2023 in #questions
Testing web apps with this JS framework
So i'm doing some contract work and need to test some small web apps. They are built with the jsPsych framework and bundled with Webpack. I don't know how to test these apps since I have no access to the UI. Here's an example of what I mean:
import {initJsPsych} from 'jspsych';
import htmlKeyboardResponse from '@jspsych/plugin-html-keyboard-response';

const jsPsych = initJsPsych();

const trial = {
type: htmlKeyboardResponse,
stimulus: 'Hello world!',
}

jsPsych.run([trial]);
import {initJsPsych} from 'jspsych';
import htmlKeyboardResponse from '@jspsych/plugin-html-keyboard-response';

const jsPsych = initJsPsych();

const trial = {
type: htmlKeyboardResponse,
stimulus: 'Hello world!',
}

jsPsych.run([trial]);
This is basically how the whole app is setup. You just define a trial object with the necessary parameters and then put them in an array for jsPsych to run. jsPsych spits out the html on the page. I saw this article: https://dev.to/thawkin3/how-to-unit-test-html-and-vanilla-javascript-without-a-ui-framework-4io on testing without UI framworks but I don't have an HTML file. The HTML file that comes out from the build dosen't have anything in the body since all the trials are rendered dynamically. How do I test this?
1 replies
TTCTheo's Typesafe Cult
Created by zio_ on 3/17/2023 in #questions
What is the optimal flow for guest to user functionality
So I'm building an app with the t3 stack where users can create itinerary's and I want guests (people not signed in) to be able to as well, but their's won't be saved if they don't sign in. Current semi-implementation is to create the itinerary on the client and save it to sessionStorage. I'm rendering the guest itinerary on a different page than the user itinerary page. Then when a guest returns from sign in (OAuth provider), take what's in sessionStorage, navigate them to the actual user itinerary page, create it in the backend, wait for response, and then render it. I feel like there must be a better approach. What's the best way to go about this? Is it okay to save guest data in the db temporarily?
3 replies
TTCTheo's Typesafe Cult
Created by zio_ on 1/6/2023 in #questions
Next API Route design
For something like CRUD operations is it best practice to have a route (separate file) for each operation or have it all in one route (single file)?
3 replies
TTCTheo's Typesafe Cult
Created by zio_ on 1/4/2023 in #questions
How do apps Like Notion handle updating the text content so often?
What I mean is, you can click into a field, type something, click out, and it's automatically saved. I'd like to implement something like this in my own App and am wondering how is this done? Is an API request sent to the backend every time a user clicks out of the field?
16 replies