Riff & Refinepodcast· Feb 11, 2026· 1:39:54· 31 downloads

S1E25: Let's Build This in Remix 3

Episode page ↗
0:00

React at a moment you like. The best moments light up here.

transcript

213 moments
  1. Now, I've already built the whole thing out. I'm not on the right brain. I was like, why can't I find this? There we go. Here it is.

  2. All right, so we are going to migrate the timeline. Let me see if I can pull this up so that you can see what I've got built that we are going to migrate to Remix.

  3. Thank you.

  4. All right, so this is what we're building. It's like a timeline. It's got our mini map, basically, like our way to resize the viewport for the timeline. And then it's got individual tracks that get rendered to it that we can put into it.

  5. If you don't know, I'm building a web audio DAW, and I've started building it as a desktop app. So I have been working on the different pieces for the back end, and now I am getting to the point where I'm ready to start actually rendering the UI for the project since migrating everything to Remix.

  6. So let's take a look how bright that made my face. We can create a new project. I've already done it. So we're going to go ahead and try to migrate this timeline component from, we don't need to look at that anymore,

  7. migrate that timeline component to Remix, which is surprisingly easy. The question is, do I do it the long way, or do I do it the other way? So let me show you. Why is my finder not showing up? That's the worst thing about all maps.

  8. Is that you can try to open finder 500 times, and it will just not do that. Oh. I think that's good. All right. I'm just going to go ahead and copy the whole thing over because we're probably going to stick the LLMs on this. And we'll make them do our work for us. What's up, dude? How are you?

  9. Thanks for hopping on. Routes timeline. All right. We're just going to move this over here to here.

  10. And then I'm going to show you something that I have. So I've been migrating a whole React app to Remix. And as part of that, I have...

  11. Is this the plan? Yeah, we're going to delete that. We don't need that anymore. Let's delete. Explorer, delete. Just D. All right. I have this whole file here for the LLMs that explains, hey, here is how Remix works.

  12. I got this from Ryan, one of the creators of Remix. Hopefully launching a work project I've been working on for one and a half years. That is a long time to be working on something. Why did it take that long? Just out of curiosity. But yes, this whole file is like, hey, LLMs, read this whenever you're migrating something,

  13. when you're writing React, your remix components. And it does a pretty good job doing it. So I'm probably going to try and just get. There it is. All right.

  14. I've got like a bunch of different pieces to this. We've got the base components. We've got demo data. And then we've got a whole lot of this part, the lib stuff, is all just standard TypeScript. So I'm going to just move those somewhere, because those are fine.

  15. There's absolutely nothing wrong with those files. They can just be used as is. So I'm going to add a new folder. We're going to call it timeline, and we're going to deal with that in here. And I'll probably move some stuff around at a later date. But for now, I'm not too worried about it.

  16. So these are all just script files as well. Yep. All right, so certain things like this we're going to just move over as a whole. Is this happening type? Any? These are all just data. That's one of my favorite things about how I try to work anyway

  17. is keep as much stuff isolated from React. If it can just be TypeScript, let it just be TypeScript. And there's zero reason to mix and match. Zero reason to mix and match.

  18. I probably should have copied that because now it's going to be confused on what was going on. All right. Just wanted to move over. I don't like it. So part of the final piece of getting the timeline done was getting the rendering or the little blocks on the timeline. And I don't like the solution that I landed on, and I will probably rewrite it sometime. All right. So we have some hooks.

  19. We have some components that are React components. And all of these are going to have to get migrated over. Let me take a look at some of this other stuff too. Hooks are fine. This is just like re-exporting everything, I'm pretty sure.

  20. is so we don't really create too much of that. This is also just re-exporting it. This is specific for my other project so that I could use it. All right, cool. That's good enough. All right, what we are going to do is we are going to say, well, first we're going to clear this. And then we're just going to try and see how much this can migrate as is.

  21. All right, look at the M plan. Nope, that's not what I want. Timeline.

  22. The other timeline folder. so

  23. this should reference all the the docs by default so i'm gonna go ahead and kick this one off And then I'm going to move over here,

  24. and we're going to talk through how this works to begin with. So a timeline consists of just run npm rendered again, and I can show you this really quick. All right.

  25. So a timeline is basically, all right, client stuff. They delayed on their deliverables. Yeah, that tracks. The humans are what made it take a year and a half. That makes 1 million percent sense. So the timeline is just like linear projection, which basically means this data lives in one series of units and we have to project

  26. that unit of measurement to like another unit of measurement. That is even what we're seeing here in both of these boxes. So both of these boxes are linear projection because like this box right here represents what is this actually let's do a smaller one one two three four five six this represents six six beats here um you can kind of see it by these like dividers maybe if it's big

  27. enough um so what that what that means is like even in our data model the this data isn't represented by pixels it's represented by beats and so we have to create this system for being able to say like this entire song is let's pretend that this is like a thousand beats

  28. and this uh track inside of this song is six beats and it is starting at beat 36 and it goes through beat 42 um none of that is like pixel dimensions on a screen so this entire component's job is to it's a lot of other stuff too but like the the foundation of a timeline component is being able

  29. to project uh the that uh whatever the dimensions of your data are whatever that unit is be able to to project that dimension to like screen pixel dimensions. And, um, that is like what this whole component is about. Then we have like this piece up here, which is exactly the same thing. The difference being down here, we are only showing part of the whole song.

  30. So like our projection math is like a little different. And then in this box up here, our projection math is like the whole width is the width of your song. Like if it's a thousand beats, then the width of this, the projection scale is based off of like the whole song. Whereas the projection scale here is based on like how much you are choosing to show at once.

  31. And that is all managed by this friendly little slider right here. So this little selection window, zoom window, I think is what I call it, allows us to change the projection scale of this window. So what's nice about this window up here is that it's like a fixed projection. It's always going to be the full song, no matter what. So that math stays consistent.

  32. down here on this projection window the math is not always consistent it's based on the scale that you have set on your zoom um so that is like what has been built and then we are going to see see how well it is doing. All right, it is still exploring.

  33. Let me explore both the React invitation and the existing Remix patterns in parallel. Must have put out some sub-agents. All right, so we're going to let it do its thing. And I'm going to walk through some of the base code then so that we can get an idea of what I was talking about.

  34. So what you can see here is that I have some demo data, which is like, here's all the tracks. And we've got orange, we've got violet, these different colors for the tracks. These are clips inside of the track. You can see based on like the track ID, This clip belongs with the first track. And it starts at, it's interesting that these are in pixels.

  35. Did I do everything in pixels at first? I think I did. Let me look. Because originally in the other way, the other, This is like my third timeline implementation. I thought I am doing these in pixels

  36. because I was doing them for a demo that didn't include beats. It doesn't really matter what your starting unit is because everything's projection math. But that is not what we want. Root. And then . Yep, yep, yep. Complex value.

  37. And press that down. So we are doing a pixel timeline for this demo. Here, we can go look at this. I have another timeline.

  38. And this one I'm pretty sure is in... Let me see if I've got... Ruler, RulerTick, Pixels...

  39. I'm not pulling any fake data for this one yet.

  40. we're gonna ignore this one that one's my old implementation anyway all right shouldn't you be finishing the boys room ha ha ha you're so funny allison i probably should be finishing the boys room um but i told the people that i would do this all the people

  41. So I'm going to do this. And then I will definitely get the boys room done as well. No worries, girl. Cool.

  42. we are going to start with let me look at um quad and see quad has written the plan and is ready to execute would you like it to proceed yes i did not expect it to need me to verify things i don't really need to look i just want to see all right gotcha as will passive must use connect plus manual edit listener with passive

  43. false since the on syntax may not support non-passive listeners have to look into that that'll be interesting scroll sync queue test runs after render use request animation frame to reset press scroll against flag gotcha yep pointer lock scrub global listeners attached and event handlers must be manually cleaned up

  44. and pointer up handling context getters use get timeline getters on the context objects so children always read latest controlled prop values yep context in remix is a little different um connect runs once setup time connect callback runs on element creation setup We can compute three compensation versions for the function button. Yeah, yeah. We know that.

  45. This is an interesting breakdown. Yeah, this would be fun. So I'll go through this one, like the difference between React context and Remix context. Oh, state is so much. I love state and remix. And the fact that I don't have to use ref a bajillion things. Use memo. Use callback function.

  46. Yeah, that's nice. Use element size. Connect prop with resize observer. Yep. This is like, so my favorite thing about, you look at all of these things is that like on the react side it's like oh well this has to be a hook this has to be a hook this has to be a hook that uses effects or callback or state or refs or memos um when if you look over here on all of this it's like remix is just like no just do like

  47. regular browser stuff dude like you don't you don't have to do um you don't have to do all of of this complicated extra stuff on top. So that is like my favorite part of Remix so far is that it's just like use the browser. Phase one utilities.

  48. All right. So while that is cooking, Let's go through what all exists to make the timeline component work. The most important piece of all of this is this piece right here. So this is our data model.

  49. That is the reason I've stood up with Vue for everything. I don't want to learn all the foot guns in React. Yeah, that's true. There are a lot of foot guns and like the funny thing is, is that everybody talks about how like good, um, it's funny because everyone talks about how good react is in LLMs.

  50. And it's true in the sense that like LLMs can like pretty much create anything in react, but because react has so many like foot guns and edge cases where you're like, you've got to do it. the certain React way. It's very, LLMs are like very bad with like knowing when something's a foot gun. And what's nice about Remix is that there are a lot less

  51. foot guns because you're just using the browser. The big thing that I want to talk about is this timeline component. So this is like our base data structure. Our base data structure is saying, and this is like what we use to render everything for the most part, which is our timeline data is of type A. It extends number. So this could be anything. So this could be like beats.

  52. This could be pixels. This could be like seconds, like depending on what type of timeline that you're making. Our unit could be a number of different things, but it has to be a number. So pixels, beats, quarter notes, if that's like cute quarter notes is what we will be using.

  53. Or like if you're doing like video type stuff, then like you would be doing it based on like seconds, like whatever your base unit is. And that is like, so we have like the size, which is like the full strictly here to heckle. where's everyone watching today lol get out of here jason all right size is like how long or how big is our timeline so that's like the full amount like we talked about earlier if our song is 1000

  54. beats then size is 1000 beats now our view is a span um which we can go look at real quick a span type same thing a extends number it is just some type that extends a number this could It could be seconds, pixels, whatever. Start, it has a start, and then it has a size for how big that it's going to be.

  55. Now, our timeline, we have a size, we have a view, which is just like where does this start, and how big is the view? If we're talking about it visually, this piece right here, this is like the start. we are moving our start around. And then if we do this, then we are changing the size, but our start is staying the exact same.

  56. And then this full length here is our size from our timeline data structure. And then we have a min. So the min is like what says like, okay, if I can start dragging this down, eventually I will get to a point where it can't get any smaller no matter what. And that's important to have because there comes a point

  57. where you should not let your timeline get any smaller. This has a number of utilities on top of it. This is my favorite way. This is a very functional approach, which is it accepts the data type timeline, and then it runs some stuff on it. That's like what all these functions on this is.

  58. This is like you have a data type in a module, and then you have a whole lot of functions that operate on that data type. That's what all of these are. So you have timeline, you have span. Span's the same thing. We have a span data type, and then we have all these functions that operate on that data type. So with our timeline,

  59. One thing that we always want to do and have guarantees around is that our timeline is always valid, which means we never want. It's basically like a bunch of checks on our view, which is to say our view should never be bigger than the size. our view should never have a start that starts before zero and should never start after

  60. our size minus the min and that's like what all this does is it basically you can kind of see here content size should always be greater than or equal to zero we can never let our timeline be less than zero um our minimum size should always be greater than zero and it should be

  61. less than our content size like full size um and then uh our view size should be within the range of our min view size and our full content size and our start should always be within zero and content minus the view size so these are just like checks and what this allows us to do is is create this like ability to check like is this thing valid and then

  62. this function here is called this normalized function basically just takes our timeline and all these guarantees that we're checking for in this uh this um predicate function our normalized function just kind of does those things it basically just says like make sure that our size is clamped between what we expect it to be. Make sure our min is where it's expected to be. Make sure our view is where we expect it to be.

  63. And then just return that. So if we pass in a valid timeline, none of this stuff changes anything. But if we're passing in a timeline that has out-of-bounds values, it will force it within the bounds that we expect for our timeline. and what this allows us to do is it allows us to run these operations. So we can pan and say, all right, let's move our timeline.

  64. And let's say we start moving our timeline. If we didn't have our normalized on the data type, then as we moved it this way to the end, if we weren't checking to see that our view window has to be within the bounds of our size, then we could just move this right off. And same over here. We could just move this data right off,

  65. but we're forcing some rules on our timeline data type. So whether we're panning, whether we're zooming, which that one's a fun one. Look at this. So we can zoom in, we can zoom in, or we can like drag. I think it's shift. Shift. No. Is it option? Nope. What is it? Is it command?

  66. There it is. It's option. I was using control. So we can do like a mouse pointer drag up and down to zoom it in and out from the middle. So we have zoom, we have pan, we have resize the left, we have resize the right, we have a way for being able to convert our, which I don't use these anymore. This is just holdover. But we can convert data types to other data types.

  67. But this data type, this timeline data type, is what all of this stuff is based on for being able to take data and get it. Running and test for verification. It's almost done. Dope. Let's start looking at the code output. I can tell you that I'm not looking at it here.

  68. I really want a better need. Jason. This is a sick button. All right. Jason just texted me. I'm going to move this up here so we can do some code review. Jason just gave me this button. He said, this is what you should use to zoom your timeline. That's really funny.

  69. All right. Let's crank up the zoom on this so we can do some. some code review oh that's a lot of files friends okay did i really write that this timeline is rather complicated so it makes sense i saw you zooming in immediately thought you needed that yeah i definitely need that

  70. i'm just gonna look at the folder structure first when i get like a bunch of files like that You've got to know that you added this. All right. Nice. We've got our components.

  71. It's just exporting stuff. All right. Let's see if it did anything to mess with our data types here, if it all looks the same. Yeah, this stuff looks the same as expected. None of this stuff. Our timeline, our span, which is basically

  72. just like a way of defining a start and how big a data range should be. This is a fun one, this numeric type. Numeric is like a TypeScript generic that I've made for being able to say like, hey, here is like an interface that all of our like unit data types should follow.

  73. It said it has tree view for get changes. If you go to the top of the pane and click the menu button. All right, I'm gonna try this out. What did you say? Tree view. Ooh, hoo, hoo, hoo, hoo, hoo. I like this much better. This is good. Yes, we like this. Thank you for sharing. Heck yeah, dude. All right. Numeric is basically just like, hey, like we're going to have,

  74. I want to have some guarantees. Like we're doing projections, which means like we are taking one unit and we are projecting it through some math to another unit. And I want to know with our functions that we are always passing in one unit type and we are getting back another unit type. and so far the only unit type that I have made is pixels so pixels on the screen but I will also be

  75. doing beats beats will also exist and what this allows me to do is to say like okay we want something that can be defined at zero we want to add subtract multiply divide min max clamp equal less than, less than equals, greater than, greater than equals, blah, blah, blah, whatever. So we can define all these functions. And then we can implement like a branded type.

  76. So this is like a branded type for pixels. And it implements these functions. because we know that it implements these, we know that we can operate on pixels. And we will be able to guarantee with types that a pixel came in and a pixel came out. Or, in some

  77. cases, as is the case with projections, we can say, okay, So this is the other big piece of timeline math, which is say we've got a timeline. Our timeline is going to be based in our original unit, which is sum a pixels, seconds, beats. And then our projection math.

  78. Now, I could have gone all the way to saying we could have two unknown types. So we could technically project an A to a B. And A could be seconds and B could be beats. And that might be needed at some point. But for now, I've just hard-coded stuff because I'm only projecting things to a screen. And screens are always in pixels. So we're saying whatever the incoming unit

  79. that we want to project, so A, we want to convert A to screen, which is saying we have an A that's coming in. We want from a, and we want an output of pixels. And so this is just like some math, some projection math, to basically allow us to pass in, OK, I want from four.

  80. It's going to be starting at this beat. It's going to be this beat size. This is the scale difference between our beats and our pixels using those values convert our incoming unit to pixels. The scale for is how we get the scale that gets passed in to these other utility projections,

  81. projection utilities, which is what is the full size of our base unit. So this is the size off of our timeline. So let's say it's 1,000 beats. And then the width is how many pixels do we have available to render our timeline. And based on the expected size of the origin unit and the width of pixels that we have to use,

  82. let's get a scale that we are working off of. And that's how we get all of our projection math. Cool. So like these all stay the same because this is just like generic library functions that we use to calculate things. Let's start looking at our actual remix components.

  83. I don't care about these for right now, although I am kind of curious what we did here. Yeah. This is a fun one. It's called Prepare Canvas. Basically what it does is it guarantees that our rendering canvas is always in the highest resolution. So if you're on a high resolution screen, if you're like dots per DPR. DPR is...

  84. What is DPR? It's basically like, do you have a retina screen? I'm going to say it's dots per something. I don't know. But it's like Macs have, if you have a retina screen, then you have twice as many pixels as other screens. So if you just render canvas as standard pixels,

  85. then you get a fuzzy canvas. But if you multiply whatever, like let's say that on the browser you're rendering something that's 500 pixels by 400 pixels, this will basically say like, okay, make the canvas actually 800, 1000 by 800. But then like using CSS, scrunch it down to like the size that we're actually displaying it at.

  86. And that makes like your canvas rendering real crispy. get pointer position pointer event element which we don't have to do this anymore which is really nice um i'm going to take a look at this um what's nice about uh moving to remix is like there are some guarantees you don't use refs so you don't actually have to deal with like in a ref uh where

  87. you're trying to get the element from the ref, you have to factor in that sometimes the ref can be null, but sometimes it has an element. The way that Remix works to get canvas elements, you actually have a real element to work off of, so it's not null. Cool. So let's start at the top, and we'll move our way down. Timeline root is what we want.

  88. All right. Here is our root context. We have our timeline. It is a timeline of pixel units, which is what we want. We have set timeline, which we just pass in whatever the next timeline is, and it will set that as the timeline. Although I don't know if git is what we want here. Open set time. Current set time.

  89. Yeah, that's not right. That's really funny, though. All right. So this is already incorrect. So in context, this is also probably going to change as well. I think we're fine here. Let me show you what I'm talking about. All right.

  90. Let's go to the Remix Docs. And I'll show you what I'm talking about here. All right. In the docs, when you're working with context, the way context works is that in some parent component, uh every every remix component device pixel ratio thank you that is exactly what it is

  91. nailed it all right chat is so helpful so in your handle like every remix component you'll notice here as we go through all these components every remix component consists of two parts they have your setup um it's basically just like a closure so you have your setup which you get past a handle and if you need it you get this like setup argument which can be like literally any

  92. type you can make it a number you can make it an object um but it is just like it's basically just like a prop that you pass onto your component that you can only like it only is initialized once so So you can use that to set up, to pass data that needs to be used for setting up your component.

  93. And everything before the closure, the return for the component, you can do to set up things. You can set what your context is going to be. You can add event listeners. You can add timeouts. You can do network requests, like async work. And then what that allows you to do is that like anything that's up here in this closure, you know, like this is a reactive framework.

  94. So like when data changes, your components re-render. But what doesn't happen is like your setup stuff, like anything that happens outside of this closure only runs a single time, which is like how you can get like actual stable functionality. Everything inside of this runs every render.

  95. So these are your actual render props. and this is the data that changes every single time that a component renders and um it's interesting that they have like a set timeline that's coming in here

  96. interesting We'll have to look into this and figure out what we're going to do here. But the gist of it being is like everything inside of here is what happens when things re-render. And so the way the context works in Remix is using this handle object, handle type.

  97. It has a context on it. and if you want to access some context that you've set in a parent component then you can use handle context hit and you handle you pass in the component um that initialized that state and that's how you can get like the value from it it's all like typed so you don't have to like

  98. it's just like gives you know that theme exists here because you're passing in this component and we know that this is the type that was set on this like handle context and that's going to be what allows us to like get context values down the tree if we don't want to do like prop drilling uh this is the piece that i'm considering

  99. in this instance, which is if you, in my case, what we have is like we have a value and we have, we're going to have like a set function. We are not going to do, I don't think we're going to, we don't want to like, it doesn't, I don't think it makes sense for me to pass that in.

  100. We would expect there to be an initial timeline. And we probably will want the ability to have the parent pass in a brand new timeline, which means we might actually have a set timeline. But for the sake of explaining more about Remix, in this case, we're just going to forget that that exists right now. There are two ways to do an update.

  101. This is going to accept a timeline of pixels.

  102. And then it's going to set our current timeline to, and I'm just going to call this next, like they have done. Oh, because I'm in Zed. I was like, why are my key bindings not working?

  103. if we do this the state doesn't actually update you actually need to call handle update to tell remix hey like I changed the state and I want you to update that state this

  104. method means that because we updated this root component every single child component is going to get re-rendered um and i think in this case that is totally fine because like everything depends on this timeline component it is not like a um

  105. the other the other method of handling uh context updates is using what's called a typed event target this is basically just a way of creating basically like an event listener for your context to say

  106. this is this is like my context anytime that one of the values on this object like anytime this class has an update um as you can see here like i want to dispatch a change event so this is this is what's interesting here is like you can choose when and how to dispatch these events

  107. when you dispatch an event you can choose um like children can choose to listen or to not listen to those changes so basically what would happen is like if you have this context value theme and a child calls set value and then it dispatches an event and nothing is listening for that value to change then nothing changes nothing gets re-rendered

  108. however as you can kind of see here like instantiate a new theme pass that theme in as the context value this theme is a event target that allows us to like dispatch in a child component you can get that theme class and what you can say is hey i want to listen to

  109. and subscribe to granular updates basically to say like for this for this theme class which is extending a an event a typed event target um when a change event is dispatched i want to update myself um and you can kind of see here it says no unnecessary re-renders decoupled updates

  110. type safe events um this means that like this is great you don't have to worry about um values like you don't have to worry about like a parent re-rendering an entire tree below it so like let's say theme was like at the very top wrapping your entire remix app but only like like your theme toggle and like your body component needed to know that that value,

  111. what that value is. But because your theme component is like at the root, if you just run at this update, this update as part of the context value here, the entire document for your, your doc is going to re-render like every single element, whether you want it to or not. But using this method, you can just have elements listen to a specific update. So you basically have two paths where it's like,

  112. if your context is like you need it across a bunch of different elements, but only a couple elements need to actually care about that value deeper in the tree, then you want to use a typed event target because you can get granular updates. But if it's like this, like the timeline, The whole point of the timeline is that we all care about this timeline value, this timeline state. So instead of doing the event listening, it's probably just safe to update the parent and everything below it will be fine.

  113. Yeah. That's so fun. All right. Remix is cool. So this is what we want for right now, where we're going to update the value anytime that we want to set our timeline in a child. And then is interacting is useful, and I'll explain why if we get to it.

  114. All right. The rest of this looks pretty good. So we can go ahead and stage this one. We're not worried about that anymore.

  115. The next piece for this is Navigator Contact or Navigator Route? Probably Navigator Route. It's been a minute since I've looked at this. Oh, yes. That's right.

  116. We got navigator projection. Cool. OK. So the next, the timeline route is like, actually, let's go ahead and add this to. So we're going to just put this together like we are expecting it to function, just so you can kind of see the structure.

  117. All right. So in our app, in our control panel content, in our open tabs. So for every open tab, that's not actually what we want to do. Open tabs, tab, tab ID, panel. Yeah, OK, cool. So this is what we want. But we are going to render our timeline route.

  118. root, we are going to give it a timeline. It didn't have any setup props, so we're good there. All right, and then inside of our timeline root, we will have, let me just copy this from my other.

  119. I have it all set up. There's no need to type all this out again. Timeline section. See, there is all these fun pieces of time. We don't need that. All right, here we go. This is what we're talking about. Do, do, do, do, do, do. Nope.

  120. So this one had a set timeline. We're going to ignore it for right now.

  121. And set panel is just like a little wrapper class for like styles only. Another nice thing about Remix, guess what we don't need? We don't need class name. Everything can just be class. Let me see.

  122. how things are exported I'll probably change these around to match the way that I had it before but for now this will be fine

  123. That's what we want. Right here, root? Probably. Navigator track.

  124. We aren't worried about doing a load to switch between the two of these, I don't think. Canvas. And we'll figure out why everything's mad at me in a minute. probably just a matter of getting state set up.

  125. So, let's go. And, okay. Controls.

  126. that we don't care about. So, yeah, I'm not worried about controls at the moment. Inset panel we already have, but we're going to remove class name. My guess is this is going to be projection route.

  127. Perfection canvas. Ah, but we don't need that one.

  128. Let's make sure we got everything that came in where we need it to. Yep. We got a bunch of errors, mostly because this data, we are going to hard code this data on the inside for now.

  129. All right, so current timeline. How did I get that? And the previous timeline came from making an initial timeline. Try tracks. So we're going to take the same thing and put it in here.

  130. and we'll make all this more dynamic later but for now we just want to make this work

  131. Thank you.

  132. There we go. Let's figure out why this is editing. Oh, that's fine. Hello. There we go. Let's look at our root.

  133. Let's see why it's not just now. There's no corresponding closing tag. And timeline is missing anything. I did not update. Our props do not need that. Alright. Okay. We are going to say that props are just props.

  134. Div. And we are just, this is the wonderful thing. Don't need any of this. This is just us being able to set up our, honestly, I probably don't even need this div. I could probably just use a fragment,

  135. because I don't think I'll ever put classes on this. But better to have it and not need it for now. Oop. All right. It's still saying that.

  136. It doesn't have a closing, which it definitely does. So let's figure out what's making us grumpy and fix it. This is it right here. And this. Now it'll be happy. All right. This makes things a lot easier. We're working on the right stuff. All right. Class.

  137. I don't know. Skeleton scene. I don't know. Dispatch.

  138. I don't know what to see. Zoom rate. What was our zoom rate that I was messing around with? 315. There we go.

  139. see these in rates here just hard code those for now and then we'll figure out where these came from and how they were instantiated and how we're doing it now all right doll state is just yeah yeah it's all just like hey what clip is currently selected

  140. And that is going to be an interesting way of doing this. This is not really a remix, the remix way of doing this. So let's make this the remix way of doing this.

  141. So the way that this will work is that we will have, that's not even the right thing down here. All right. All this is currently going in the wrong place, which is fine. We'll fix it later. All right. Let's remixify this.

  142. Let our clip ID is a selected clip. It is string or null. And right now it is null. All right.

  143. .UI state, we can keep like this for now. But this only gets updated a single time. So what we actually want is a function.

  144. So in the setup function, what we want is a git function. Or we could do it that way. Let's do it this way first. All right. So we want to git ui state.

  145. Because we're working within closures, you have to create. This is not the right way to do this. So if we need something to always use the latest value, and it can get called a number of times, what we actually want to do is set it as like a variable inside the closure.

  146. So when this is re-rendered, this value will get created again. And this will be. Nope. No. Oh.

  147. We could have done the get function as well, but this is already, this just takes care of it for us by basically saying, during every render, create this doll UI state based off of like variables that can change up here. And selected clip is the only thing that we need to track at the moment. All right, handle doll action. There's no such thing as use callback.

  148. This will just be a function that can accept a doll action. and then uh instead of like a state setter um all you have to do is just set the variable

  149. and then um what you will do here is then call this dot update but now okay this is this is interesting here this might be this is one of those cases and it's not this data table um this is one of those cases where like it might actually be better to not we're not going to do it for right now we'll just see like what the performance is like

  150. re-render wise but because the only thing that needs to know if a selected clip is selected currently this could change this can change later um the only thing that needs to know is this like navigator dom so we can like render a selected state for that track this is going to be needed later because like if i select a clip in a doll um i'll just show you let's pull up ableton live

  151. so this is like a really good doll Yeah, yeah, yeah. All right.

  152. So if we make a clip and we make it bigger, all right. If we don't select the clip, you can see that this little editor panel where you can edit things on the clip. Like you can add MIDI notes to play, etc. If you're not selected or focused on that clip, then it won't show that.

  153. So you need to know when your clips have been selected. with. So you've got to be able to know what clips are selected. This is the timeline. This is some completely different component somewhere else.

  154. So in the future, yes, this will 100% be a context object. And that context object will be based off of typed event target. But for now, you don't need to worry about that. We're just going to get it working.

  155. All right, that's the only thing that is messing with us right now. Let's see what this prop type is supposed to be. Dispatch action unknown. Void action unknown. This feels like a bad type. Data unknown?

  156. UI unknown? That is not correct. We know that our UI is doll UI state. We know that our action is doll action.

  157. And we know that our data is... What is our data? Oh, this is like... Demoed. Data, what type is this? OK.

  158. LSP definitions. Oh, this is, nope, data. There we go.

  159. And scene render data UI state action. Yep. So honestly, if I wanted it to be a bunch of different prompts, I could keep it. We're not going to get that deep in the TypeScript weeds at the moment. There we go.

  160. This needs to get updated as well. It's not just going to be a name renderer, although technically it could be. Same renderer. Da data.

  161. This is the thing that I was talking about where I don't really love the implementation. It's just something that works for now.

  162. What in... Why... What an awful way to do that. We don't even need it. Alright.

  163. oh i do not stand behind any of this at the moment i need to rewrite this whole thing but it has nothing

  164. to do with what i'm focused on right now so i will come back to that timeline gone better now yep direction down better now which means the last thing that we need is the navigation dom because i'm gonna have the same problems yup So all right.

  165. .data. .urice. The idea here was that I was creating, the reason why this looks the way it does is because I was creating a type agnostic renderer. I had started working on an article for linear projection timeline UIs.

  166. And I thought, wouldn't it be? And I was not going to add this as part of the article yet because I hadn't gotten to a place where I felt good with the abstraction. But the idea that I had was that you could define, kind of like what you're seeing here. So this one is like a DAW, but this one

  167. is just like a bunch of random squares. And it's like two completely different renderers. They could have different actions. They could have different data. So the data that tells how to render this is completely different than the data that renders a timeline. So that you could have this timeline component,

  168. And the only thing that you cared about and that needed to be domain specific was like the shape of your data and how to turn your data into like canvas elements. But I'm not particularly happy with where it ended up.

  169. So, timeline dom, if we don't need handle, just don't add it people. Alright, that's the problem here is... We want these to be guarantees.

  170. There we go. Alright. Cool. Projection down is probably going to be the same issue. Yep.

  171. cool all right let's go take a look at our route and see if we're getting any type errors now nope now

  172. big reveal we have a timeline editor in remix question is does it actually work i've not looked at any of the rest of the code but dang heck yeah dude it works just needed to do a few small updates but this is like fully functional a fully functional

  173. timeline even the selecting works all with just like getting an llm to which this needs to go away this is like a style style thing i'm gonna grab that real quick like yeah dude all right Way to go, Claude. I'm proud of you. That's it.

  174. Like, if you set up a good document that clearly tells, like, the agents, the LLMs, like, hey, this is how Remix works. Because it's just browser APIs that they are very familiar with, there's very little about Remix that is Remix. It's all just like, hey, this is a closure. So if you define something up here, it will not update down here.

  175. Write code accordingly. It's really good at that kind of stuff. Let me grab... It's going to be in my search file style. CSS. I think I'll call it tailwind.css over here. All right. We're going down to the bottom.

  176. which I can just do gg timeline I do need that okay no there we go all right same thing

  177. This one. Oh, that's the way that I've been doing it. So we're going to do that again. Import. Come on. I didn't want my base, which means I need to make a file now. All right.

  178. What is making a new file? Explorer add. All right. Add in here. Timeline.css. Paste. I don't want this stone color because I have a different color.

  179. I made my own colors. And I'm going to use oatmeal. Also, this can just be alpha. This is a Tailwind specific function, and it is very useful when you want to do the color mix.

  180. I think the var should just work. I think that's how the var is going to have to work. But I can look in style, because I do it here. I need to do it there, too. Well, do I do it anywhere? Could have sworn that I did.

  181. Oh, I bet I do it in create dialog spaces. Yep, there it is. Yep, we used bar. OK, we can go ahead and update these to do the same thing. Because we can just use alpha, and it saves us a lot of text.

  182. I probably should just ask the LLM to do this. Also, I am trying to break this habit that I have where I say can you before doing anything

  183. And just not asking and telling it to do stuff. Because sometimes when I ask, can you, it takes it too literally. And it's like, yes, I can. I'm like, well, then go do it. All right. Also, I realized that I was telling you about Ableton Live. And then I never actually pulled it up here for you to be able to see it, LOL. But just to show you again, when you select a clip, this little space down here, updates

  184. with like, hey, you have this selected clip in your context. Here's stuff that you can do to edit it. Nice. Thank you. We do want that.

  185. for the timeline. Ooh. This is going to be. This is a lot. I just have to look in. I think the file that I'm looking for is going to be that panel. panel. Binset panel.

  186. That's why this is mad. You don't want class name. You want class. But I bet it's mad for some other reasons. Huh. That's why it's mad. Oh, wait. Well, that's because this is all the React stuff, which we can delete now.

  187. all right let's delete that there we go that makes life easier all right i was like that that feels fishy all right

  188. App source. That's the one we actually want. Is this where I put 10 in? Do I even use it anymore? Probably not. Also, I want to change all this because this was stupid. This should be...

  189. ...pops. Cool. Oh god. Also, don't do that.

  190. Thank you.

  191. All right. That means we need to search prep again for timeline and see if I even use it anywhere. I'm in section.

  192. Do I use it anywhere as a class? I don't even know if I do. All right. There is a utility that I made that I called, pretty sure I called it NoScrowBar.

  193. There it is. That's what we want. And then we're going to go back to here. Go back to here. This is something that should go in my root style.

  194. And this should go in as a utility, I would imagine is the best way to handle this one. Oh, I already added a timeline here. All right. Utility, utilities. I don't do this very often. I need to look this one up.

  195. Functions and directives. Import theme. Source. Utility. That's what it is. Oh, I don't know if this is going to be what I want. What I want. I think what I'm actually going to want is something different because I don't think utility will work.

  196. Oh, never mind. Here we go. Complex utilities. That is actually... Oh, and they have an exact... Do they already have one that's... It's the scroll bar. No, they don't. All right. Here we go. Utility. No. Scroll bar.

  197. and Is this the way that you would do it?

  198. I'll find out. Let's see if that worked. Hold on. Hmm. Not working yet. Let's see if I use the projection root. No scroll bar.

  199. So yeah, it should be working in theory. Let's just start this bad boy again, you see. Alright, we don't need you anymore. You can leave.

  200. Let's see if the new scroll bar. Oh, no, there it is. Scroll bar width. Oh, that means I've got something that's overriding this style.

  201. Oh, I bet I know what it is. Yep. Uh-huh, uh-huh, uh-huh. It's going to be this other. So it worked. CSS. It's really stupid. This is overriding it. I want the utility to override that.

  202. There used to be one that was like, layer... Oh, I think that's just like a legit actual... CSS thing. Uh, layer CSS. Nope.

  203. All right. Used to declare a cascade layer and can be used to define the order of precedence in case of multiple cascade layers. Layer module then layer state. That's what this stuff's using under the covers.

  204. Well, I don't really use this at the moment anymore, but we are going to call this. I do want all score bars to be thin, but I want my utility to override that. Let's ask Cloud. How do I get my

  205. Let's see what Claude has to say here.

  206. and base components utilities by putting the global scroll bar rules in layer base they'll always lose the utility no scroll bar they'll always lose two perfect that's what we want then nice nice nice nice

  207. i don't think i use this anymore we're gonna keep it around for now just because actually no we're not because i added it in my other one and that one's a lot more specific of file all right perfect let's see if that actually worked and it did aha all right now the styles of

  208. this are like from my other app um so i'm going to like review the whole style of this and i'm going to add rulers and a bunch of other fun stuff um i don't have time to keep going on this anymore this morning because i need to work on some other stuff but um this repo is live it's public so

  209. if you want to go look at the code yourself you can absolutely do that um because i will also be be going through each of this, each of the code files here. And just I'll be cleaning some stuff up from how it used to be to how it is now. This is super cool. Because I want to see how they handled all the like, wonder if that works out of the box.

  210. That's what I want to know if it works out of the box. That one's a little more. Get, not get push. Bun. Let's pop that. Oh, of course, you went down there. All right. Let's see if scroll bar. Oh, the reel does work. All right, cool. I want to see how the remix way of doing things,

  211. how Claude decided the remix way of doing things should be based on because this type of thing feels like something that should be defined elsewhere so it doesn't keep getting redefined every render. So I'll probably change a few things around

  212. and get some stuff set up in the handle. This looks pretty cool. Man, that's awesome that it just migrated that. Cool. All right. See you, everybody.

  213. Thank you.

just you here