Skip to content
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

Navigation Refactoring #551

Merged
merged 20 commits into from
Jul 2, 2024
Merged

Navigation Refactoring #551

merged 20 commits into from
Jul 2, 2024

Conversation

Sallaa
Copy link
Contributor

@Sallaa Sallaa commented Jun 26, 2024

This pull request introduces (a lot of) refactoring changes regarding the navigation.

The rationale is to have less error-prone code: less hardcoded strings, less arrays all around relying on ids that could break and shift things easily. The new code should be:

  • Easy to maintain: a single unified file to manage all the different tools
  • Easy to contribute to: adding a new tool should not be a hassle like it was before with code to write in many files

So... The first and main change is the ⚠️ suppression of the (infamous) NavBar.jsx ⚠️ file

The UI is now divided as follow:

  • An ApplicationLayout component that groups all the rest of the layout
  • The TopMenu component has the different quick-access tools available at the top (Tools, Assistant, etc. at the time of writing)
  • The SideMenu component lists all the tools available to fact-checkers
  • The MainContent component is where the content for the selected tool is displayed

Screenshot 2024-06-26 at 17 13 18

  • A tools file is introduced where all the tools are listed, where new tools can be added.
  • A constants folder is introduced to manage the plugin's constants that should not be modified often.

The current design choice is to get rid of ids and positions in array but use the tools' titles to identify them in redux instead. This allow to get rid of errors where the position in array or id could be wrong, which could introduce odd navigation behaviors, or even make the plugin crash totally.

  • We also introduce a Tool class that represents the tools and the properties they can have, and we added JSDoc to many functions to provide autocompletion as well as documentation.
  • A lot of constants names are also refactored with much more meaningful names: "index" or "lists" are renamed with what they truly correspond to, like "tool".
  • All the icons are wrapped as MUI svgIcon components, which allow us to override the styling as needed.

@Sallaa Sallaa marked this pull request as ready for review July 1, 2024 08:49
@Sallaa Sallaa requested review from AFPMedialab and robfrks July 1, 2024 08:49
@ttramb ttramb merged commit 3772f19 into beta-master Jul 2, 2024
1 check passed
@Sallaa Sallaa deleted the fix-sideNavigation branch July 2, 2024 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants