-
Notifications
You must be signed in to change notification settings - Fork 152
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
base: develop
Are you sure you want to change the base?
Replace accordion view with tab view for task list #453
Conversation
@samarpan1738 is attempting to deploy a commit to the RDS-Team Team on Vercel. A member of the Team first needs to authorize it. |
c48f0bb
to
9539220
Compare
9539220
to
206ed6e
Compare
206ed6e
to
bf0cc0c
Compare
{!!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/>} |
There was a problem hiding this comment.
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>
.
.
.
Fixes #432
Changes
Preview video
Screen.Recording.2023-03-14.at.12.57.59.AM.mov