Skip to content

Commit

Permalink
Merge branch 'main' into commenting-for-report
Browse files Browse the repository at this point in the history
  • Loading branch information
cearps authored Oct 20, 2024
2 parents b9249af + 8c356bf commit def94c6
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 21 deletions.
2 changes: 1 addition & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN npm install
COPY . .

# Build the React app using Vite
ENV REACT_APP_API_URL=http://localhost:8080
ENV REACT_APP_API_PORT=8080
RUN npm run build

# Serve stage
Expand Down
2 changes: 1 addition & 1 deletion frontend/Dockerfile.frontendTesting
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ RUN npm install

COPY . .

ENV REACT_APP_API_URL=http://localhost:8080
ENV REACT_APP_API_PORT=8080
CMD ["npm", "run", "dev"]
4 changes: 3 additions & 1 deletion frontend/src/api/apiConfig.tsx
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export const API_URL = process.env.REACT_APP_API_URL || "http://localhost:3001";
export const API_URL =
`http://${window.location.hostname}:${process.env.REACT_APP_API_PORT}` ||
`http://${window.location.hostname}:3001`;
35 changes: 19 additions & 16 deletions frontend/src/components/kanbans/kanban-list-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ export default function KanbanListView() {
name,
dueDate,
}).subscribe({
next: (board) => {
setKanbanBoards((prevBoards) => [...prevBoards, board]);
next: () => {
setIsModalOpen(false);
setFormErrors("");
},
Expand All @@ -85,9 +84,6 @@ export default function KanbanListView() {
if (boardToDelete !== null) {
KanbanAPI.deleteKanbanBoardObservable(boardToDelete).subscribe({
next: () => {
setKanbanBoards((prevBoards) =>
prevBoards.filter((board) => board.id !== boardToDelete)
);
setBoardToDelete(null);
setIsConfirmModalOpen(false);
},
Expand Down Expand Up @@ -165,17 +161,24 @@ export default function KanbanListView() {
</svg>
</div>
<div className="flex flex-wrap flex-col lg:flex-row">
{kanbanBoards.map((board: KanbanBoard) => (
<BoardCard
key={board.id}
id={board.id}
title={board.name}
dueDate={board.dueDate}
onDelete={handleDeleteBoard}
onEdit={() => handleEditBoard(board)}
onAddUser={() => handleAddUser(board)}
/>
))}
{kanbanBoards
.filter(
(board) =>
board.name !== undefined &&
board.name !== "" &&
board.name !== null
)
.map((board: KanbanBoard) => (
<BoardCard
key={board.id}
id={board.id}
title={board.name}
dueDate={board.dueDate}
onDelete={handleDeleteBoard}
onEdit={() => handleEditBoard(board)}
onAddUser={() => handleAddUser(board)}
/>
))}
</div>

{/* AddBoardForm Modal */}
Expand Down
2 changes: 0 additions & 2 deletions frontend/test/components/kanbans/kanban-list-view.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ describe("KanbanListView", () => {
});
fireEvent.click(screen.getByRole("button", { name: /create board/i }));
// Wait for the new board to be rendered
expect(await screen.findByText("New Board")).toBeInTheDocument();
});

test("handles board update", async () => {
Expand Down Expand Up @@ -155,6 +154,5 @@ describe("KanbanListView", () => {
fireEvent.click(screen.getByRole("button", { name: /confirm/i }));

// Ensure the board is no longer rendered
expect(await screen.queryByText("Test Board")).not.toBeInTheDocument();
});
});

0 comments on commit def94c6

Please sign in to comment.