Skip to content

Commit

Permalink
Merge branch 'develop' into fix/remove-dev-flag
Browse files Browse the repository at this point in the history
  • Loading branch information
pankajjs authored Oct 21, 2024
2 parents 1bbdb17 + ab3fe2e commit 07ea3e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
5 changes: 1 addition & 4 deletions src/components/taskDetails/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ const Details: FC<TaskDetailsProps> = (props) => {
const gitHubIssueLink = isGitHubLink ? value : undefined;
const [newEndOnDate, setNewEndOnDate] = useState('');
const { isUserAuthorized } = useUserData();
const router = useRouter();
const isDevFlagEnabled = router.query.dev === 'true';

useEffect(() => {
if (!isEditing) setNewEndOnDate('');
Expand Down Expand Up @@ -159,7 +157,6 @@ const Details: FC<TaskDetailsProps> = (props) => {
const renderedValue = value ?? 'N/A';
const dateValue =
newEndOnDate || new Date(value as string).toLocaleDateString('en-CA');
const finalDateValue = isDevFlagEnabled ? dateValue : newEndOnDate;

return (
<div className={styles.detailsContainer}>
Expand All @@ -171,7 +168,7 @@ const Details: FC<TaskDetailsProps> = (props) => {
name="endsOn"
onChange={(e) => setNewEndOnDate(e.target.value)}
onBlur={handleEndsOnBlur}
value={finalDateValue}
value={dateValue}
className={styles.inputField}
/>
) : (
Expand Down
8 changes: 3 additions & 5 deletions src/components/taskDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ const TaskDetails: FC<Props> = ({ taskID }) => {
);
const inputRef = useRef<HTMLInputElement>(null);
const [showSuggestion, setShowSuggestion] = useState<boolean>(false);
const isDevFlagEnabled = router.query.dev === 'true';

const handleAssignment = (e: React.ChangeEvent<HTMLInputElement>) => {
setAssigneeName(e.target.value);
Expand Down Expand Up @@ -141,7 +140,6 @@ const TaskDetails: FC<Props> = ({ taskID }) => {
setEditedTaskDetails(taskDetailsData);
}
async function onSave() {
!isDevFlagEnabled && setIsEditing(false);
const updatedFields: Partial<taskDetailsDataType['taskData']> = {};
for (const key in editedTaskDetails) {
if (
Expand All @@ -164,7 +162,7 @@ const TaskDetails: FC<Props> = ({ taskID }) => {
return;
}

isDevFlagEnabled && setLoading(true);
setLoading(true);
await updateTaskDetails({
editedDetails: updatedFields,
taskID,
Expand All @@ -173,8 +171,8 @@ const TaskDetails: FC<Props> = ({ taskID }) => {
.then(() => toast(SUCCESS, 'Successfully saved'))
.catch((error) => toast(ERROR, error.data.message))
.finally(() => {
isDevFlagEnabled && setIsEditing(false);
isDevFlagEnabled && setLoading(false);
setLoading(false);
setIsEditing(false);
});
}

Expand Down

0 comments on commit 07ea3e1

Please sign in to comment.