Skip to content

Commit

Permalink
Merge branch 'develop' into bug/now-24hours-tab-logic
Browse files Browse the repository at this point in the history
  • Loading branch information
desperado1802 committed Oct 6, 2023
2 parents 77337e4 + 2ac7acd commit a51e30d
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 15 deletions.
10 changes: 8 additions & 2 deletions apps/mobile/app/components/WorkedDayHours.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
/* eslint-disable react-native/no-unused-styles */
/* eslint-disable react-native/no-color-literals */
/* eslint-disable react-native/no-inline-styles */
import React from "react"
import { View, StyleSheet, Text, ViewStyle, TextStyle } from "react-native"
import { secondsToTime } from "../helpers/date"
import { pad } from "../helpers/number"
import { useTaskStatistics } from "../services/hooks/features/useTaskStatics"
import { ITeamTask } from "../services/interfaces/ITask"
import { typography } from "../theme/typography"
import { useTheme } from "react-native-paper"

const WorkedOnTaskHours = ({
title,
Expand All @@ -21,12 +23,17 @@ const WorkedOnTaskHours = ({
}) => {
const { getTaskStat } = useTaskStatistics()
const { taskDailyStat } = getTaskStat(memberTask)
const { dark } = useTheme()

const { h: dh, m: dm } = secondsToTime(taskDailyStat?.duration || 0)

return (
<View style={containerStyle}>
{title && <Text style={styles.totalTimeTitle}>{title} : </Text>}
{title && (
<Text style={[styles.totalTimeTitle, { color: dark ? "#7B8089" : "#7E7991" }]}>
{title}{" "}
</Text>
)}
<Text style={totalTimeText}>
{pad(dh)} {title && "h"}:{pad(dm)} {title && "m"}
</Text>
Expand All @@ -36,7 +43,6 @@ const WorkedOnTaskHours = ({

const styles = StyleSheet.create({
totalTimeTitle: {
color: "#7E7991",
fontFamily: typography.secondary.medium,
fontSize: 10,
},
Expand Down
8 changes: 6 additions & 2 deletions apps/mobile/app/components/WorkedOnTask.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable react-native/no-unused-styles */
/* eslint-disable react-native/no-color-literals */
/* eslint-disable react-native/no-inline-styles */
import { observer } from "mobx-react-lite"
import React from "react"
import { View, StyleSheet, Text, ViewStyle, TextStyle } from "react-native"
Expand All @@ -8,6 +9,7 @@ import { pad } from "../helpers/number"
import { useTaskStatistics } from "../services/hooks/features/useTaskStatics"
import { ITeamTask } from "../services/interfaces/ITask"
import { typography } from "../theme/typography"
import { useTheme } from "react-native-paper"

const WorkedOnTask = observer(
({
Expand All @@ -25,12 +27,15 @@ const WorkedOnTask = observer(
}) => {
const { getTaskStat } = useTaskStatistics()
const { taskTotalStat } = getTaskStat(memberTask)
const { dark } = useTheme()

const { h: dh, m: dm } = secondsToTime(taskTotalStat?.duration || 0)

return (
<View style={containerStyle}>
<Text style={styles.totalTimeTitle}>{title} : </Text>
<Text style={[styles.totalTimeTitle, { color: dark ? "#7B8089" : "#7E7991" }]}>
{title} :{" "}
</Text>
<Text style={totalTimeText}>
{pad(dh)} h:{pad(dm)} m
</Text>
Expand All @@ -41,7 +46,6 @@ const WorkedOnTask = observer(

const styles = StyleSheet.create({
totalTimeTitle: {
color: "#7E7991",
fontFamily: typography.secondary.medium,
fontSize: 10,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* eslint-disable react-native/no-inline-styles */
/* eslint-disable react-native/no-color-literals */
import { observer } from "mobx-react-lite"
import React, { FC } from "react"
import { TouchableOpacity, Text, View, StyleSheet, TextStyle, ViewStyle } from "react-native"
import { TouchableOpacity, Text, View, TextStyle, ViewStyle } from "react-native"
import { typography, useAppTheme } from "../../../../theme"

interface Props {
Expand All @@ -16,7 +18,9 @@ const TaskTab: FC<Props> = observer(({ setSelectedTab, isSelected, tabTitle, cou
<TouchableOpacity
style={[
$container,
isSelected ? { ...$selectedTab, borderBottomColor: colors.primary } : $unselectedTab,
isSelected
? { ...$selectedTab, borderBottomColor: dark ? colors.primary : colors.secondary }
: $unselectedTab,
]}
activeOpacity={0.7}
onPress={() => setSelectedTab()}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable react-native/no-color-literals */
/* eslint-disable react-native/no-inline-styles */
/* eslint-disable camelcase */
import { observer } from "mobx-react-lite"
import React, { FC } from "react"
Expand All @@ -8,6 +9,7 @@ import { translate } from "../../../../i18n"
import { I_TeamMemberCardHook } from "../../../../services/hooks/features/useTeamMemberCard"
import { typography } from "../../../../theme/typography"
import { useLiveTimerStatus } from "../../../../services/hooks/useTimer"
import { useTheme } from "react-native-paper"

interface IProps {
isAuthUser: boolean
Expand All @@ -19,11 +21,15 @@ export const TodayWorkedTime: FC<IProps> = observer(({ isAuthUser }) => {
time: { m, h },
} = useLiveTimerStatus()

const { dark, colors } = useTheme()

if (isAuthUser) {
return (
<View style={styles.container}>
<Text style={styles.totalTimeTitle}>{translate("teamScreen.cardTotalTimeLabel")}</Text>
<Text style={styles.totalTimeText}>
<Text style={[styles.totalTimeTitle, { color: dark ? "#7B8089" : "#7E7991" }]}>
{translate("teamScreen.cardTotalTimeLabel")}
</Text>
<Text style={[styles.totalTimeText, { color: colors.primary }]}>
{pad(h)} h:{pad(m)} m
</Text>
</View>
Expand All @@ -32,8 +38,10 @@ export const TodayWorkedTime: FC<IProps> = observer(({ isAuthUser }) => {

return (
<View style={styles.container}>
<Text style={styles.totalTimeTitle}>{translate("teamScreen.cardTotalTimeLabel")}</Text>
<Text style={styles.totalTimeText}>
<Text style={[styles.totalTimeTitle, { color: dark ? "#7B8089" : "#7E7991" }]}>
{translate("teamScreen.cardTotalTimeLabel")}
</Text>
<Text style={[styles.totalTimeText, { color: colors.primary }]}>
{pad(0)} h:{pad(0)} m
</Text>
</View>
Expand All @@ -47,7 +55,6 @@ const styles = StyleSheet.create({
justifyContent: "space-between",
},
totalTimeText: {
color: "#282048",
fontFamily: typography.primary.semiBold,
fontSize: 12,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable react-native/no-color-literals */
/* eslint-disable react-native/no-inline-styles */
/* eslint-disable camelcase */
import { observer } from "mobx-react-lite"
import React, { FC } from "react"
Expand All @@ -9,6 +10,7 @@ import { translate } from "../../../../i18n"
import { useTaskStatistics } from "../../../../services/hooks/features/useTaskStatics"
import { I_TeamMemberCardHook } from "../../../../services/hooks/features/useTeamMemberCard"
import { typography } from "../../../../theme/typography"
import { useTheme } from "react-native-paper"

interface IProps {
memberInfo: I_TeamMemberCardHook
Expand All @@ -19,6 +21,8 @@ export const WorkedOnTask: FC<IProps> = observer(({ memberInfo, period }) => {
// Get current timer seconds
const { isAuthUser, memberTask } = memberInfo

const { dark, colors } = useTheme()

// activeTaskDailyStat and activeTaskTotalStat removed from useTaskStatistics call
const { getTaskStat } = useTaskStatistics()

Expand All @@ -34,15 +38,17 @@ export const WorkedOnTask: FC<IProps> = observer(({ memberInfo, period }) => {
<>
{period === "Daily" ? (
<View style={styles.container}>
<Text style={styles.totalTimeTitle}>{translate("teamScreen.cardTodayWorkLabel")}</Text>
<Text style={styles.totalTimeText}>
<Text style={[styles.totalTimeTitle, { color: dark ? "#7B8089" : "#7E7991" }]}>
{translate("teamScreen.cardTodayWorkLabel")}
</Text>
<Text style={[styles.totalTimeText, { color: colors.primary }]}>
{pad(dh)} h:{pad(dm)} m
</Text>
</View>
) : (
<View style={styles.container}>
<Text style={styles.totalTimeTitle}>{translate("teamScreen.cardTotalWorkLabel")}</Text>
<Text style={styles.totalTimeText}>
<Text style={[styles.totalTimeText, { color: colors.primary }]}>
{pad(th)} h:{pad(tm)} m
</Text>
</View>
Expand All @@ -57,7 +63,9 @@ export const WorkedOnTask: FC<IProps> = observer(({ memberInfo, period }) => {
<>
{period === "Daily" ? (
<View style={styles.container}>
<Text style={styles.totalTimeTitle}>{translate("teamScreen.cardTodayWorkLabel")}</Text>
<Text style={[styles.totalTimeTitle, { color: dark ? "#7B8089" : "#7E7991" }]}>
{translate("teamScreen.cardTodayWorkLabel")}
</Text>
<Text style={styles.totalTimeText}>
{pad(dh)} h:{pad(dm)} m
</Text>
Expand Down

0 comments on commit a51e30d

Please sign in to comment.