- Clear stage (progress update), moving branches to verify some outputs.
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -3,7 +3,7 @@ import { useApolloClient } from "@apollo/client";
|
||||
import Board from "../../components/trello-board/index";
|
||||
import { Button, Grid, notification, Skeleton, Space, Statistic } from "antd";
|
||||
import { PageHeader } from "@ant-design/pro-layout";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import React, { useEffect, useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { Sticky, StickyContainer } from "react-sticky";
|
||||
@@ -71,14 +71,11 @@ export function ProductionBoardKanbanComponent({
|
||||
);
|
||||
|
||||
let idx = 0;
|
||||
const newCardIndexMappings = {};
|
||||
|
||||
// Build Board Lanes Data
|
||||
boardData.lanes = boardData.lanes.map((lane, laneIndex) => {
|
||||
const cardsWithIndex = lane.cards.map((card, cardIndex) => {
|
||||
const cardWithIndex = { ...card, idx, lane: lane.id, cardIndex, laneIndex };
|
||||
newCardIndexMappings[idx] = { laneIndex, cardIndex };
|
||||
|
||||
idx++;
|
||||
return cardWithIndex;
|
||||
});
|
||||
@@ -130,21 +127,10 @@ export function ProductionBoardKanbanComponent({
|
||||
const sourceLane = boardLanes.lanes[Number.parseInt(source.droppableId)];
|
||||
const sourceCard = getCardByID(boardLanes, draggableId);
|
||||
|
||||
console.dir({
|
||||
sameColumnTransfer,
|
||||
targetLane,
|
||||
sourceLane,
|
||||
sourceCard,
|
||||
destination
|
||||
});
|
||||
|
||||
const movedCardWillBeFirst = destination.index === 0;
|
||||
const movedCardWillBeLast = destination.index > targetLane.cards.length - 1;
|
||||
const movedCardIsFirstNewCard = movedCardWillBeFirst && movedCardWillBeLast;
|
||||
|
||||
console.log("movedCardWillBeFirst, movedCardWillBeLast");
|
||||
console.dir({ movedCardWillBeFirst, movedCardWillBeLast, movedCardIsFirstNewCard });
|
||||
|
||||
const lastCardInTargetLane = targetLane.cards[targetLane.cards.length - 1];
|
||||
|
||||
const oldChildCard = sourceLane.cards[destination.index + 1];
|
||||
@@ -162,13 +148,6 @@ export function ProductionBoardKanbanComponent({
|
||||
|
||||
const oldChildCardNewParent = oldChildCard ? sourceCard.metadata.kanbanparent : null;
|
||||
|
||||
console.dir({
|
||||
lastCardInTargetLane,
|
||||
oldChildCard,
|
||||
newChildCard,
|
||||
oldChildCardNewParent
|
||||
});
|
||||
|
||||
let movedCardNewKanbanParent;
|
||||
if (movedCardWillBeFirst) {
|
||||
movedCardNewKanbanParent = "-1";
|
||||
@@ -217,14 +196,28 @@ export function ProductionBoardKanbanComponent({
|
||||
}
|
||||
};
|
||||
|
||||
const totalHrs = data
|
||||
.reduce(
|
||||
(acc, val) => acc + (val.labhrs?.aggregate?.sum?.mod_lb_hrs || 0) + (val.larhrs?.aggregate?.sum?.mod_lb_hrs || 0),
|
||||
0
|
||||
)
|
||||
.toFixed(1);
|
||||
const totalLAB = data.reduce((acc, val) => acc + (val.labhrs?.aggregate?.sum?.mod_lb_hrs || 0), 0).toFixed(1);
|
||||
const totalLAR = data.reduce((acc, val) => acc + (val.larhrs?.aggregate?.sum?.mod_lb_hrs || 0), 0).toFixed(1);
|
||||
const totalHrs = useMemo(
|
||||
() =>
|
||||
data
|
||||
.reduce(
|
||||
(acc, val) =>
|
||||
acc + (val.labhrs?.aggregate?.sum?.mod_lb_hrs || 0) + (val.larhrs?.aggregate?.sum?.mod_lb_hrs || 0),
|
||||
0
|
||||
)
|
||||
.toFixed(1),
|
||||
[data]
|
||||
);
|
||||
|
||||
const totalLAB = useMemo(
|
||||
() => data.reduce((acc, val) => acc + (val.labhrs?.aggregate?.sum?.mod_lb_hrs || 0), 0).toFixed(1),
|
||||
[data]
|
||||
);
|
||||
|
||||
const totalLAR = useMemo(
|
||||
() => data.reduce((acc, val) => acc + (val.larhrs?.aggregate?.sum?.mod_lb_hrs || 0), 0).toFixed(1),
|
||||
[data]
|
||||
);
|
||||
|
||||
const selectedBreakpoint = Object.entries(Grid.useBreakpoint())
|
||||
.filter((screen) => !!screen[1])
|
||||
.slice(-1)[0];
|
||||
@@ -353,7 +346,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(ProductionBoardKanba
|
||||
|
||||
const Container = styled.div`
|
||||
.react-trello-card-skeleton,
|
||||
.react-trel lo-card,
|
||||
.react-trello-card,
|
||||
.react-trello-card-adder-form {
|
||||
box-sizing: border-box;
|
||||
max-width: ${(props) => props.width}px;
|
||||
|
||||
Reference in New Issue
Block a user