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