Skip to content

Commit

Permalink
Добавлены поинтеры, внесены изменения в редактирование карточки
Browse files Browse the repository at this point in the history
  • Loading branch information
KoSafronov committed Dec 6, 2024
1 parent dacbe1a commit 38ca4c8
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 116 deletions.
19 changes: 10 additions & 9 deletions src/components/KanbanCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ export const KanbanCard = (props: KanbanCardProps) => {
<div
ref="card"
className="kanban-card"
ON_click={() => {
clearTimeout(timer);
timer = setTimeout(() => {
getCardDetails(card.id).then((val) => {
setCardDetailsStore(val);
});
}, 300);
}}
ON_mousedown={(ev: PointerEvent) => {
if (!isInput && !editLock) {
setDragStart([ev.x, ev.y]);
Expand Down Expand Up @@ -169,9 +177,10 @@ export const KanbanCard = (props: KanbanCardProps) => {
});
}}
>
<i class="bi-trash" />
<i class="bi-three-dots" />
</div>
)}

{card.coverImageUrl !== undefined ? (
<img src={card.coverImageUrl} class="kanban-card__cover"></img>
) : undefined}
Expand Down Expand Up @@ -202,14 +211,6 @@ export const KanbanCard = (props: KanbanCardProps) => {
editCallback();
ev.stopPropagation();
}}
ON_click={() => {
clearTimeout(timer);
timer = setTimeout(() => {
getCardDetails(card.id).then((val) => {
setCardDetailsStore(val);
});
}, 300);
}}
>
<div>{card.title}</div>
<div>
Expand Down
2 changes: 2 additions & 0 deletions src/components/kanbanCard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
flex-direction: column;
align-items: start;
justify-content: start;
cursor: pointer;
box-shadow: 0px 1px 1px #091e4240, 0px 0px 1px #091e424f,
0px 1px 1px #091e4240, 0px 0px 1px #091e424f; // Позаимствовали у Trello
}
Expand Down Expand Up @@ -41,6 +42,7 @@
}
.kanban-card__title {
user-select: none;
cursor: text;
}

