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

Code Refactor: ConsultationDetails.tsx #5830

Closed
2 tasks done
rithviknishad opened this issue Jul 3, 2023 · 3 comments · Fixed by #6258
Closed
2 tasks done

Code Refactor: ConsultationDetails.tsx #5830

rithviknishad opened this issue Jul 3, 2023 · 3 comments · Fixed by #6258
Assignees
Labels
good first issue Good for newcomers

Comments

@rithviknishad
Copy link
Member

rithviknishad commented Jul 3, 2023

ConsultationDetails.tsx contains 1000+ lines of hard-to-maintain code for all the tabs.

  • Break each tab into a separate component
  • Use object to show current tab.

Currently we are doing

{tab === "UPDATES" && <div>....</div>}
{tab === "FEED" && <div>...</div>}

Instead, we could do something like:

// ConsultationUpdatesTab.tsx

export interface ConsultationTabProps {
  // necessary props received for each tab
}

export default function ConsultationUpdatesTab(props: ConsultationTabProps) {
  return <div>...</div>
}


// ConsultationDetails.tsx

const CONSULTATION_TABS = {
  UPDATES: ConsultationUpdatesTab,
  FEED: ConsultationFeedTab,
  ...
}

...

const SelectedTab = CONSULTATION_TABS[tab];

return <div>
  ...
  <SelectedTab {...necessaryProps} />
  ...
</div>
@rithviknishad rithviknishad added the good first issue Good for newcomers label Jul 3, 2023
@nazrul7711
Copy link

hey @rithviknishad i would like to work on this

@github-actions
Copy link

Hi, @gigincg, @nihal467, @khavinshankar, @mathew-alex, @aparnacoronasafe, This issue has been automatically marked as stale because it has not had any recent activity.

@github-actions github-actions bot added the stale label Jul 19, 2023
@thtauhid
Copy link
Contributor

thtauhid commented Sep 6, 2023

Hi,
If anyone ain't working on this issue now, I'd like to work on it.

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