Skip to content

Commit

Permalink
Merge pull request #1931 from ever-co/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
evereq authored Dec 1, 2023
2 parents ef46445 + 55c0307 commit 3bdb3c0
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 21 deletions.
12 changes: 10 additions & 2 deletions apps/mobile/app/components/TeamDropdown/DropDownSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,18 @@ const DropDownSection: FC<Props> = observer(function DropDownSection({

const others = teams.filter((t) => t.id !== activeTeamId);

const { colors } = useAppTheme();
const { colors, dark } = useAppTheme();
return (
<View
style={[styles.mainContainer, { backgroundColor: colors.background, shadowColor: 'rgba(0, 0, 0, 0.12)' }]}
style={[
styles.mainContainer,
{
backgroundColor: colors.background,
shadowColor: 'rgba(0, 0, 0, 0.12)',
borderWidth: dark ? 1 : 0,
borderColor: colors.border
}
]}
>
{/* <View style={styles.indDropDown}>
<View style={{ flexDirection: "row", alignItems: "center" }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* eslint-disable react-native/no-color-literals */
/* eslint-disable react-native/no-inline-styles */
import React, { useState } from 'react';
import { View, ViewStyle, TouchableOpacity, StyleSheet, TouchableWithoutFeedback, Platform } from 'react-native';
import { View, ViewStyle, TouchableOpacity, StyleSheet, TouchableWithoutFeedback } from 'react-native';
import { Ionicons, Entypo } from '@expo/vector-icons';

// COMPONENTS
Expand Down Expand Up @@ -87,14 +87,7 @@ export const ListItemContent: React.FC<IcontentProps> = observer(({ memberInfo,
</View>
</View>
<View style={[styles.times, { borderTopColor: colors.divider }]}>
<TouchableWithoutFeedback
onPress={(event) => {
if (Platform.OS === 'android' && taskEdition.estimateEditMode) {
event.stopPropagation();
taskEdition.setEstimateEditMode(false);
}
}}
>
<TouchableWithoutFeedback>
<View
style={{
flexDirection: 'row',
Expand All @@ -114,7 +107,11 @@ export const ListItemContent: React.FC<IcontentProps> = observer(({ memberInfo,
</View>

{memberInfo.memberTask && taskEdition.estimateEditMode ? (
<View style={styles.estimate} ref={clickOutsideTaskEstimationInputRef}>
<View
style={styles.estimate}
collapsable={false}
ref={clickOutsideTaskEstimationInputRef}
>
<EstimateTime
setEditEstimate={taskEdition.setEstimateEditMode}
currentTask={memberInfo.memberTask}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ import { secondsToTime } from '../../../../helpers/date';
import { typography, useAppTheme } from '../../../../theme';
import { useTeamTasks } from '../../../../services/hooks/features/useTeamTasks';
import { ITeamTask } from '../../../../services/interfaces/ITask';
import { useClickOutside } from 'react-native-click-outside';

interface Props {
setEditEstimate?: (value: boolean) => unknown;
currentTask: ITeamTask;
setEstimateTime?: (value: number) => unknown;
timerScreen?: boolean;
}
const EstimateTime: FC<Props> = ({ setEditEstimate, currentTask, setEstimateTime }) => {
const EstimateTime: FC<Props> = ({ setEditEstimate, currentTask, setEstimateTime, timerScreen }) => {
// Hooks
const { updateTask } = useTeamTasks();
const { colors } = useAppTheme();
const { colors, dark } = useAppTheme();

// STATES
const textInputRef = useRef(null);
Expand All @@ -26,6 +28,18 @@ const EstimateTime: FC<Props> = ({ setEditEstimate, currentTask, setEstimateTime
const [isLoading, setIsLoading] = useState<boolean>(false);
const [showCheckIcon, setShowCheckIcon] = useState<boolean>(false);

const clickOutsideTaskEstimationInputRef = useClickOutside<View>(() => outsideClickInTimerScreen());

const outsideClickInTimerScreen = () => {
setShowCheckIcon(false);
textInputRef?.current?.blur();
const { h, m } = secondsToTime(currentTask?.estimate || 0);
setEstimate({
hours: h.toString(),
minutes: m.toString()
});
};

useEffect(() => {
const { h, m } = secondsToTime(currentTask?.estimate || 0);
setEstimate({
Expand Down Expand Up @@ -127,7 +141,7 @@ const EstimateTime: FC<Props> = ({ setEditEstimate, currentTask, setEstimateTime
};

return (
<View style={[styles.estimate, {}]}>
<View style={[styles.estimate, {}]} collapsable={false} ref={timerScreen && clickOutsideTaskEstimationInputRef}>
<View>
<TextInput
ref={textInputRef}
Expand Down Expand Up @@ -174,8 +188,22 @@ const EstimateTime: FC<Props> = ({ setEditEstimate, currentTask, setEstimateTime
</View>
</View>
<Text style={[styles.suffix, { color: colors.primary }]}>{' m'}</Text>
{showCheckIcon && <Feather size={25} color={'green'} name="check" onPress={() => handleSubmit()} />}
{isLoading ? <ActivityIndicator size={14} color="#1B005D" style={styles.loading} /> : null}
{showCheckIcon && (
<Feather
size={25}
color={'green'}
name="check"
onPress={() => handleSubmit()}
style={timerScreen ? { position: 'absolute', right: -24 } : undefined}
/>
)}
{isLoading && (
<ActivityIndicator
size={14}
color={timerScreen ? (dark ? colors.primary : '#1B005D') : '#1B005D'}
style={timerScreen ? { position: 'absolute', right: -19 } : styles.loading}
/>
)}
</View>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ const TimerTaskSection = observer(
>
{translate('myWorkScreen.estimateLabel')} :{' '}
</Text>
<EstimateTime currentTask={activeTask} />

<EstimateTime timerScreen={true} currentTask={activeTask} />
</View>
<TaskSize
task={activeTask}
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { JitsuOptions } from '@jitsu/jitsu-react/dist/useJitsu';
import { I_SMTPRequest } from './interfaces/ISmtp';

export const API_BASE_URL = '/api';
export const DEFAULT_APP_PATH = '/auth/team';
export const DEFAULT_APP_PATH = '/auth/passcode';
export const DEFAULT_MAIN_PATH = '/';
export const PROTECTED_APP_URL_PATHS: RegExp[] = [
/^\/$/,
Expand Down
7 changes: 5 additions & 2 deletions apps/web/pages/auth/passcode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,11 @@ function WorkSpaceScreen({ form, className }: { form: TAuthenticationPasscode }
useEffect(() => {
if (form.workspaces.length === 1) {
setSelectedWorkspace(0);
form.workspaces[0].current_teams.length === 1 &&
setSelectedTeam(form.workspaces[0].current_teams[0].team_id);
}
if (form.workspaces.length === 1 && form.workspaces[0].current_teams.length === 1) {
setSelectedTeam(form.workspaces[0].current_teams[0].team_id);
}
if (form.workspaces.length === 1 && form.workspaces[0].current_teams.length <= 1) {
setTimeout(() => {
document.getElementById('continue-to-workspace')?.click();
}, 100);
Expand Down

0 comments on commit 3bdb3c0

Please sign in to comment.