atrilabs-engine icon indicating copy to clipboard operation
atrilabs-engine copied to clipboard

Refactor the UI and data structure of `@atrilabs/app-page-layer`

Open cruxcode opened this issue 2 years ago • 0 comments

Steps:

  1. Read the developer documentation.
  2. Go through the hooks already implemented in the @atrilabs/app-page-layer/src/hooks. The hooks will explain how to interact with the editor's state machine and also how to use canvasApi.navigate. You won't need to change the code in the hook.
  3. Inside the @atrilabs/app-page-layer/src/PageTree.tsx:

How to detect if a route is a directory too?

If the equation unixFilepath = routeObjectPath + "/index.(js|jsx|ts|tsx)" holds true, then, there is a directory at routeObjectPath.

Sample Tree

pages
[page_icon  ] \                                                                                      # /pages/index.jsx file
[page_icon  ] careers                                                                          # /pages/careers.jsx file
[folder_icon] offices                                                                           # a folder without an index.jsx file
                       [page_icon] India                                                         # /pages/offices/India.jsx file
                       [page_icon] USA                                                          # /pages/offices/USA.jsx file
[folder_icon] blogs                                                                             # a folder with index.jsx file
                       [page_icon  ] \                                                             # index.js route
                       [page_icon  ] react                                                     # /pages/blogs/react.jsx file
                       [folder_icon] atri                                                        # /pages/blogs/atri.jsx file
                                              [page_icon  ] ui
                                              [page_icon  ] python backend

cruxcode avatar Feb 07 '23 02:02 cruxcode