Skip to content

Commit

Permalink
refactor(priority card): hide section when there's no card created yet
Browse files Browse the repository at this point in the history
  • Loading branch information
roldanjr committed Jan 30, 2023
1 parent a2ec15b commit 81f621c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
4 changes: 2 additions & 2 deletions app/renderer/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ type NavItemTypes = {
export const routes: NavItemTypes[] = [
{
icon: "task",
name: "Task List",
name: "Tasks",
exact: false,
path: "/tasklist",
path: "/tasks",
component: TaskList,
},
{
Expand Down
33 changes: 13 additions & 20 deletions app/renderer/src/routes/Timer/PriorityCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
StyledOptionPriority,
StyledOptionDone,
StyledOptionDelete,
StyledSectionSeparator,
} from "styles";
import { SVG } from "components";
import { useTargetOutside } from "hooks";
Expand Down Expand Up @@ -68,31 +69,23 @@ const PriorityCard: React.FC = () => {
};

const getTaskNoteHeading = () => {
if (isObjectEmpty(priorityList)) {
return "No priority list has been created yet.";
} else {
if (priorityCard?.text) {
return priorityCard?.text;
}
return "No task item on your priority list.";
if (priorityCard?.text) {
return priorityCard?.text;
}
return "";
};

const getTaskNoteDescription = () => {
if (isObjectEmpty(priorityList)) {
return "Create a priority list and add task items on it.";
} else {
if (isObjectEmpty(priorityCard)) {
return "Add at least one item on your priority list.";
} else {
if (priorityCard?.description) {
return priorityCard?.description;
}
return "";
}
if (priorityCard?.description) {
return priorityCard?.description;
}
return "";
};

if (isObjectEmpty(priorityList)) {
return <StyledSectionSeparator />;
}

return (
<StyledPriorityCardContainer>
<StyledPriorityCardWrapper>
Expand Down Expand Up @@ -122,10 +115,10 @@ const PriorityCard: React.FC = () => {

<StyledOptionList>
<StyledOptionDone onClick={setTaskCardDoneCallback}>
Done Task
Done
</StyledOptionDone>
<StyledOptionPriority onClick={skipTaskCardCallback}>
Skip Task
Skip
</StyledOptionPriority>
<StyledOptionDelete onClick={deleteTaskCardCallback}>
Delete
Expand Down
6 changes: 6 additions & 0 deletions app/renderer/src/styles/routes/timer/timer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ export const StyledTimer = styled.main`
}
`;

export const StyledSectionSeparator = styled.div`
width: 100%;
height: 1px;
background-color: var(--color-border-primary);
`;

export const StyledPriorityCardContainer = styled.div`
width: 100%;
height: 5.6rem;
Expand Down

0 comments on commit 81f621c

Please sign in to comment.