Skip to content

Refactor homepage responsibilities for a more readable and maintainable frontend. #239

Description

@diostoup1522

The issue

The repository's frontend homepage component has grown into an unreadable ~850-line tome,
most of which is not JSX but rather a lot of large React hooks
(with some scoring cognitive complexity > 21 on the SonarQube analysis)
handling a lot of unrelated responsibilities all in a single component
which can make maintaining and modifying the frontend all the more difficult.
A single homepage component shouldn't be responsible for configuring:

  • Tauri integration
  • File importing and exporting
  • Slash commands
  • AI actions
  • Drag-and-drop handling
  • Keyboard shortcuts and menu actions

but rather orchestrating these functionalities together.

My proposal

Refactor the homepage into separate components
and make utility functions to move away some of the logic
the component hooks are currently responsible for
so that functionality can be maintained and modified separately.

The benefits

This would make maintaining the frontend easier, more productive,
lowering overall cognitive complexity,
making the codebase more structured
and helping the editor's frontend catch up with the more popular markdown editors.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions