Skip to content

Commit 3a44bd7

Browse files
committed
Checkpoint before follow-up message
1 parent ccc3837 commit 3a44bd7

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/transactions/tx/[id]/transaction-details-ui.tsx

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -392,27 +392,30 @@ function ActivityLogCard({
392392
);
393393
}
394394

395-
// Sort logs chronologically using for...of loop (insertion sort)
395+
// Sort logs chronologically using for...of loop (manual sorting)
396396
const sortedLogs: ActivityLogEntry[] = [];
397397

398+
// Copy all logs to sortedLogs first
398399
for (const log of activityLogs) {
399-
let inserted = false;
400-
let insertIndex = 0;
400+
sortedLogs[sortedLogs.length] = log;
401+
}
402+
403+
// Manual bubble sort using for...of loops
404+
for (let i = 0; i < sortedLogs.length; i++) {
405+
for (let j = 0; j < sortedLogs.length - 1 - i; j++) {
406+
const currentLog = sortedLogs[j];
407+
const nextLog = sortedLogs[j + 1];
401408

402-
for (const sortedLog of sortedLogs) {
403409
if (
404-
new Date(log.createdAt).getTime() <=
405-
new Date(sortedLog.createdAt).getTime()
410+
currentLog &&
411+
nextLog &&
412+
new Date(currentLog.createdAt).getTime() >
413+
new Date(nextLog.createdAt).getTime()
406414
) {
407-
sortedLogs.splice(insertIndex, 0, log);
408-
inserted = true;
409-
break;
415+
// Swap elements
416+
sortedLogs[j] = nextLog;
417+
sortedLogs[j + 1] = currentLog;
410418
}
411-
insertIndex++;
412-
}
413-
414-
if (!inserted) {
415-
sortedLogs.push(log);
416419
}
417420
}
418421

0 commit comments

Comments
 (0)