.kanban-card__textarea {
Expand Down
223 changes: 116 additions & 107 deletions src/containers/CardDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,120 +218,129 @@ export const CardDetailsContainer = (props: ComponentProps) => {
return (
<div class="card-details">
<div class="card-details__left-section">
<h2>Чеклист</h2>
{cardDetails.checkList.map((field) => {
return (
<CheckListFieldComponent
key={`component_${field.id}`}
field={field}
/>
);
})}
<Input
key="checklist_input"
placeholder="Новый пункт чеклиста"
onEnter={addCLF}
onChanged={(newText) => {
setNewCheckListField(newText);
}}
/>
<Button
key="checklist_add_btn"
callback={addCLF}
text="Добавить пункт чеклиста"
variant="accent"
/>
<h1>Комментарии</h1>
<Input
key="comment_input"
placeholder="Напишите Ваш комментарий"
onEnter={addComm}
onChanged={setNewComment}
/>
<Button
key="comment_btn"
callback={addComm}
text="Добавить комментарий"
variant="accent"
/>
{cardDetails.comments.map((comment) => {
return (
<div className="comment">
<div className="comment__author">{comment.createdBy.name}</div>
<div class="card-details_block">
<h2>Чеклист</h2>
{cardDetails.checkList.map((field) => {
return (
<CheckListFieldComponent
key={`component_${field.id}`}
field={field}
/>
);
})}
<Input
key="checklist_input"
placeholder="Новый пункт чеклиста"
onEnter={addCLF}
onChanged={(newText) => {
setNewCheckListField(newText);
}}
/>
<Button
key="checklist_add_btn"
callback={addCLF}
text="Добавить пункт чеклиста"
variant="accent"
/>
</div>
<div class="card-details_block">
<h1>Комментарии</h1>
<Input
key="comment_input"
placeholder="Напишите Ваш комментарий"
onEnter={addComm}
onChanged={setNewComment}
/>
<Button
key="comment_btn"
callback={addComm}
text="Добавить комментарий"
variant="accent"
/>
{cardDetails.comments.map((comment) => {
return (
<div className="comment">
<div className="comment__author">{comment.createdBy.name}</div>

<div>{comment.text}</div>
<div
style="cursor: pointer; color:red"
ON_click={() => {
deleteComment(comment.id).then((t) => {
if (t) {
cardDetails.comments = cardDetails.comments.filter(
(c) => {
return c.id !== comment.id;
}
);
setCardDetailsStore(cardDetails);
}
});
}}
>
<i class="bi-x-lg" />
<div>{comment.text}</div>
<div
style="cursor: pointer; color:red"
ON_click={() => {
deleteComment(comment.id).then((t) => {
if (t) {
cardDetails.comments = cardDetails.comments.filter(
(c) => {
return c.id !== comment.id;
}
);
setCardDetailsStore(cardDetails);
}
});
}}
>
<i class="bi-x-lg" />
</div>
</div>
</div>
);
})}
);
})}
</div>
</div>

<div class="card-details__right-section">
<h1>Дедлайн</h1>
<div>
Пожалуйста, вводите дату и время! Если Вы не введёте время, оно не
сработает
<div class="card-details_block">
<h1>Дедлайн</h1>
<div>
Пожалуйста, вводите дату и время! Если Вы не введёте время, оно не
сработает
</div>
<div style="cursor: pointer; color:red">
<DeadlineInput
key="deadline_input"
deadline={cardDetails.card.deadline}
cardId={cardDetails.card.id}
/>
</div>
</div>

<DeadlineInput
key="deadline_input"
deadline={cardDetails.card.deadline}
cardId={cardDetails.card.id}
/>
<h1>Назначенные пользователи</h1>
{cardDetails.assignedUsers.map((u) => {
return (
<div style="display: flex; flex-direction: row">
<div>{u.name}</div>
<div
style="cursor: pointer; color:red"
ON_click={() => {
deassignUser(cardDetails.card.id, u.id).then((t) => {
if (t) {
cardDetails.assignedUsers =
cardDetails.assignedUsers.filter((au) => {
return au.id !== u.id;
});
setCardDetailsStore(cardDetails);
}
});
}}
>
<i class="bi-x-lg" />
<div class="card-details_block">
<h1>Назначенные пользователи</h1>
{cardDetails.assignedUsers.map((u) => {
return (
<div style="display: flex; flex-direction: row">
<div>{u.name}</div>
<div
style="cursor: pointer; color:red"
ON_click={() => {
deassignUser(cardDetails.card.id, u.id).then((t) => {
if (t) {
cardDetails.assignedUsers =
cardDetails.assignedUsers.filter((au) => {
return au.id !== u.id;
});
setCardDetailsStore(cardDetails);
}
});
}}
>
<i class="bi-x-lg" />
</div>
</div>
</div>
);
})}
<Input
key="assign_user"
placeholder="Никнейм участника"
onEnter={addAssigned}
onChanged={(newText) => {
setNewAssigned(newText);
}}
/>
<Button
key="assign_user_btn"
text="Назначить участника"
variant="accent"
callback={addAssigned}
/>
);
})}
<Input
key="assign_user"
placeholder="Никнейм участника"
onEnter={addAssigned}
onChanged={(newText) => {
setNewAssigned(newText);
}}
/>
<Button
key="assign_user_btn"
text="Назначить участника"
variant="accent"
callback={addAssigned}
/>
</div>
</div>
</div>
);
Expand Down
6 changes: 6 additions & 0 deletions src/containers/cardDetails.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
display: flex;
flex-direction: row;
min-width: 70vw;
gap: 20px;
}

.card-details_block {
min-height: 140px;
max-width: 450px;
}

.card-details__left-section {
Expand Down
Binary file modified static/img/KarlMarks.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/KarlMarks1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 38ca4c8

Please sign in to comment.