proposal: renaming files to look like routes...?
Closed this issue · 5 comments
@walac and I had a bit of a problem finding some redirects today...
It would be smart of we rename components after their url-route..? Or is there no way that would work...
like src/views/one-click-loaner.js
be the redirect for /one-click-loaner/#MoCWhMwpTtKxzbvWuMexrQ
...
and same for other tools...
Or would require splitting too many things?
I got tripped up by this today too (for 30 seconds..)
Files are named by their components, not their routes. Routes can change, and a single component may have multiple routes or none at all, and that would make them confusing or inconsistent. We have gone through a lot of work to decouple components from routes and that will continue to be the case.
On further reflection, I noticed that some components are in src/components and some are in src/views, and it seems sort of arbitrary between the two. For example, src/views/SecretManager/SecretEditor.js
vs src/components/ClientEditor/index.js
. Maybe moving everything into components, either in <name>/index.js
or <name>.js
, would help..
That is entirely possible. Right now the distinction is that components rendered into pages are in views
, and components that are view-agnostic are in components
. Several views
have many nested components that could probably be moved into components
, but aren't really useful outside their view. There isn't really anything stopping these from being moved into components
.
I prefer to keep each component a directory as it more consistently accommodates the needs of a single component: JS, CSS, and images.
Closing, we can address this in the future if it becomes a problem.