some more slight improvements to exam changes logs
This commit is contained in:
@@ -386,7 +386,7 @@ export default function Home({ user, initialWorkflow, id, workflowAssignees, wor
|
|||||||
{/* Side panel */}
|
{/* Side panel */}
|
||||||
<AnimatePresence mode="wait">
|
<AnimatePresence mode="wait">
|
||||||
<LayoutGroup key="sidePanel">
|
<LayoutGroup key="sidePanel">
|
||||||
<section className={`absolute inset-y-0 right-0 h-full bg-mti-purple-ultralight bg-opacity-50 shadow-xl shadow-mti-purple transition-all duration-300 overflow-hidden ${isPanelOpen ? 'w-[500px]' : 'w-0'}`}>
|
<section className={`absolute inset-y-0 right-0 h-full overflow-y-auto bg-mti-purple-ultralight bg-opacity-50 shadow-xl shadow-mti-purple transition-all duration-300 overflow-hidden ${isPanelOpen ? 'w-[500px]' : 'w-0'}`}>
|
||||||
{isPanelOpen && selectedStep && (
|
{isPanelOpen && selectedStep && (
|
||||||
<motion.div
|
<motion.div
|
||||||
className="p-6"
|
className="p-6"
|
||||||
@@ -551,12 +551,16 @@ export default function Home({ user, initialWorkflow, id, workflowAssignees, wor
|
|||||||
transition={{ duration: 0.3 }}
|
transition={{ duration: 0.3 }}
|
||||||
className="overflow-hidden mt-2"
|
className="overflow-hidden mt-2"
|
||||||
>
|
>
|
||||||
<div className="p-3 border border-gray-300 rounded-xl bg-white bg-opacity-80 overflow-y-auto max-h-40">
|
<div className="p-3 border border-gray-300 rounded-xl bg-white bg-opacity-80 overflow-y-auto max-h-[300px]">
|
||||||
{currentWorkflow.steps[selectedStepIndex].examChanges?.length ? (
|
{currentWorkflow.steps[selectedStepIndex].examChanges?.length ? (
|
||||||
currentWorkflow.steps[selectedStepIndex].examChanges!.map((change, index) => (
|
currentWorkflow.steps[selectedStepIndex].examChanges!.map((change, index) => (
|
||||||
|
<>
|
||||||
<p key={index} className="whitespace-pre-wrap text-sm text-gray-500 mb-2">
|
<p key={index} className="whitespace-pre-wrap text-sm text-gray-500 mb-2">
|
||||||
{change}
|
<span className="text-mti-purple-light text-lg">{change.charAt(0)}</span>
|
||||||
|
{change.slice(1)}
|
||||||
</p>
|
</p>
|
||||||
|
<hr className="my-3 h-[3px] bg-mti-purple-light rounded-full w-full" />
|
||||||
|
</>
|
||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
<p className="text-normal text-opacity-70 text-gray-500">No changes made so far.</p>
|
<p className="text-normal text-opacity-70 text-gray-500">No changes made so far.</p>
|
||||||
@@ -573,7 +577,7 @@ export default function Home({ user, initialWorkflow, id, workflowAssignees, wor
|
|||||||
value={comments}
|
value={comments}
|
||||||
onChange={(e) => setComments(e.target.value)}
|
onChange={(e) => setComments(e.target.value)}
|
||||||
placeholder="Input comments here"
|
placeholder="Input comments here"
|
||||||
className="w-full h-40 p-2 border-2 rounded-xl shadow-lg focus:border-mti-purple focus:outline-none mt-3 resize-none"
|
className="w-full h-[200px] p-2 border-2 rounded-xl shadow-lg focus:border-mti-purple focus:outline-none mt-3 resize-none"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -129,7 +129,6 @@ function compareObjects(oldObj: any, newObj: any, path: (string | number)[], dif
|
|||||||
}
|
}
|
||||||
|
|
||||||
const oldIndexMap = new Map(oldObj.map((item: any, index: number) => [getIdentifier(item), index]));
|
const oldIndexMap = new Map(oldObj.map((item: any, index: number) => [getIdentifier(item), index]));
|
||||||
let reorderDetected = false;
|
|
||||||
// Process items in the new array using their order.
|
// Process items in the new array using their order.
|
||||||
for (let i = 0; i < newObj.length; i++) {
|
for (let i = 0; i < newObj.length; i++) {
|
||||||
const newItem = newObj[i];
|
const newItem = newObj[i];
|
||||||
@@ -138,9 +137,6 @@ function compareObjects(oldObj: any, newObj: any, path: (string | number)[], dif
|
|||||||
if (oldIndexMap.has(identifier)) {
|
if (oldIndexMap.has(identifier)) {
|
||||||
const oldIndex = oldIndexMap.get(identifier)!;
|
const oldIndex = oldIndexMap.get(identifier)!;
|
||||||
const oldItem = oldObj[oldIndex];
|
const oldItem = oldObj[oldIndex];
|
||||||
if (oldIndex !== i) {
|
|
||||||
reorderDetected = true;
|
|
||||||
}
|
|
||||||
compareObjects(oldItem, newItem, path.concat(`#${i + 1}`), differences);
|
compareObjects(oldItem, newItem, path.concat(`#${i + 1}`), differences);
|
||||||
} else {
|
} else {
|
||||||
differences.push(`• Added new ${getArrayItemLabel(path)} #${i + 1} at ${pathToHumanReadable(path)}\n`);
|
differences.push(`• Added new ${getArrayItemLabel(path)} #${i + 1} at ${pathToHumanReadable(path)}\n`);
|
||||||
@@ -150,9 +146,6 @@ function compareObjects(oldObj: any, newObj: any, path: (string | number)[], dif
|
|||||||
compareObjects(oldObj[i], newItem, path.concat(`#${i + 1}`), differences);
|
compareObjects(oldObj[i], newItem, path.concat(`#${i + 1}`), differences);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (reorderDetected) {
|
|
||||||
differences.push(`• Reordered Items at ${pathToHumanReadable(path)}\n`);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// For arrays that are not identifier-based, compare element by element.
|
// For arrays that are not identifier-based, compare element by element.
|
||||||
const maxLength = Math.max(oldObj.length, newObj.length);
|
const maxLength = Math.max(oldObj.length, newObj.length);
|
||||||
|
|||||||
Reference in New Issue
Block a user