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

Bug/now 24hours tab logic #1510

Merged
merged 5 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,19 +9,22 @@ 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
})
}
const tasks = content.tasksFiltered
// if (content.tab === "worked" && profile.activeUserTeamTask) {
badalkhatri0924 marked this conversation as resolved.
Show resolved Hide resolved
// tasks = tasks.filter((ts) => {
// return ts.id !== profile.activeUserTeamTask?.id
// })
// }

return tasks
}, [content, profile])
Expand All @@ -35,7 +38,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 +61,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 +81,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