Skip to content

Commit

Permalink
Мелкие доработки
Browse files Browse the repository at this point in the history
  • Loading branch information
DeDxYk594 committed Dec 10, 2024
1 parent 1cab3fd commit d533001
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 29 deletions.
7 changes: 1 addition & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@ services:
dockerfile: ./Dockerfile
networks:
- Pumpkin-network
volumes:
- pumpkin-user-uploads:/usr/share/nginx/html/uploads
volumes:
pumpkin-user-uploads:

networks:
Pumpkin-network:
external:
name: Pumpkin-network
external: true
4 changes: 2 additions & 2 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ server {

# MIME-типы будут правильно определены автоматически
location /static/ {
root /static;
try_files /static /static/ =404;
alias /usr/share/nginx/html/static/;
try_files $uri $uri/ =404;
}

location ~* ^/(main\.js|runtime\.js|main\.css|.*\.ttf|sw\.js)$ {
Expand Down
21 changes: 14 additions & 7 deletions src/api/columnsCards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,18 @@ export const updateColumn = async (
export const createColumn = async (
boardId: number,
columnData: ColumnRequest
): Promise<BoardColumn> => {
): Promise<BoardColumn | undefined> => {
try {
const response = await apiPost(`/columns/board_${boardId}`, columnData);
if (response.status === HTTP_STATUS_CREATED) {
return response.body as BoardColumn;
} else {
handleErrorResponse(response.status, response.body.text);
switch (response.status) {
case HTTP_STATUS_CREATED:
case HTTP_STATUS_OK:
showToast('Успешно создана колонка', 'success');
return response.body as BoardColumn;

default:
handleErrorResponse(response.status, response.body.text);
return undefined;
}
} catch (error) {
console.error(error);
Expand All @@ -77,7 +82,7 @@ export const createColumn = async (
export const createCard = async (
boardId: number,
data: CardRequest
): Promise<Card> => {
): Promise<Card | undefined> => {
try {
const response = await apiPost(`/cards/board_${boardId}`, data);
switch (response.status) {
Expand All @@ -87,6 +92,7 @@ export const createCard = async (
return decodeCard(response.body as CardResponse);
default:
handleErrorResponse(response.status, response.body.text);
return undefined;
}
} catch (error) {
showToast('Произошла ошибка при создании карточки.', 'error');
Expand All @@ -98,7 +104,7 @@ export const createCard = async (
export const updateCard = async (
cardId: number,
data: CardPatchRequest
): Promise<Card> => {
): Promise<Card | undefined> => {
try {
const response = await apiPatch(`/cards/card_${cardId}`, data);
switch (response.status) {
Expand All @@ -108,6 +114,7 @@ export const updateCard = async (
return decodeCard(response.body as CardResponse);
default:
handleErrorResponse(response.status, response.body.text);
return undefined;
}
} catch (error) {
showToast('Произошла ошибка при изменении карточки.', 'error');
Expand Down
6 changes: 4 additions & 2 deletions src/components/KanbanColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ export const KanbanColumn = (props: KanbanColumnProps) => {
title: newText,
columnId: props.columnId,
}).then((newCard) => {
activeBoard.columns[props.columnIndex].cards.push(newCard);
setIsInputOpened(false);
if (newCard !== undefined) {
activeBoard.columns[props.columnIndex].cards.push(newCard);
setIsInputOpened(false);
}
});
};
useEffectRefs((refs) => {
Expand Down
26 changes: 18 additions & 8 deletions src/components/kanbanCard.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.kanban-card {
border-radius: 8px;
min-height: 32px;
background-color: white;
padding: 4px 6px;
display: flex;
Expand All @@ -11,35 +12,44 @@
box-shadow: 0px 1px 1px #091e4240, 0px 0px 1px #091e424f,
0px 1px 1px #091e4240, 0px 0px 1px #091e424f; // Позаимствовали у Trello
}

@media screen and (max-width: 800px) {
.kanban-card {
padding-right: 15px;
}
}

.kanban-card__cover {
max-width: 100%;
max-height: 150px;
}

.kanban-card__delete-button {
position: absolute;
top: 2px;
right: 2px;
width: 18px;
height: 18px;
background-color: #eee;
color: var(--color-negative);
border-radius: 2px;
width: 32px;
right: 0;
top: 0;
height: 32px;
border-radius: 9px;
cursor: pointer;
box-shadow: -2px 2px 10px 4px rgba(40, 40, 40, 0.3);
transition: background-color 0.3s ease;
backdrop-filter: blur(10px);
}

.kanban-card__delete-button:hover {
background-color: rgba(0, 0, 0, 0.1);
}

@media screen and (min-width: 800px) {
.kanban-card__delete-button {
opacity: 0;
}
}

.kanban-card:hover .kanban-card__delete-button {
opacity: 100;
}

.kanban-card__title {
user-select: none;
cursor: text;
Expand Down
10 changes: 6 additions & 4 deletions src/containers/KanbanBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ const NewColumnButton = () => {
return;
}
createColumn(activeBoardStore.id, { title: value }).then((newColumn) => {
newColumn.cards = [];
activeBoardStore.columns.push(newColumn);
setActiveBoardStore(activeBoardStore);
setNewColumnName('');
if (newColumn !== undefined) {
newColumn.cards = [];
activeBoardStore.columns.push(newColumn);
setActiveBoardStore(activeBoardStore);
setNewColumnName('');
}
});
setIsOpened(false);
};
Expand Down

0 comments on commit d533001

Please sign in to comment.