Skip to content

Commit 3ae4f01

Browse files
committed
feat: added logs component to page.
1 parent 8f0d4e2 commit 3ae4f01

File tree

6 files changed

+94
-69
lines changed

6 files changed

+94
-69
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.

infrastructure/control-panel/src/fragments/Logs/Logs.svelte renamed to infrastructure/control-panel/src/lib/fragments/Logs/Logs.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
...restProps
99
}: { events: LogEvent[]; activeEventIndex: number } = $props();
1010
11-
const commonClasses = 'w-full h-full bg-white';
11+
const commonClasses = 'w-full h-full rounded-md p-4 bg-white';
1212
const commonLogClasses =
1313
'flex cursor-pointer gap-2 rounded-md p-2 transition-colors hover:bg-gray-100';
1414
const activeLogClass = 'bg-gray-100';
File renamed without changes.
Lines changed: 93 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,100 @@
11
<script lang="ts">
2-
import { Table } from "$lib/ui";
3-
import { LiveDataFlow } from "../fragments";
2+
import { LiveDataFlow, Logs } from '$lib/fragments';
3+
import { Table } from '$lib/ui';
44
5-
const handlePreviousPage = async () => {
6-
alert('Previous btn clicked. Make a call to your server to fetch data.');
7-
};
8-
const handleNextPage = async () => {
9-
alert('Next btn clicked. Make a call to your server to fetch data.');
10-
};
11-
const tableHeadings = [
12-
'Image',
13-
'Material Name',
14-
'Description',
15-
'Product ID',
16-
'Smart Contract'
17-
// "Ledger Link",
18-
];
19-
const pages = [
20-
{ name: '1', href: '#' },
21-
{ name: '2', href: '#' },
22-
{ name: '3', href: '#' }
23-
];
24-
const tableData = [
25-
{
26-
image: 'https://example.com/image1.jpg',
27-
name: 'Material 1',
28-
description: 'Description of Material 1',
29-
productId: '12345',
30-
smartContract: '0x1234567890abcdef',
31-
ledgerLink: 'https://example.com/ledger1'
32-
},
33-
{
34-
image: 'https://example.com/image2.jpg',
35-
name: 'Material 2',
36-
description: 'Description of Material 2',
37-
productId: '67890',
38-
smartContract: '0xabcdef1234567890',
39-
ledgerLink: 'https://example.com/ledger2'
40-
}
41-
];
42-
43-
const mappedData = tableData.map((row) => {
44-
return {
45-
rowOne: {
46-
type: 'image',
47-
value: row.image
48-
},
49-
rowTwo: {
50-
type: 'text',
51-
value: row.name
5+
const handlePreviousPage = async () => {
6+
alert('Previous btn clicked. Make a call to your server to fetch data.');
7+
};
8+
const handleNextPage = async () => {
9+
alert('Next btn clicked. Make a call to your server to fetch data.');
10+
};
11+
const tableHeadings = [
12+
'Image',
13+
'Material Name',
14+
'Description',
15+
'Product ID',
16+
'Smart Contract'
17+
// "Ledger Link",
18+
];
19+
const pages = [
20+
{ name: '1', href: '#' },
21+
{ name: '2', href: '#' },
22+
{ name: '3', href: '#' }
23+
];
24+
const tableData = [
25+
{
26+
image: 'https://example.com/image1.jpg',
27+
name: 'Material 1',
28+
description: 'Description of Material 1',
29+
productId: '12345',
30+
smartContract: '0x1234567890abcdef',
31+
ledgerLink: 'https://example.com/ledger1'
5232
},
53-
rowThree: {
54-
type: 'text',
55-
value: row.description
33+
{
34+
image: 'https://example.com/image2.jpg',
35+
name: 'Material 2',
36+
description: 'Description of Material 2',
37+
productId: '67890',
38+
smartContract: '0xabcdef1234567890',
39+
ledgerLink: 'https://example.com/ledger2'
40+
}
41+
];
42+
43+
const mappedData = tableData.map((row) => {
44+
return {
45+
rowOne: {
46+
type: 'image',
47+
value: row.image
48+
},
49+
rowTwo: {
50+
type: 'text',
51+
value: row.name
52+
},
53+
rowThree: {
54+
type: 'text',
55+
value: row.description
56+
},
57+
rowFour: {
58+
type: 'text',
59+
value: row.productId
60+
},
61+
rowFive: {
62+
type: 'text',
63+
value: row.smartContract
64+
}
65+
// rowSix: {
66+
// type: "snippet",
67+
// snippet: BadgeCell,
68+
// value:
69+
// row.ledgerLink,
70+
// },
71+
};
72+
});
73+
74+
let currentSelectedEventIndex = $state(-1);
75+
76+
const events = [
77+
{
78+
timestamp: new Date(),
79+
action: 'upload',
80+
message: 'msg_123',
81+
to: 'alice.vault.dev'
5682
},
57-
rowFour: {
58-
type: 'text',
59-
value: row.productId
83+
{
84+
timestamp: new Date(),
85+
action: 'fetch',
86+
message: 'msg_124',
87+
from: 'bob.vault.dev'
6088
},
61-
rowFive: {
62-
type: 'text',
63-
value: row.smartContract
89+
{
90+
timestamp: new Date(),
91+
action: 'webhook',
92+
to: 'Alice',
93+
from: 'Pic'
6494
}
65-
// rowSix: {
66-
// type: "snippet",
67-
// snippet: BadgeCell,
68-
// value:
69-
// row.ledgerLink,
70-
// },
71-
};
72-
});
95+
];
7396
</script>
7497

75-
7698
<!-- <section>
7799
<Table
78100
class="mb-7"
@@ -90,4 +112,7 @@ const mappedData = tableData.map((row) => {
90112
/>
91113
</section> -->
92114

93-
<LiveDataFlow/>
115+
<section class="flex gap-2">
116+
<LiveDataFlow />
117+
<Logs class="w-[40%]" {events} bind:activeEventIndex={currentSelectedEventIndex} />
118+
</section>

0 commit comments

Comments
 (0)