Skip to content

Commit

Permalink
Merge pull request #1510 from ever-co/bug/now-24hours-tab-logic
Browse files Browse the repository at this point in the history
Bug/now 24hours tab logic
  • Loading branch information
evereq authored Oct 6, 2023
2 parents f778927 + 2fcf77d commit 1b226d5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
11 changes: 8 additions & 3 deletions apps/mobile/app/components/WorkedDayHours.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const WorkedOnTaskHours = ({
memberTask,
totalTimeText,
}: {
title: string
title?: string
memberTask: ITeamTask
containerStyle: ViewStyle
totalTimeText: TextStyle
Expand All @@ -29,9 +29,14 @@ const WorkedOnTaskHours = ({

return (
<View style={containerStyle}>
<Text style={[styles.totalTimeTitle, { color: dark ? "#7B8089" : "#7E7991" }]}>{title} </Text>
{title && (
<Text style={[styles.totalTimeTitle, { color: dark ? "#7B8089" : "#7E7991" }]}>
{title}{" "}
</Text>
)}
<Text style={totalTimeText}>
{pad(dh)} h:{pad(dm)} m
{pad(dh)}
{title && " h"}:{pad(dm)} {title && "m"}
</Text>
</View>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,17 @@ import { translate } from "../../../../i18n"
import { typography, useAppTheme } from "../../../../theme"
import { GLOBAL_STYLE as GS } from "../../../../../assets/ts/styles"
import { observer } from "mobx-react-lite"
import { useTimer } from "../../../../services/hooks/useTimer"
import WorkedOnTaskHours from "../../../../components/WorkedDayHours"
interface IUserProfileTasks {
profile: IUserProfile
content: ITaskFilter
}
const UserProfileTasks: FC<IUserProfileTasks> = observer(({ profile, content }) => {
const { colors, dark } = useAppTheme()
const { timerStatus } = useTimer()
const tasks = useMemo(() => {
let tasks = content.tasksFiltered
if (content.tab === "worked" && profile.activeUserTeamTask) {
tasks = tasks.filter((ts) => {
return ts.id !== profile.activeUserTeamTask?.id
})
}

return tasks
return content.tasksFiltered
}, [content, profile])

return (
Expand All @@ -35,7 +31,10 @@ const UserProfileTasks: FC<IUserProfileTasks> = observer(({ profile, content })
}}
bounces={false}
>
{profile.activeUserTeamTask && content.tab === "worked" ? (
{content.tab === "worked" &&
profile.activeUserTeamTask &&
(profile.member?.timerStatus === "running" ||
(profile.isAuthUser && timerStatus?.running)) ? (
<>
<View
style={{
Expand All @@ -55,7 +54,7 @@ const UserProfileTasks: FC<IUserProfileTasks> = observer(({ profile, content })
borderBottomColor: colors.border,
}}
/>
<View style={{ flexDirection: "row" }}>
<View style={{ flexDirection: "row", alignItems: "center" }}>
<Text
style={{
color: colors.primary,
Expand All @@ -75,9 +74,12 @@ const UserProfileTasks: FC<IUserProfileTasks> = observer(({ profile, content })
fontSize: 12,
},
]}
>
03:31
</Text>
></Text>
<WorkedOnTaskHours
memberTask={profile.activeUserTeamTask}
containerStyle={{ alignItems: "center" }}
totalTimeText={{ color: colors.primary, fontSize: 12 }}
/>
</View>
</View>
<ListCardItem
Expand Down

0 comments on commit 1b226d5

Please sign in to comment.