-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1735 from ever-co/feat/task-screen-estimations
Feat/task screen estimations
- Loading branch information
Showing
12 changed files
with
178 additions
and
0 deletions.
There are no files selected for viewing
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
91 changes: 91 additions & 0 deletions
91
apps/mobile/app/components/Task/EstimateBlock/components/ProfileInfoWithTime.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,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" | ||
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({ | ||
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, | ||
}, | ||
}) |
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,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, | ||
}, | ||
}) |
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
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
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