-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mobile): task management bb-445 (#577)
* feat: add disabled switch prop bb-445 * feat: change style bb-445 * feat: add task-background png bb-445 * feat: add task empty state, add background bb-445 * feat: add background bb-445 * feat: add export image-background component bb-445 * feat: delete unnecessary task svg bb-445 * feat: pass isDisabled to touchable-opacity bb-445 * refactor(mobile): refactored Tasks screen bb-445 * refactor(mobile): used item.id in handleKeyExtractor bb-445 * refactor(mobile): added getActiveAndExpiredTasks helper bb-445 * refactor(mobile): updated tasks state and actions, used useFocusEffect in Tasks screen bb-445 * fix(mobile): removed unused state bb-445 --------- Co-authored-by: Tetiana Brezhynska <[email protected]> Co-authored-by: Tetiana Brezhynska <[email protected]> Co-authored-by: Dmitrij Revenets <[email protected]>
- Loading branch information
1 parent
9669999
commit 0a3e281
Showing
18 changed files
with
177 additions
and
97 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...bile/src/libs/helpers/get-active-and-expired-tasks/get-active-and-expired-tasks.helper.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { TaskStatus } from "~/libs/enums/enums"; | ||
import { type TaskDto } from "~/packages/tasks/tasks"; | ||
|
||
type ActiveAndExpiredTasks = { | ||
activeTasks: TaskDto[]; | ||
expiredTasks: TaskDto[]; | ||
}; | ||
|
||
const MILLISECONDS_PER_MINUTE = 60_000; | ||
|
||
const getActiveAndExpiredTasks = (tasks: TaskDto[]): ActiveAndExpiredTasks => { | ||
const currentTimestamp = Date.now(); | ||
const expiredTasks: TaskDto[] = []; | ||
const activeTasks: TaskDto[] = []; | ||
|
||
for (const task of tasks) { | ||
const { dueDate, status } = task; | ||
const deadlineTimestamp = new Date(dueDate).getTime(); | ||
const timeToDeadline = deadlineTimestamp - currentTimestamp; | ||
|
||
if ( | ||
timeToDeadline < MILLISECONDS_PER_MINUTE && | ||
status === TaskStatus.CURRENT | ||
) { | ||
expiredTasks.push(task); | ||
} else { | ||
activeTasks.push(task); | ||
} | ||
} | ||
|
||
return { activeTasks, expiredTasks }; | ||
}; | ||
|
||
export { getActiveAndExpiredTasks }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { EmptyTasksHeader } from "./empty-tasks-header/empty-tasks-header"; |
32 changes: 32 additions & 0 deletions
32
apps/mobile/src/screens/tasks/libs/components/empty-tasks-header/empty-tasks-header.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from "react"; | ||
|
||
import { Text, View } from "~/libs/components/components"; | ||
import { globalStyles } from "~/libs/styles/styles"; | ||
|
||
import { styles } from "./styles"; | ||
|
||
type Properties = { | ||
content: string; | ||
}; | ||
|
||
const EmptyTasksHeader: React.FC<Properties> = ({ content }) => { | ||
return ( | ||
<View | ||
style={[ | ||
globalStyles.flex1, | ||
globalStyles.alignItemsCenter, | ||
globalStyles.justifyContentCenter, | ||
]} | ||
> | ||
<Text | ||
preset="subheading" | ||
style={[globalStyles.ph32, styles.content]} | ||
weight="bold" | ||
> | ||
{content} | ||
</Text> | ||
</View> | ||
); | ||
}; | ||
|
||
export { EmptyTasksHeader }; |
9 changes: 9 additions & 0 deletions
9
apps/mobile/src/screens/tasks/libs/components/empty-tasks-header/styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { StyleSheet } from "react-native"; | ||
|
||
const styles = StyleSheet.create({ | ||
content: { | ||
textAlign: "center", | ||
}, | ||
}); | ||
|
||
export { styles }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
export { TaskTab } from "./task-tab.enum"; | ||
export { TasksMode } from "./tasks-mode.enum"; | ||
export { TaskStatus } from "shared"; |
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
apps/mobile/src/screens/tasks/libs/helpers/get-milliseconds-left/get-milliseconds-left.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.