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

Replace accordion view with tab view for task list #453

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

samarpan1738
Copy link

@samarpan1738 samarpan1738 commented Mar 13, 2023

Fixes #432

Changes

  1. Update Tab labels (Remove underscores)
  2. Add bottom bar for Tab button (Looks better this way)

Preview video

Screen.Recording.2023-03-14.at.12.57.59.AM.mov

@vercel
Copy link

vercel bot commented Mar 13, 2023

@samarpan1738 is attempting to deploy a commit to the RDS-Team Team on Vercel.

A member of the Team first needs to authorize it.

@Maheima Maheima marked this pull request as draft March 24, 2023 11:25
Comment on lines +120 to +135
{!!error && <p>{TASKS_FETCH_ERROR_MESSAGE}</p>}
{isLoading ? (
<p>Loading...</p>
) : (
<>
{Object.keys(filteredTask).length > 0
? Object.keys(filteredTask).map((key) => (
<Accordion open={(statusActiveList.includes(key))} title={key} key={key}>
<TaskList tasks={filteredTask[key]} isEditable={isEditable} updateCardContent={updateCardContent} hasLimit={key == IN_PROGRESS}/>
</Accordion>
))
: !error && 'No Tasks Found'}
? <div className={classNames.tasksContainer}>
<div className={classNames.tabsContainer}>
<Tabs tabs={Object.values(Tab) as Tab[]} onSelect={onSelect} activeTab={activeTab}/>
</div>
<div>
{filteredTask[activeTab] ? <TaskList tasks={filteredTask[activeTab]} isEditable={isEditable} updateCardContent={updateCardContent}/>
:<EmptyTaskListLabel/>}
</div>
</div>
: !error && <EmptyTaskListLabel/>}
Copy link
Collaborator

@hjaintech hjaintech Mar 26, 2023

Choose a reason for hiding this comment

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

The highlighted piece of code has multiple levels of ternary operators being used which is making this code hard to understand/debug. I'd suggest looking for ways to flatten it out OR move some parts of code into separate functions like below

const renderTabSection = () => (
  <div className={classNames.tabsContainer}>
    <Tabs
      tabs={Object.values(Tab) as Tab[]}
      onSelect={onSelect}
      activeTab={activeTab}
    />
  </div>
);

const renderTaskList = () => (
  <div>
    {filteredTask[activeTab] ? (
      <TaskList
        tasks={filteredTask[activeTab]}
        isEditable={isEditable}
        updateCardContent={updateCardContent}
      />
    ) : (
      <EmptyTaskListLabel />
    )}
  </div>
);

.
.
.
  <div className={classNames.tasksContainer}>
    {renderTabSection()}
    {renderTaskList()}
  </div>
.
.
.

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.

Render Tasklist depending on the key of the selected Tab
2 participants