This is a dev diary of implementing Filerion, a web-based file manager for online storage (Dropbox, OneDrive, Google Drive, s3 and more).
Today:
added navigation between files with up / down arrows; Enter opens directory. The goal is to mimic desktop file managers as much as possible
load dropbox SDK on demand, only when we’re using dropbox functionality. In total it’s ~120 kB so it’s better to not load it if we can avoid it
lesson: I believe that performance is a feature and that to get fast code you need to optimize everything you know how to optimize (at a reasonable implementation cost)
fixing Dropbox expiring access token again. The docs for their SDK are terrible. Turns out that I have to remember access token and refresh token. All access tokens are short lived and refresh tokens are used to get new access token when it expires
refactoring how we read files in each file system. This took most of the time today.
lesson: this happens often in programming: you spend the time not improving the product for the user but improving the structure of the code for your future self. In short term it costs time. In long term it saves time
made file name sorting case insensitive
lesson: it’s an example of prioritization of work. Even though implementing case insensitive sorting was easy and fast, it wasn’t the most important thing at the time, so I delayed doing it
better handling of double clicking on a directory name
lesson: the lesson here is that it’s ok to write sub-optimal implementation and improve it later. When clicking on a file name I need to distinguish between a click (a selection) and double-click (enter into directory). Binding click and dblclick handlers didn’t fire dblclick so I wrote somewhat convoluted way of detecting double-click by tracking what element was clicked last and if we got another click within a time period then it’s double click. Turns out I can just check if event.detail is 2 in click handler to get the same information
made file display use monospace font because I think it’s a better default for that case. Eventually I’ll make fonts and colors customizable but it’s in far future, only after the app becomes somewhat successful. Prioritization is important. Users like customization options but it’s not the “hair on fire” problem. The app must do something useful first