Skip to content

Commit

Permalink
Merge pull request #1735 from ever-co/feat/task-screen-estimations
Browse files Browse the repository at this point in the history
Feat/task screen estimations
  • Loading branch information
evereq authored Nov 8, 2023
2 parents 416a076 + 079fd41 commit e43bad4
Show file tree
Hide file tree
Showing 12 changed files with 178 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/mobile/app/components/Accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export default Accordion
const styles = StyleSheet.create({
accordContainer: {
borderRadius: 8,
marginVertical: 5,
width: "100%",
},
accordHeader: {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/* eslint-disable react-native/no-inline-styles */
/* eslint-disable react-native/no-color-literals */
import { Text, StyleSheet, TouchableOpacity, View } from "react-native"
import React from "react"
import { Avatar } from "react-native-paper"
import { imgTitleProfileAvatar } from "../../../../helpers/img-title-profile-avatar"
import { typography, useAppTheme } from "../../../../theme"
import { limitTextCharaters } from "../../../../helpers/sub-text"

Check warning on line 8 in apps/mobile/app/components/Task/EstimateBlock/components/ProfileInfoWithTime.tsx

View workflow job for this annotation

GitHub Actions / Cspell

Unknown word (Charaters)
import { useNavigation } from "@react-navigation/native"
import {
DrawerNavigationProp,
SettingScreenNavigationProp,
} from "../../../../navigators/AuthenticatedNavigator"

interface IProfileInfo {
names: string
profilePicSrc: string
userId?: string
largerProfileInfo?: boolean
estimationsBlock?: boolean
}

const ProfileInfoWithTime: React.FC<IProfileInfo> = ({
profilePicSrc,
names,
userId,
largerProfileInfo,
}) => {
const { colors } = useAppTheme()

const alternateNavigation = useNavigation<DrawerNavigationProp<"AuthenticatedTab">>()
const navigation = useNavigation<SettingScreenNavigationProp<"Profile">>()

const navigateToProfile = () => {
alternateNavigation.navigate("AuthenticatedTab")
setTimeout(() => {
navigation.navigate("Profile", { userId, activeTab: "worked" })
}, 50)
}
return (
<View style={{ flexDirection: "row", justifyContent: "space-between", paddingRight: 12 }}>
<TouchableOpacity onPress={userId && navigateToProfile} style={styles.container}>
{profilePicSrc ? (
<Avatar.Image
source={{ uri: profilePicSrc }}
size={largerProfileInfo ? 30 : 20}
style={styles.profileImage}
/>
) : (
<Avatar.Text
label={imgTitleProfileAvatar(names.replace(" ", ""))}
size={largerProfileInfo ? 30 : 20}
style={[styles.profileImage, { backgroundColor: "#82c9e0" }]}
labelStyle={[styles.prefix, { fontSize: 14 }]}
/>
)}

<Text
style={{
fontSize: largerProfileInfo ? 16 : 12,
color: colors.primary,
fontWeight: "600",
}}
>
{limitTextCharaters({

Check warning on line 65 in apps/mobile/app/components/Task/EstimateBlock/components/ProfileInfoWithTime.tsx

View workflow job for this annotation

GitHub Actions / Cspell

Unknown word (Charaters)
text: names.trim(),
numChars: 12,
})}
</Text>
</TouchableOpacity>
<Text style={{ fontSize: 12, fontWeight: "600", color: "#938FA3" }}>6 h: 40 m</Text>
</View>
)
}

export default ProfileInfoWithTime

const styles = StyleSheet.create({
container: {
alignItems: "center",
flexDirection: "row",
gap: 7,
},
prefix: {
color: "#FFFFFF",
fontFamily: typography.fonts.PlusJakartaSans.light,
},
profileImage: {
borderRadius: 100,
},
})
68 changes: 68 additions & 0 deletions apps/mobile/app/components/Task/EstimateBlock/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/* eslint-disable react-native/no-inline-styles */
/* eslint-disable react-native/no-color-literals */
import { View, Text, StyleSheet } from "react-native"
import React from "react"
import Accordion from "../../Accordion"
import TaskRow from "../DetailsBlock/components/TaskRow"
import { useStores } from "../../../models"
import ProfileInfoWithTime from "./components/ProfileInfoWithTime"
import { useAppTheme } from "../../../theme"
import { translate } from "../../../i18n"

const EstimateBlock = () => {
const {
TaskStore: { detailedTask: task },
} = useStores()

const { colors } = useAppTheme()
return (
<Accordion title={translate("taskDetailsScreen.estimate")}>
<View style={{ paddingBottom: 12 }}>
<TaskRow
labelComponent={
<View style={[styles.labelComponent, { marginLeft: 12 }]}>
<Text style={styles.labelText}>
{translate("taskDetailsScreen.estimations")}
</Text>
</View>
}
>
<Text
style={{
fontWeight: "600",
fontSize: 14,
marginLeft: 5,
color: colors.primary,
}}
>
6 h: 40 m
</Text>
{task?.members?.map((member, index) => (
<ProfileInfoWithTime
key={index}
userId={member?.userId || member?.user?.id}
profilePicSrc={member?.user?.imageUrl}
names={`${member?.user?.firstName || ""} ${
member?.user?.lastName || ""
}`}
/>
))}
</TaskRow>
</View>
</Accordion>
)
}

export default EstimateBlock

const styles = StyleSheet.create({
labelComponent: {
alignItems: "center",
flexDirection: "row",
gap: 7,
},
labelText: {
color: "#A5A2B2",
fontSize: 12,
},
})
2 changes: 2 additions & 0 deletions apps/mobile/app/i18n/ar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ const ar: Translations = {
setDueDate: "تحديد تاريخ الاستحقاق",
setStartDate: "تحديد تاريخ البدء",
items: "أغراض",
estimate: "تقدير",
estimations: "التقديرات",
},
tasksScreen: {
name: "مهام",
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/app/i18n/bg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ const bg = {
setDueDate: "Set Due Date",
setStartDate: "Set Start Date",
items: "Items",
estimate: "Estimate",
estimations: "Estimations",
},
tasksScreen: {
name: "Tasks",
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/app/i18n/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ const en = {
setDueDate: "Set Due Date",
setStartDate: "Set Start Date",
items: "Items",
estimate: "Estimate",
estimations: "Estimations",
},
tasksScreen: {
name: "Tasks",
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/app/i18n/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ const es = {
setDueDate: "Set Due Date",
setStartDate: "Set Start Date",
items: "Items",
estimate: "Estimate",
estimations: "Estimations",
},
tasksScreen: {
name: "Tasks",
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/app/i18n/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ const fr = {
setDueDate: "Définir la date d'échéance",
setStartDate: "Définir la date de début",
items: "Articles",
estimate: "Estimation",
estimations: "Estimations",
},
tasksScreen: {
name: "Tâches",
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/app/i18n/he.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ const he = {
setDueDate: "Set Due Date",
setStartDate: "Set Start Date",
items: "Items",
estimate: "Estimate",
estimations: "Estimations",
},
tasksScreen: {
name: "Tasks",
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/app/i18n/ko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ const ko: Translations = {
setDueDate: "마감일 설정",
setStartDate: "시작일 설정",
items: "품목",
estimate: "견적",
estimations: "견적들",
},
tasksScreen: {
name: "작업",
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/app/i18n/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ const ru = {
setDueDate: "Set Due Date",
setStartDate: "Set Start Date",
items: "Items",
estimate: "Estimate",
estimations: "Estimations",
},
tasksScreen: {
name: "Tasks",
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/app/screens/Authenticated/TaskScreen/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useTeamTasks } from "../../../services/hooks/features/useTeamTasks"
import TaskTitleBlock from "../../../components/Task/TitleBlock"
import DetailsBlock from "../../../components/Task/DetailsBlock"
import { translate } from "../../../i18n"
import EstimateBlock from "../../../components/Task/EstimateBlock"

export const AuthenticatedTaskScreen: FC<AuthenticatedDrawerScreenProps<"TaskScreen">> = (
_props,
Expand Down Expand Up @@ -52,6 +53,7 @@ export const AuthenticatedTaskScreen: FC<AuthenticatedDrawerScreenProps<"TaskScr
>
<TaskTitleBlock />
<DetailsBlock />
<EstimateBlock />
</ScrollView>
</View>
</View>
Expand Down

0 comments on commit e43bad4

Please sign in to comment.