Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface ITask {
assigneeId?: string;
createdBy?: string;
cycleId?: string | null;
projectId?: string;
projectId?: string | null;
estimatePoint?: number;
userId?: string;
startDate?: Date;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const loadTaskClass = (models: IModels) => {
if (params.projectId) {
query.projectId = params.projectId;
}

if (params.createdAt) {
query.createdAt = { $gte: params.createdAt };
}
Expand Down Expand Up @@ -161,6 +161,8 @@ export const loadTaskClass = (models: IModels) => {
}) {
const { _id, ...rest } = doc;

if (rest.projectId === '') rest.projectId = null;

const task = await models.Task.findOne({ _id });

if (!task) {
Expand Down Expand Up @@ -216,7 +218,7 @@ export const loadTaskClass = (models: IModels) => {

rest.number = nextNumber;
rest.status = newStatus?._id;
rest.cycleId = '';
rest.cycleId = null;
}

await createActivity({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,11 @@ export const useProjectsVariables = (
const { cursor } = useRecordTableCursor({
sessionKey: PROJECTS_CURSOR_SESSION_KEY,
});
const [{ name, team, priority, status, lead }] = useMultiQueryState<{
const [{ name, team, lead }] = useMultiQueryState<{
name: string;
team: string;
priority: string;
status: string;
lead: string;
}>(['name', 'team', 'priority', 'status', 'lead']);
}>(['name', 'team', 'lead']);
const currentUser = useAtomValue(currentUserState);

return {
Expand All @@ -52,9 +50,6 @@ export const useProjectsVariables = (
},
cursor,
name: name || undefined,

priority: priority || undefined,
status: status || undefined,
leadId: lead || undefined,
...variables,
...(variables?.teamIds || variables?.userId || !currentUser?._id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ export const TaskDetailSheetHeader = () => {
<IconArrowsDiagonal className="text-accent-foreground" />
</Link>
</Button>
<Separator.Inline />
<Sheet.Title>{task?.name}</Sheet.Title>
</div>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const TaskDetails = ({ taskId }: { taskId: string }) => {

return (
<div className="h-full w-full flex overflow-auto">
<div className="w-full xl:max-w-3xl mx-auto py-12 px-6">
<div className="w-full xl:max-w-3xl mx-auto p-6">
<TaskFields task={task} />
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Input, Separator, useBlockEditor, BlockEditor } from 'erxes-ui';
import { Separator, useBlockEditor, BlockEditor, Textarea } from 'erxes-ui';
import { useUpdateTask } from '@/task/hooks/useUpdateTask';
import { useDebounce } from 'use-debounce';
import { useEffect, useState } from 'react';
import { useEffect, useRef, useState } from 'react';
import { Block } from '@blocknote/core';
import { ITask } from '@/task/types';
import { ActivityList } from '@/activity/components/ActivityList';
Expand Down Expand Up @@ -46,6 +46,7 @@ export const TaskFields = ({ task }: { task: ITask }) => {
});
const { updateTask } = useUpdateTask();
const [name, setName] = useState(_name);
const textareaRef = useRef<HTMLTextAreaElement | null>(null);

const handleDescriptionChange = async () => {
const content = await editor?.document;
Expand Down Expand Up @@ -84,10 +85,21 @@ export const TaskFields = ({ task }: { task: ITask }) => {
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [debouncedDescriptionContent]);

useEffect(() => {
if (!textareaRef.current) {
return;
}
textareaRef.current.style.height = 'auto';
textareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`;
}, [name]);

return (
<div className="flex flex-col gap-3">
<Input
className="shadow-none focus-visible:shadow-none h-8 text-xl p-0"
<Textarea
ref={textareaRef}
className="shadow-none focus-visible:shadow-none p-0"
style={{ fontSize: '1.25rem', lineHeight: '1.75rem' }}
placeholder="Task Name"
value={name}
onChange={(e) => setName(e.target.value)}
Expand Down