-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Contexter in the browser #3
Comments
Leaving aside "the big picture" for a moment, as I understand, you are looking for a UI that will "bubble" up the status of a file thru all its parent folders ...like the UI used at contexter-cli (...but with better styling ha ha). Something like the color of the folders/files that have not been saved in ATOM. |
Exactly! The contexter-cli is what reminded me. (Side note: The File Navigator is a pure React component! I plan to release it as an npm package once it actually does all the things.) Right now it uses two data structures, which I called It seemed logical at the time, and easy for users to understand probably. This would only change when files are added, removed, renamed. And then I needed a way to toggle folders opened and closed and add "busy" indicators. Rather than mess with my existing structure, I decided to put "temporary state" in a separate structure I called But now I feel like its become needlessly complicated. 😞 I hadn't even thought about the "bubbling up" feature yet... how did you approach it in contexter-cli? |
The approach really happens in contexter (not in contexer-cli) The approach is to have only one Having two different structures reflecting the same hierarchy is an open door for problems. Maybe something like this:{
"fsEntity": {
"fsEntity": {
"name": "FileNavigator.js",
"meta_1": "foo level 3",
"meta_2": {
"meta_2_1": "bar level 3",
"meta_2_2": "baz level 3"
}
},
"name": "FileNavigator",
"meta_1": "foo level 2",
"meta_2": {
"meta_2_1": "bar level 2",
"meta_2_2": "baz level 2"
}
},
"name": "nde",
"meta_1": "foo level 1",
"meta_2": {
"meta_2_1": "bar level 1",
"meta_2_2": "baz level 1"
}
} Note: |
Exactly. I appreciate hearing how you structured it. My actual file tree code is... still quite messy. But meanwhile I've been working on git and gotten some more experience with representing file directory structures. Git actually uses two different structures! Trees, which represent a single directory, and the "index" which represents a snapshot of the entire repo. The tree form consist of multiple objects, linked in a directed graph (a tree). The git index consists of a single array of objects kept in sorted alphabetical order by full path name. Operations like "git add" and "git status" use the index, while the "git commit" operation converts the index into the tree form. I think what I'll do is structure it more like the git index, where the "source of truth" is a |
Wow!
About the structures you referenced... I agree with you. For the "source of truth", a In the other hand, the React UI will be a "real" Tree structure where you will be able to move any size directory in a breeze (...in the UI only). A couple of functions to go from one structure to the other and viceversa will do the trick. The way I see it is: The fullpath is both a When working in the Map, it is a The premise is that both are the same all the time (if one changes, for whatever reason, the other must reflect it). Point 1 The frequency of operation will favor the React UI Tree assuming that the user operations are more UI related like creating, modifying, moving, deleting files than the git operations sparsely used during a session. Point 2 Point 3 Point 4 Just forked it to understand better. |
Oh no. What have I done?! Um... it's a mess. You can play with the live demo though: https://nde.now.sh Edit: Oh, it does work offline. I just had both "Offline" and "Bypass for network" checked in Chrome's devtools. Those two settings don't mix well. |
Haha, awesome you got it to work. I got git().push() working this past week so I'll be adding UI elements for staging, committing, and pushing this week! |
Hey Eduardo, I'm making a kinda cool File Navigator / Git-In-The-Browser thingy.
It uses BrowserFS to provide the Node.js
fs
API in the browser, and I'm working on adding support forfs.watch
so I can do live-reloading and stuff.Anyway, I don't have any concrete idea, but as I started thinking, "OK, I'll need a meta-data structure to track each folder's [open|closed] toggle state. And a meta-data structure to track each file's git [unchanged|modified|added|removed] state. And a meta-data structure to display a loader or spinner next to files while they're compiling..." and I remembered your project and thought I'd ping you because you have experience with that stuff!
The text was updated successfully, but these errors were encountered: