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

STORYQ-2 Refactor #34

Merged
merged 41 commits into from
Feb 18, 2025
Merged

STORYQ-2 Refactor #34

merged 41 commits into from
Feb 18, 2025

Conversation

tealefristoe
Copy link
Contributor

@tealefristoe tealefristoe commented Feb 6, 2025

JIra story: https://concord-consortium.atlassian.net/browse/STORYQ-2

This is a major refactor of StoryQ. I spent several days diving deep into the code, cleaning things up as I encountered them. There are many changes, many of which I won't include in this write up. But here are the high level objectives and changes:

  • Cleaned up typing.
    • Removed almost all any types from the codebase. There are a few exceptions to this that I didn't have time to fix, mostly related to codap-helper.ts and CodapInterface.ts and a few .js files.
    • Many of the previous anys were related to codap API requests and responses. I added codap-api-types.ts to address these. There must be a better way! If we don't already have one, we should try to release a library with API types.
    • I also included slate in the plugin, just to access its basic types.
    • I tried cleaning up places where things were typed as object or things like { [index: string]: string} were used, but it's very possible I missed some.
  • Made stores singletons.
    • Previously, these were being passed around as props, and then sometimes saved as class variables. But there was no need to do this, and using singletons greatly simplifies the code.
  • Removed a few import cycles.
  • Converted several class components to functional components.
  • Removed synthetic events from UI components.
    • Was there a good reason to use these events?
  • Added and used actions when modifying mobx observable class variables.
  • Tried to unify style, which is probably the vast majority of changes in this PR.
    • Added semicolons to the ends of lines.
    • Consistent spacing around ifs, objects, imports, etc.
    • More consistent line breaks.
    • Simplified variable naming in some cases.

@tealefristoe tealefristoe marked this pull request as draft February 6, 2025 04:41
@tealefristoe tealefristoe marked this pull request as ready for review February 11, 2025 22:48
Copy link
Member

@scytacki scytacki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me.
I left a couple of comments that you can take or leave.

src/stores/training_store.ts Outdated Show resolved Hide resolved
src/components/progress-bar.tsx Outdated Show resolved Hide resolved
@tealefristoe tealefristoe merged commit 2aa0d62 into master Feb 18, 2025
3 checks passed
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.

2 participants