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

refactor: Refactor Editor into TypeScript with Smaller Components and Separate Concerns #830

Merged
merged 9 commits into from
Jun 26, 2024

Conversation

Kevin101Zhang
Copy link
Contributor

@Kevin101Zhang Kevin101Zhang commented Jun 24, 2024

Refactored Editor Component to TypeScript. This refactoring involved breaking down the Editor file into smaller chunks and separating concerns into distinct components. Also did some minor work on validator to ts as it is a major consumer in the editor. It is setup to later iterate on some additional test for validators.

@Kevin101Zhang Kevin101Zhang linked an issue Jun 24, 2024 that may be closed by this pull request
@Kevin101Zhang Kevin101Zhang marked this pull request as ready for review June 24, 2024 19:04
@Kevin101Zhang Kevin101Zhang requested a review from a team as a code owner June 24, 2024 19:04
@Kevin101Zhang
Copy link
Contributor Author

Kevin101Zhang commented Jun 24, 2024

Still a lot of work if we want the entire Editor to be refactored. I simply just grabbed a few large components such as a few modals and localStorage and removed them to their own separate files ontop of providing type safety. I will be casually doing this when I have time but This current interation with TS allows me to more easily integrate new features.

@Kevin101Zhang Kevin101Zhang changed the title 810 refactor editor feat: Refactor Editor into TypeScript with Smaller Components and Separate Concerns Jun 24, 2024
@@ -0,0 +1,908 @@
import type * as borsh from 'borsh';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this file be in Legacy/? We need it right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes we use everything is Legacy its nothing more than a placeholder. Maybe I should rename it to something else such as EditorComponents and continue to refactor them out as I go?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Legacy makes me assume it is being phased out - and we still need this file. We could either move this one or rename Legacy?

@@ -96,7 +96,7 @@ const PublishFormView = ({
id="contractFilter"
type="text"
placeholder="social.near"
value={startBlock === 'startBlockContinue' ? indexerDetails.rule.affected_account_id : contractFilter}
value={startBlock === 'startBlockContinue' ? contractFilter : indexerDetails.rule.affected_account_id}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why did this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted back to Contract Filter is now Editable. I must have selected the wrong option in the merge.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching this!

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm slightly concerned there may be other cases of incorrect merge resolves, could you please do a quick scan to check? 🙏🏼

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I reviewed the files and the PRs between the last few pushes to dev to make sure they are present. The changes to the contract filter and the changes to polling on latest indexer block are present ontop of prettier. I also went ahead and reviewed the files and there are no noteable differences.

@@ -1,4 +1,4 @@
import Editor from '@/components/Editor';
import Editor from '@/components/Editor/Legacy/Editor';
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the purpose of Legacy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey Morgan its just a container for what ill continue to refactor. The Legacy folder is a bit misleading in name but its simply a container for all the files I have yet to convert to TS or have not organized that are related to Editor.

Copy link
Contributor Author

@Kevin101Zhang Kevin101Zhang left a comment

Choose a reason for hiding this comment

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

reviewed files

Copy link
Collaborator

@morgsmccauley morgsmccauley left a comment

Choose a reason for hiding this comment

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

LGTM, but can you update the PR title before merging, it should use refactor: not feat:

@Kevin101Zhang Kevin101Zhang changed the title feat: Refactor Editor into TypeScript with Smaller Components and Separate Concerns refactor: Refactor Editor into TypeScript with Smaller Components and Separate Concerns Jun 26, 2024
@Kevin101Zhang Kevin101Zhang merged commit d6ec411 into main Jun 26, 2024
4 checks passed
@Kevin101Zhang Kevin101Zhang deleted the 810-refactor-editor branch June 26, 2024 20:40
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.

Refactor Editor to ts and relevant components
2 participants