|
coding_0.wav|So, um, what's up, I think, I guess this is for Wilson. Um, I created a new blank template, uh, to see if we can optimize on, uh, some of the things that, um, we're not so good in the previous, um, in the previous. Uh, iteration. So like we started out with a VCO, let's see if we can do something better. There'll be a lot of copying and pasting, but, uh, for the most part, I think.|1 |
|
coding_1.wav|um um but for some parts i guess we are like changing it from scratch uh so let's see how it goes so i have some code here uh on this other monitor that i think uh like if it's not so good we'll change it otherwise we'll just copy and paste so let me see so it starts out as this this is localhost um and this is the blank template that i have and now let's see how we can improve it so first of all let's just change the|1 |
|
coding_2.wav|main page so in here the main page was also this is a live coding session i guess so um this is uh this is gonna be fun i guess um so at first um your your page seems to be something like this so you're going to get the super base client and then you get the authenticated user and then you just return this so i'm just going to grab this um and paste it here and then you have like the auth buttons and everything let me see where this auth button is from this auth button|1 |
|
coding_3.wav|okay uh so the whole idea is you want to have those so in here in our nav bar so we take care of that in our nav bar so let's say we comment this out first and we have this header what is header we'll grab header from here and then in components we'll put the header jsec so this is nice we need this maybe so we import the header we import the next link and okay okay so we have this learn thing but also|1 |
|
coding_4.wav|this feels like it should be a head it should be a nav bar i'm going to replace the current nav bar with this one here um but i do want this thing because we're using clear let's see how this goes let me just do a between then maybe set the window by six make it um this and then this one looks like two thirds looks nicer okay Um, so maybe five. Okay, so this is fine.|1 |
|
coding_5.wav|i'm doing this as well and let's look at localhost 3001 so this is your version so if i'm logged out or if i'm logged in i'm going to do that if i'm logged out this goes to login then then this goes to slash protected so slash protected is the one that has this lyric learn so i'm going to look at your code go to slash protected and This is the one I actually got. I'm just going to remove all this.|1 |
|
coding_6.wav|Also, before that, I want to grab this footer here and I'm going to paste it with a margin bottom 0 auto. Then let's change this to the link tag. Then these should belong to this guy and I don't think you need Now, I can grab this and paste it here. We don't need this nav part anymore. This one, we don't need. So this should be it. We wouldn't need this either. No, we need this one.|1 |
|
coding_7.wav|So we just return this and header here. So let's see what our homepage. So yeah, welcome to lyric learn. And we don't want to show this if they're not logged in, right? So we'll deal with that in a second. But here, this would be Sapphire Center. And this looks much better. And the footer, actually, you were right to add this thing. And then on this channel. Nice, nice. And Lim Sitiawan.|1 |
|
coding_8.wav|Beautiful. OK. Now, these are not implemented yet. but also um redirect this looks right um let's move this up uh let me so i found it here uh export default async function page uh user id equals auth if not user id uh then do something else so yeah that's what we're gonna do uh user id um equals auth if not user id redirect to sign in so let's see if this works over here|1 |
|
coding_9.wav|so in here you're doing it once and in here you're doing it once again so um let's just delete this for now um doesn't really matter i'll just get reset hard later um and i'm also done with and why would you add these images here uh i mean maybe i mean it should be in public right but okay doesn't really matter And now we also don't need this, I believe, but well, like we can leave it to later.|1 |
|
coding_10.wav|we're deleting login we're deleting i guess forgot password what happens if you forget your pass yeah so clerk has a forgot password as well so we can get rid of this as well and i think for reset password there is a reset password as well and yeah so straight to my inbox right very nice um so where were we oh yeah here so we're not actually going to reset the password So we'll just go back.|1 |
|
coding_11.wav|We'll just sign in as per usual. So that works. So that means your reset password page also gone. Protected. Yeah, we don't need that anymore. So we got rid of those. I believe we don't need this either. Yeah, we don't need the entire auth folder. And we don't need the sign. Also, I have the sign in and sign up page. They're very simple. It's just this and this.|1 |
|
coding_12.wav|So imagine like how much code we cleaned. So very beautiful. Click does a lot of things for us. Very, very nice. um okay now what else uh this i've also this is something i implemented so it's done um encoded redirect yeah this is for auth i don't need that either uh middleware i have one already uh it's actually super easy it's just like this So much simpler than yours.|1 |
|
coding_13.wav|So you had those middleware, right? And the reason why I'm deleting all these middleware for free is because your middleware is basically just doing auth. And like I said, a lot of auth is being implemented for us by Clerk. So we don't have to worry about that. But even if we were using just, for example, I usually use NextAuth, it's still not as complicated as that.|1 |
|
coding_14.wav|uh though nothing you don't have any icon description and i'll add an icon for now this is nice uh i guess we can make it like this uh this is gone gone so at this point i don't think your app can run anymore so we're killing it um plug so yeah so what are we supposed to do now uh when we go to songs page this should take us to slash songs so let's deal with that first Let's grab this one.|1 |
|
coding_15.wav|Let's see what you're doing here. So songs page is a use client. I know card click. Well, I think I can just get all of this actually. So now layout can close my page and my nav bar and we go to song slash paste everything in and i'm going to need uh this one so i believe for that i'll need to do uh shed cn so we'll do shed add input and it's done so ui input um but why is it in components slash form should use a form|1 |
|
coding_16.wav|So let's see. Now I have in my UI, I have a form, I have an input. I wonder what all these are. Okay, wait, let me see. Let me see yours. Where did you get this form thing? Yeah, how did you get all this is my question. But no worries. In that case, we'll just... Can I do shed remove? Let's see, shed cn. How do you remove something? Here, remove, right?|1 |
|
coding_17.wav|I'm doing command remove. I have to pause because the boss is calling. Okay, so back here, I wanna... So this page works now, but the styling's a little bit off and there's no functionality, right? so for the styling um in here in the tailwind config i actually specified uh where was a color here called spotify green so i'm just gonna grab this and put it in my own tailwind config|1 |
|
coding_18.wav|um spotify green such that i can do uh spotify green this one background spotify green so this this should work now um but more importantly we need to import these actions so um so i'm going to let me see so i'm going to grab those actions insert song as one and actually let's do a spotify one first so spotify is here um so inside source i'll put a actions spotify yes and i need to remember to install this so i'll do|1 |
|
coding_19.wav|modify track we export the type as well so this is fine action slash modify let me see where this is track and track this and this is done now does this do any DB stuff this does right so so the database stuff the database stuff we need to um yeah actually let's let's let's do the db stuff now um so um before we add this functionality to insert um let's do a little bit of sql|1 |
|
coding_20.wav|now and let me so this is what i'm seeing right now drizzle docs has an ai that runs rag you can just do this postgres the default is this okay so i'm just gonna leave this here and not default this thing right perfect um what else so a song has chunked lyrics and it also has uh chunk translation translations not array not not null but default to this as well right now uh let me think i guess in the future uh these lyrics should be their own table so|1 |
|
coding_21.wav|what my code what my data should look like right so this is perfect for us so we have a schema now and then for insert song uh let me see it was over here right so let's start with this actions and let's call this song.ts so this this file has everything to do with the song so i'm just going to delete this and there's no more super base um there's no more this. So now, now we need to pass in the user ID here.|1 |
|
coding_22.wav|So user ID, user ID is a string. And then so we don't need this. No auth error, no user error. At this point, we already assume the user is authenticated. so we don't do this and now song data so now we want to insert into this table right so i'll put this schema here for reference and so what we do is there's a very sweet syntax so await db just server.db.insert into songs|1 |
|
coding_23.wav|um values well what does it take um it takes in uh well songs takes in id user id title artist blah blah blah right and for all the things that um well this is serial but all of these which are not null you have to actually put it in and for these chunk lyrics and chunk translations because they have a default value you don't have to put them in if you don't want so let's start with that user id is user ID.|1 |
|
coding_24.wav|By the way, this syntax and this syntax is exactly the same. Okay, so insert user ID, title, artist, and a full lyric equals lyrics so in here i also want to add title artist lyrics and in here i'll need to add the corresponding ones title as a string artist as a string and lyrics so await insert this and and that is basically it so you don't need all this as well in fact|1 |
|
coding_25.wav|uh track and something and you give this each a type the reason we don't do this is because now it depends like if over here i put like a track artist versus artist track it's going to give me uh something completely different and i'm not gonna know why and so the reason why we prefer this is for the type safety and for like so you can do like like artist artist uh stuff like that so artist track|1 |
|
coding_26.wav|and then um what is the other one there's the lyrics as well right and so yeah i guess this this lyrics is optional um this is optional because um over here we don't have the lyrics yet right so we just want to store the song but now we also need the user id so uh let me see how i can get the user id here So, fonts, use, font loaded. I guess all we want is the user ID.|1 |
|
coding_27.wav|so we'll do this uh we'll replace all title track so left track here uh redirect to sign in so yeah we store the song um so yeah so now um i'm just i'm going to start the database this is a local database but we could also do like a cloud database so it depends uh so it's already running so you're on dbd actually let me kill everything first so docker kill and then let's do start database and then yarn.|1 |
|
coding_28.wav|So to actually apply, so this schema now lives in code, but it's not in the database yet. So we need to first, because we're using Postgres, we need to first generate a migration file that looks something like this. This is the migration file. create table, blah, blah, blah. So this is like basic SQL, right? And then what we want to do is we want to migrate, which is apply the SQL file onto our, um, onto our database.|1 |
|
coding_29.wav|like jcho or do i not have the environment variables yet is that it okay so i need to copy the environment variables from here um i just need these my.env so the spotify stuff um the eye so it's reloaded i refresh this search for jcho again invalid source prop ah there's this thing that i fixed um hi babe um give me a sec so oh hey oh that's pinko right oh that's louis hello|1 |
|
coding_30.wav|hi louie hi louie hello do you remember me louie louie louie he's hiding from me he's like he's like giving me side eye he's like he's pretending not to look but he's actually looking louie Why is he biting- Why are you letting him bite your pillow? Don't let him bite your pillow! He bit you? Are you okay? That's cute. I can! Aw man, kasihan. Okay, so what does this do?|1 |
|
coding_31.wav|that could so this is right yeah so i'll store the song and why do we want the error here if there's an error show the error well that's not a very efficient way to do it if we want to show the error um yeah let's not do that so i'll show you how to deal with errors nicely so in here Also, we can never set this error like this because otherwise we are revealing the internal logs to the user.|1 |
|
coding_32.wav|So that's usually a security risk. But if there is an error, usually what I'll do is I'll just toast the error. Actually, this is fine. Sometimes it's fine to reveal what error it is. This time we know, like now we know the error is related to storing it in the database, so that's fine. So I'm unable to store song. And then this can be the error as well. And then what is this?|1 |
|
coding_33.wav|trim oh it's search track tracks is this api.search matching results filter artist name yeah yeah yeah this is good this is good this is good okay and then tracks is a spotify array track and then set song card as this and this has to be a client page and then router dot The rest of this is fine. This is actually all really good lyric learn. Now, what is this nav? Well, this back to home shouldn't be in this nav bar.|1 |
|
coding_34.wav|yeah we never want to have like a div outside this which only has one child inside because we might as well put that guy's class names over here so i don't know why we need this item center padding honestly we don't need this padding either we don't need mx auto either and maybe we can do that min height and actually no let's not do min height screen because um i think the layout isn't already done like that but|1 |
|
coding_35.wav|10 increase this a little bit and this is looking good now right input type text search query set search query target value uh search for song do we want this focus ring blue just kind of i'll just have this actually let's do the focus outline none and maybe we'll make the rounded large rounded left medium i will make this six and three this is nicer okay now we have a back to home the back to home goes here song's page goes here okay|1 |
|
coding_36.wav|then which we know params we need to search params so this must be a client component um okay and then loading screen times fallback loading uh fine lyrics and lyrics artists so use effect fetch and update lyric okay this should be done over here what is this lyrics and so um Anyway, this is your app. I'm supposed to move it here. Wait, before that, do we want to have a separate lyrics page?|1 |
|
coding_37.wav|Sure, sure, sure. So we don't want the super base client. And then we have a flashcards action. Flashcards is this. This is good, actually. Yes. server action, um, just uses the open AI model to generate some flashcards. That's straightforward enough. Um, and then lyrics is this one that I also wrote. Um, yeah, this is a server action. It's the music's match response.|1 |
|
coding_38.wav|It's in the API key artist track. This is also pretty straightforward. So I'm going to put this here. Okay. So let's do not have super base, uh, lyrics. And did you say something? Probably another 15 minutes. One more question. Not so sleepy yet. I go up to 50 when it hits 50. Okay, so where were we? What is this? If it's the lyrics, show the... You need to set the track and the artist.|1 |
|
coding_39.wav|okay now let me see so first we fetch and update the lyric this is pretty good actually so we try we first fetch the lyric and then we and then we set it to that so let's say we ignore all the flashcard stuff so okay so what we do is We go back to songs, songs deals with like all the DB stuff. Right. So ideally we want to have something that says we want to have something that says that fetches the lyrics.|1 |
|
coding_40.wav|Right. So, um, for a sink, uh, we'll put in a user ID track. and then rd.id, then it's a string, string. Okay, and so again, very simple. What do we do? const res equals, this time we're trying to return something, so we have a response await db.select star from um song where equals um equals um and also we need a few and state and uh n equals so uh this goes songs dot user id equals user id|1 |
|
coding_0.wav|So, um, what's up, I think, I guess this is for Wilson. Um, I created a new blank template, uh, to see if we can optimize on, uh, some of the things that, um, we're not so good in the previous, um, in the previous. Uh, iteration. So like we started out with a VCO, let's see if we can do something better. There'll be a lot of copying and pasting, but, uh, for the most part, I think.|1 |
|
coding_1.wav|um um but for some parts i guess we are like changing it from scratch uh so let's see how it goes so i have some code here uh on this other monitor that i think uh like if it's not so good we'll change it otherwise we'll just copy and paste so let me see so it starts out as this this is localhost um and this is the blank template that i have and now let's see how we can improve it so first of all let's just change the|1 |
|
coding_2.wav|main page so in here the main page was also this is a live coding session i guess so um this is uh this is gonna be fun i guess um so at first um your your page seems to be something like this so you're going to get the super base client and then you get the authenticated user and then you just return this so i'm just going to grab this um and paste it here and then you have like the auth buttons and everything let me see where this auth button is from this auth button|1 |
|
coding_3.wav|okay uh so the whole idea is you want to have those so in here in our nav bar so we take care of that in our nav bar so let's say we comment this out first and we have this header what is header we'll grab header from here and then in components we'll put the header jsec so this is nice we need this maybe so we import the header we import the next link and okay okay so we have this learn thing but also|1 |
|
coding_4.wav|this feels like it should be a head it should be a nav bar i'm going to replace the current nav bar with this one here um but i do want this thing because we're using clear let's see how this goes let me just do a between then maybe set the window by six make it um this and then this one looks like two thirds looks nicer okay Um, so maybe five. Okay, so this is fine.|1 |
|
coding_5.wav|i'm doing this as well and let's look at localhost 3001 so this is your version so if i'm logged out or if i'm logged in i'm going to do that if i'm logged out this goes to login then then this goes to slash protected so slash protected is the one that has this lyric learn so i'm going to look at your code go to slash protected and This is the one I actually got. I'm just going to remove all this.|1 |
|
coding_6.wav|Also, before that, I want to grab this footer here and I'm going to paste it with a margin bottom 0 auto. Then let's change this to the link tag. Then these should belong to this guy and I don't think you need Now, I can grab this and paste it here. We don't need this nav part anymore. This one, we don't need. So this should be it. We wouldn't need this either. No, we need this one.|1 |
|
coding_7.wav|So we just return this and header here. So let's see what our homepage. So yeah, welcome to lyric learn. And we don't want to show this if they're not logged in, right? So we'll deal with that in a second. But here, this would be Sapphire Center. And this looks much better. And the footer, actually, you were right to add this thing. And then on this channel. Nice, nice. And Lim Sitiawan.|1 |
|
coding_8.wav|Beautiful. OK. Now, these are not implemented yet. but also um redirect this looks right um let's move this up uh let me so i found it here uh export default async function page uh user id equals auth if not user id uh then do something else so yeah that's what we're gonna do uh user id um equals auth if not user id redirect to sign in so let's see if this works over here|1 |
|
coding_9.wav|so in here you're doing it once and in here you're doing it once again so um let's just delete this for now um doesn't really matter i'll just get reset hard later um and i'm also done with and why would you add these images here uh i mean maybe i mean it should be in public right but okay doesn't really matter And now we also don't need this, I believe, but well, like we can leave it to later.|1 |
|
coding_10.wav|we're deleting login we're deleting i guess forgot password what happens if you forget your pass yeah so clerk has a forgot password as well so we can get rid of this as well and i think for reset password there is a reset password as well and yeah so straight to my inbox right very nice um so where were we oh yeah here so we're not actually going to reset the password So we'll just go back.|1 |
|
coding_11.wav|We'll just sign in as per usual. So that works. So that means your reset password page also gone. Protected. Yeah, we don't need that anymore. So we got rid of those. I believe we don't need this either. Yeah, we don't need the entire auth folder. And we don't need the sign. Also, I have the sign in and sign up page. They're very simple. It's just this and this.|1 |
|
coding_12.wav|So imagine like how much code we cleaned. So very beautiful. Click does a lot of things for us. Very, very nice. um okay now what else uh this i've also this is something i implemented so it's done um encoded redirect yeah this is for auth i don't need that either uh middleware i have one already uh it's actually super easy it's just like this So much simpler than yours.|1 |
|
coding_13.wav|So you had those middleware, right? And the reason why I'm deleting all these middleware for free is because your middleware is basically just doing auth. And like I said, a lot of auth is being implemented for us by Clerk. So we don't have to worry about that. But even if we were using just, for example, I usually use NextAuth, it's still not as complicated as that.|1 |
|
coding_14.wav|uh though nothing you don't have any icon description and i'll add an icon for now this is nice uh i guess we can make it like this uh this is gone gone so at this point i don't think your app can run anymore so we're killing it um plug so yeah so what are we supposed to do now uh when we go to songs page this should take us to slash songs so let's deal with that first Let's grab this one.|1 |
|
coding_15.wav|Let's see what you're doing here. So songs page is a use client. I know card click. Well, I think I can just get all of this actually. So now layout can close my page and my nav bar and we go to song slash paste everything in and i'm going to need uh this one so i believe for that i'll need to do uh shed cn so we'll do shed add input and it's done so ui input um but why is it in components slash form should use a form|1 |
|
coding_16.wav|So let's see. Now I have in my UI, I have a form, I have an input. I wonder what all these are. Okay, wait, let me see. Let me see yours. Where did you get this form thing? Yeah, how did you get all this is my question. But no worries. In that case, we'll just... Can I do shed remove? Let's see, shed cn. How do you remove something? Here, remove, right?|1 |
|
coding_17.wav|I'm doing command remove. I have to pause because the boss is calling. Okay, so back here, I wanna... So this page works now, but the styling's a little bit off and there's no functionality, right? so for the styling um in here in the tailwind config i actually specified uh where was a color here called spotify green so i'm just gonna grab this and put it in my own tailwind config|1 |
|
coding_18.wav|um spotify green such that i can do uh spotify green this one background spotify green so this this should work now um but more importantly we need to import these actions so um so i'm going to let me see so i'm going to grab those actions insert song as one and actually let's do a spotify one first so spotify is here um so inside source i'll put a actions spotify yes and i need to remember to install this so i'll do|1 |
|
coding_19.wav|and let me see well let's just do a simple fix for now okay and then this should give us a url why is it what is the issue here to an empty string okay and now modify track we export the type as well so this is fine action slash modify let me see where this is track and track this and this is done now does this do any DB stuff this does right so so the database stuff the database stuff we need to|1 |
|
coding_20.wav|um yeah actually let's let's let's do the db stuff now um so um before we add this functionality to insert um let's do a little bit of sql So we have a schema. And we really don't need this post stable. But we'll use it as reference. So we'll have something called songs. And let's see first what it looks like on super base. So if we go to dashboard, and then|1 |
|
coding_21.wav|now and let me so this is what i'm seeing right now drizzle docs has an ai that runs rag you can just do this postgres the default is this okay so i'm just gonna leave this here and not default this thing right perfect um what else so a song has chunked lyrics and it also has uh chunk translation translations not array not not null but default to this as well right now uh let me think i guess in the future uh these lyrics should be their own table so|1 |
|
coding_22.wav|what my code what my data should look like right so this is perfect for us so we have a schema now and then for insert song uh let me see it was over here right so let's start with this actions and let's call this song.ts so this this file has everything to do with the song so i'm just going to delete this and there's no more super base um there's no more this. So now, now we need to pass in the user ID here.|1 |
|
coding_23.wav|So user ID, user ID is a string. And then so we don't need this. No auth error, no user error. At this point, we already assume the user is authenticated. so we don't do this and now song data so now we want to insert into this table right so i'll put this schema here for reference and so what we do is there's a very sweet syntax so await db just server.db.insert into songs|1 |
|
coding_24.wav|um values well what does it take um it takes in uh well songs takes in id user id title artist blah blah blah right and for all the things that um well this is serial but all of these which are not null you have to actually put it in and for these chunk lyrics and chunk translations because they have a default value you don't have to put them in if you don't want so let's start with that user id is user ID.|1 |
|
coding_25.wav|By the way, this syntax and this syntax is exactly the same. Okay, so insert user ID, title, artist, and a full lyric equals lyrics so in here i also want to add title artist lyrics and in here i'll need to add the corresponding ones title as a string artist as a string and lyrics so await insert this and and that is basically it so you don't need all this as well in fact|1 |
|
coding_26.wav|uh track and something and you give this each a type the reason we don't do this is because now it depends like if over here i put like a track artist versus artist track it's going to give me uh something completely different and i'm not gonna know why and so the reason why we prefer this is for the type safety and for like so you can do like like artist artist uh stuff like that so artist track|1 |
|
coding_27.wav|and then um what is the other one there's the lyrics as well right and so yeah i guess this this lyrics is optional um this is optional because um over here we don't have the lyrics yet right so we just want to store the song but now we also need the user id so uh let me see how i can get the user id here So, fonts, use, font loaded. I guess all we want is the user ID.|1 |
|
coding_28.wav|so we'll do this uh we'll replace all title track so left track here uh redirect to sign in so yeah we store the song um so yeah so now um i'm just i'm going to start the database this is a local database but we could also do like a cloud database so it depends uh so it's already running so you're on dbd actually let me kill everything first so docker kill and then let's do start database and then yarn.|1 |
|
coding_29.wav|So to actually apply, so this schema now lives in code, but it's not in the database yet. So we need to first, because we're using Postgres, we need to first generate a migration file that looks something like this. This is the migration file. create table, blah, blah, blah. So this is like basic SQL, right? And then what we want to do is we want to migrate, which is apply the SQL file onto our, um, onto our database.|1 |
|
coding_30.wav|like jcho or do i not have the environment variables yet is that it okay so i need to copy the environment variables from here um i just need these my.env so the spotify stuff um the eye so it's reloaded i refresh this search for jcho again invalid source prop ah there's this thing that i fixed um hi babe um give me a sec so oh hey oh that's pinko right oh that's louis hello|1 |
|
coding_31.wav|hi louie hi louie hello do you remember me louie louie louie he's hiding from me he's like he's like giving me side eye he's like he's pretending not to look but he's actually looking louie Why is he biting- Why are you letting him bite your pillow? Don't let him bite your pillow! He bit you? Are you okay? That's cute. I can! Aw man, kasihan. Okay, so what does this do?|1 |
|
coding_32.wav|that could so this is right yeah so i'll store the song and why do we want the error here if there's an error show the error well that's not a very efficient way to do it if we want to show the error um yeah let's not do that so i'll show you how to deal with errors nicely so in here Also, we can never set this error like this because otherwise we are revealing the internal logs to the user.|1 |
|
coding_33.wav|So that's usually a security risk. But if there is an error, usually what I'll do is I'll just toast the error. Actually, this is fine. Sometimes it's fine to reveal what error it is. This time we know, like now we know the error is related to storing it in the database, so that's fine. So I'm unable to store song. And then this can be the error as well. And then what is this?|1 |
|
coding_34.wav|trim oh it's search track tracks is this api.search matching results filter artist name yeah yeah yeah this is good this is good this is good okay and then tracks is a spotify array track and then set song card as this and this has to be a client page and then router dot The rest of this is fine. This is actually all really good lyric learn. Now, what is this nav? Well, this back to home shouldn't be in this nav bar.|1 |
|
coding_35.wav|yeah we never want to have like a div outside this which only has one child inside because we might as well put that guy's class names over here so i don't know why we need this item center padding honestly we don't need this padding either we don't need mx auto either and maybe we can do that min height and actually no let's not do min height screen because um i think the layout isn't already done like that but|1 |
|
coding_36.wav|10 increase this a little bit and this is looking good now right input type text search query set search query target value uh search for song do we want this focus ring blue just kind of i'll just have this actually let's do the focus outline none and maybe we'll make the rounded large rounded left medium i will make this six and three this is nicer okay now we have a back to home the back to home goes here song's page goes here okay|1 |
|
coding_37.wav|then which we know params we need to search params so this must be a client component um okay and then loading screen times fallback loading uh fine lyrics and lyrics artists so use effect fetch and update lyric okay this should be done over here what is this lyrics and so um Anyway, this is your app. I'm supposed to move it here. Wait, before that, do we want to have a separate lyrics page?|1 |
|
coding_38.wav|Sure, sure, sure. So we don't want the super base client. And then we have a flashcards action. Flashcards is this. This is good, actually. Yes. server action, um, just uses the open AI model to generate some flashcards. That's straightforward enough. Um, and then lyrics is this one that I also wrote. Um, yeah, this is a server action. It's the music's match response.|1 |
|
coding_39.wav|It's in the API key artist track. This is also pretty straightforward. So I'm going to put this here. Okay. So let's do not have super base, uh, lyrics. And did you say something? Probably another 15 minutes. One more question. Not so sleepy yet. I go up to 50 when it hits 50. Okay, so where were we? What is this? If it's the lyrics, show the... You need to set the track and the artist.|1 |
|
coding_40.wav|okay now let me see so first we fetch and update the lyric this is pretty good actually so we try we first fetch the lyric and then we and then we set it to that so let's say we ignore all the flashcard stuff so okay so what we do is We go back to songs, songs deals with like all the DB stuff. Right. So ideally we want to have something that says we want to have something that says that fetches the lyrics.|1 |
|
coding_41.wav|Right. So, um, for a sink, uh, we'll put in a user ID track. and then rd.id, then it's a string, string. Okay, and so again, very simple. What do we do? const res equals, this time we're trying to return something, so we have a response await db.select star from um song where equals um equals um and also we need a few and state and uh n equals so uh this goes songs dot user id equals user id|1 |
|
coding_42.wav|user id and um yeah i forgot to comment uh this additional curly bow here and then i'm gonna put this and this will pass in the user id wait get lyrics where is this functions no not lyric so this would be get lyrics from action slash stop um yeah right ah but again if not user id redirect to So I think there's a way to clean this up later, like this part here, using the matches, but we'll do that later.|1 |
|
coding_43.wav|then we should fetch the lyrics right so and there are no lyrics then we should fetch the lyrics otherwise um we set the lyrics to this in fact um yeah in fact we should do let lyrics equals this and and now we want to fetch the lyrics so let's call this get lyrics um because we have another get lyrics some data and some data dot lyrics yeah so if not lyrics then lyrics or actually let's do this if lyrics we set the lyrics to this otherwise this equals um|1 |
|
coding_44.wav|lyrics equals empty string so if not not db then fetch this if not fetch do this um it will fetch but if it is then lyrics equals db.fulllyrics um actually let's do dev db then this otherwise like this and lyrics here so lyrics is first nothing uh first we try to get it from the database if the if this is not an empty array then we can access the full lyrics|1 |
|
coding_45.wav|flash and then this will take in break again we'll pass in the lyrics like this uh this is a string uh if not flashcards throw this and then this is this has original and translated so what does this do this uh puts it what i think function For flashcards, this takes in a user ID again, a track artist, and the lyric. So what does this do? It's a string, artist is a string, lyrics is a string, and return something, right?|1 |
|
coding_46.wav|Okay, so as with just now, we're not returning anything, so no response, but await db.insert or this time it's update uh the songs table set uh whatever fields we need to change so uh folder and then uh chunked lyric and chunked translation oh oh yeah i need to somehow like pen this so so i have to stress equals db.select start from songs uh where equal oh i'm just going to copy|1 |
|
coding_47.wav|flashcards are id, um, track, artist, and we do do flashcards so, um, whole, lyrics, lyrics, we can just do and then chunt lyrics equals flashcards.original and chunt translations equals flashcards.translate so, yes and then we have another use effect here this use effect depends on the lyrics and so this takes in the lyrics and so we do generate flashcards|1 |
|
coding_48.wav|and we'll go to so it's loading so yeah with all that we don't need this anymore um so this will happen first oh yeah where do we set the artist and the track give me just about five more minutes um and so this would be store song get lyrics store flashcard to export song uh maybe just a user id right um so what will this do wait no actually we get the artist from here so we don't need these two|1 |
|
coding_49.wav|right yeah yeah so we don't need this either um and we do this and yeah that should be it lyrics set lyrics and loading set loading yeah so let's see if that works um go to home first songs page let's do this one no lyrics found any console error okay no lyrics found is loading is false and there's lyrics really no There's no lyric there. Get lyrics with retry. Let me see what the parameters mean.|1 |
|
coding_50.wav|folder yeah okay there you go this is perfect and honestly i don't think we need the s-loading here so we'll just grab lyric and this and i'll remove the s-loading put this here just to reduce the complexity of the just to reduce the complexity yeah and then i didn't have bar but i want this length because we already have an f-bar So we don't need this outer div over here.|1 |
|
coding_51.wav|So that simplifies a lot. Full, no max-width, like all, center, no padding. Okay, then what was it over here? Full flex, flex one. Okay, we need the justify center as well. So this looks like this. Okay, this is perfect now. Now, all we need are the buttons. Where do we see this? No lyrics found. Fair, fair, fair. I guess we can just do this, but make it a little bit nice.|1 |
|
coding_52.wav|And maybe 200 by four, and then maybe we can do, long run songs and yeah perfect so we have this now we can go to home songs page back to home h0 then um unsync no lyrics phone oh yeah i see that's why you need to load it okay let me just undo everything then stand corrected um so we're loading here this part i still don't want one uh this part should still be full black ball items in the center x1 uh|1 |
|
coding_53.wav|pick up one and then, oh, it looks like we're adding the lyrics and then, I'll put that here somewhere, pick up my song style perfect, right? also, this should be gone and this is by art, was it jcho by unseen studio? I see, so I've been saving the thing wrongly so, yeah, I don't know where it is but I'm gonna fix it tomorrow this part, I just think it's just a restart TS server and that should be done but yeah|1 |
|
|