needmorewood
needmorewood
Explore posts from servers
TTCTheo's Typesafe Cult
Created by needmorewood on 4/26/2023 in #questions
CVA Boolean type enables
I have a table cell component that I am working on, and im trying to do a couple of styles that can be triggered in a boolean type as they can be mixed with my main variants i basically want to add the styling of link when link: true is passed in as a prop
const cell = cva('whitespace-nowrap px-3 py-4 text-sm font-normal',
{
variants: {
variant: {
date: 'text-blue-500',
primary: 'font-semibold text-slate-900',
},
link: 'underline text-red-900 hover:text-slate-700',
alignment: {
right: 'text-right',
left: 'text-left',
center: 'text-center',
},
},
});
const cell = cva('whitespace-nowrap px-3 py-4 text-sm font-normal',
{
variants: {
variant: {
date: 'text-blue-500',
primary: 'font-semibold text-slate-900',
},
link: 'underline text-red-900 hover:text-slate-700',
alignment: {
right: 'text-right',
left: 'text-left',
center: 'text-center',
},
},
});
and in the template (its Vue)
<td :class="cell({ link, alignment, variant })">
<td :class="cell({ link, alignment, variant })">
any help is appreciated also fine with alternative patterns if its out of scope of CVA, can also use something else other than CVA if need be
3 replies
TTCTheo's Typesafe Cult
Created by needmorewood on 1/2/2023 in #questions
Migrating from Prisma client to Kysely issue
I am evaluating various aspects of changing from Prisma client to Kysely but i seem to have hit a small snag basic tutorial i followed was from nexxel https://www.nexxel.dev/blog/typesafe-database in my prisma schema i have
model Recipe {
id String @id @default(cuid())
name String
prepTime String
cookTime String
totalTime String
servings String?
description String?
ingredients Json @default("[]")
instructions Json @default("[]")
updatedAt DateTime @updatedAt
}
model Recipe {
id String @id @default(cuid())
name String
prepTime String
cookTime String
totalTime String
servings String?
description String?
ingredients Json @default("[]")
instructions Json @default("[]")
updatedAt DateTime @updatedAt
}
in prisma i was able to do this
return await ctx.prisma.recipe.create({
data: {
name: input.name,
description: input.description,
ingredients: input.ingredients.split('\n'),
instructions: input.instructions.split('\n'),
prepTime: input.prepTime,
cookTime: input.cookTime,
totalTime: input.totalTime,
servings: input.servings,
},
})
return await ctx.prisma.recipe.create({
data: {
name: input.name,
description: input.description,
ingredients: input.ingredients.split('\n'),
instructions: input.instructions.split('\n'),
prepTime: input.prepTime,
cookTime: input.cookTime,
totalTime: input.totalTime,
servings: input.servings,
},
})
but in Kysely its forcing me to add id and updated at otherwise it overloads saying it needs id and updatedAt
return await db.insertInto('Recipe').values({
id: '342432', // how do i handle this autogenrating this from the DB?
updatedAt: new Date(), // how do i handle this autogenrating this from the DB?
name: input.name,
description: input.description,
ingredients: input.ingredients.split('\n'),
instructions: input.instructions.split('\n'),
prepTime: input.prepTime,
cookTime: input.cookTime,
totalTime: input.totalTime,
servings: input.servings,
}).executeTakeFirst()
return await db.insertInto('Recipe').values({
id: '342432', // how do i handle this autogenrating this from the DB?
updatedAt: new Date(), // how do i handle this autogenrating this from the DB?
name: input.name,
description: input.description,
ingredients: input.ingredients.split('\n'),
instructions: input.instructions.split('\n'),
prepTime: input.prepTime,
cookTime: input.cookTime,
totalTime: input.totalTime,
servings: input.servings,
}).executeTakeFirst()
I tried reading the kysely documentation but couldnt find it personally
17 replies
TTCTheo's Typesafe Cult
Created by needmorewood on 12/23/2022 in #questions
serverless background jobs?
any cool services or providers to enable something like enqueuing jobs in a way that makes sense for a serverless stack? this is a side project so i just want to try options
14 replies
TTCTheo's Typesafe Cult
Created by needmorewood on 11/27/2022 in #questions
Why is my rails app faster than t3?
for serving up some basic json it seems to be at least double in speed there are large differences in infra, im more just curious which parts specifically make t3 app slower for a basic json endpoint basically using the same DB instance i retrieve a user info endpoint differences are mainly this i guess as follows rails: runs on powerful ec2 instance runs standard activerecord query ruby ~30->40ms us-east AWS t3 stack: prisma vercel serverless js/ts cold start about ~140ms settles in around ~70ms-> 90ms wherever vercel serverless functions run does infra really make that much of a difference? or is it something else? location maybe?
4 replies
TTCTheo's Typesafe Cult
Created by needmorewood on 11/23/2022 in #questions
Recommendations for generating public api docs
Work wants to use something like swagger to show public REST api docs, any better alternatives? our endpoints arent openapi compliant I think anyways. would like to not force api design if i can get away with it. stuff like astro is cool but looking for something that requires less maintenance and more bring your own content like
6 replies
TTCTheo's Typesafe Cult
Created by needmorewood on 11/5/2022 in #questions
alternatives to ag-grid
Does anyone have any recommendations for an alternative to ag-grid, this is for work and we really need a nice data grid solution and want to know if poeple have had experience with robust alternatives We are using vue3 so looking for multiplatform grids ideally
1 replies
TTCTheo's Typesafe Cult
Created by needmorewood on 10/25/2022 in #questions
Create-t3-app but Vue
This is m,ainly for the people that worked on creating create-t3-app going to develop an equivalent CLI for Nuxt/Vue + some other things i think are essential to an app it will be heavily inspired by create-t3-app but i also want to clone the repo, and selectively replace things therefor copying off most of the work. is that ok with you all? what can I do to show appropiriate credit/aknowledgement etc? just want to respect everything you all have done and also get a version of something i need out publicly
7 replies
TTCTheo's Typesafe Cult
Created by needmorewood on 10/4/2022 in #questions
Better-uptime or an alternative?
curious to what people are using to monitor their apps we have many running projects different langs/frameworks and by proxy many ec2 instances we also have internal servers so not everything is publily acessable but still want to monitor uptime on it https://betterstack.com/better-uptime -> is what im currently looking at does anyone have experience with this or something that would hit the same mark that they like?
2 replies