@@ -3,8 +3,32 @@ import { Link } from 'react-router-dom';
33import { Button } from '@oasisprotocol/ui-library/src/components/ui/button' ;
44import { DetailsSectionRow } from '../../../components/DetailsSectionRow' ;
55import { SquarePen } from 'lucide-react' ;
6+ import {
7+ useGetRuntimeRoflAppsIdTransactions ,
8+ type RoflApp ,
9+ } from '../../../nexus/api' ;
10+ import { useNetwork } from '../../../hooks/useNetwork' ;
11+ import { isUrlSafe } from '../../../utils/url' ;
12+ import { trimLongString } from '../../../utils/trimLongString' ;
13+
14+ type AppMetadataProps = {
15+ app : RoflApp ;
16+ } ;
17+
18+ export const AppMetadata : FC < AppMetadataProps > = ( { app } ) => {
19+ const network = useNetwork ( ) ;
20+ const { data } = useGetRuntimeRoflAppsIdTransactions (
21+ network ,
22+ 'sapphire' ,
23+ app . id ,
24+ {
25+ limit : 1 ,
26+ method : 'rofl.Update' ,
27+ }
28+ ) ;
29+ const transaction = data ?. data . transactions [ 0 ] ;
30+ const repositoryUrl = app . metadata ?. [ 'net.oasis.rofl.repository' ] as string ;
631
7- export const AppMetadata : FC = ( ) => {
832 return (
933 < div className = "space-y-4" >
1034 < DetailsSectionRow label = "Machine(s)" >
@@ -17,12 +41,12 @@ export const AppMetadata: FC = () => {
1741 </ DetailsSectionRow >
1842 < DetailsSectionRow label = "Explorer Link" className = "pb-6 border-b" >
1943 < a
20- href = " https://explorer.oasis.io/mainnet /sapphire/rofl/app/rofl1qpdzzm4h73gtes04xjn4whan84s3k33l5gx787l2"
44+ href = { ` https://explorer.oasis.io/${ network } /sapphire/rofl/app/${ app . id } ` }
2145 target = "_blank"
2246 rel = "noopener noreferrer"
2347 className = "text-primary"
2448 >
25- rofl1qpdzzm4h73gtes04xjn4whan84s3k33l5gx787l2
49+ { app . id }
2650 </ a >
2751 </ DetailsSectionRow >
2852 < Button
@@ -34,47 +58,47 @@ export const AppMetadata: FC = () => {
3458 Edit
3559 </ Button >
3660 < DetailsSectionRow label = "Author" >
37- < a
38- href = "https://explorer.oasis.io/mainnet/sapphire/address/0x1441b57bD02E92473c89733D00881e859Eff6508"
39- target = "_blank"
40- rel = "noopener noreferrer"
41- className = "text-primary"
42- >
43- 0x1441b57bD02E92473c89733D00881e859Eff6508
44- </ a >
61+ < > { app . metadata ?. [ 'net.oasis.rofl.author' ] } </ >
4562 </ DetailsSectionRow >
4663 < DetailsSectionRow label = "Description" >
47- Ac vel nullam elit facilisis justo dictum non metus a. Dictum quisque
48- condimentum duis sit amet ac. Pharetra amet sed ornare id nunc vivamus
49- habitant enim in. Sed lorem scelerisque sed purus eleifend diam.
50- </ DetailsSectionRow >
51- < DetailsSectionRow label = "Homepage" >
52- < a
53- href = "https://www.wt3.ai"
54- target = "_blank"
55- rel = "noopener noreferrer"
56- className = "text-primary"
57- >
58- www.wt3.ai
59- </ a >
64+ < > { app . metadata ?. [ 'net.oasis.rofl.description' ] } </ >
6065 </ DetailsSectionRow >
6166 < DetailsSectionRow label = "Repository" >
62- < a
63- href = "https://github.com/oasisprotocol"
64- target = "_blank"
65- rel = "noopener noreferrer"
66- className = "text-primary"
67- >
68- https://github.com/oasisprotocol
69- </ a >
67+ { isUrlSafe ( repositoryUrl ) ? (
68+ < a
69+ href = { repositoryUrl }
70+ target = "_blank"
71+ rel = "noopener noreferrer"
72+ className = "text-primary"
73+ >
74+ { repositoryUrl }
75+ </ a >
76+ ) : undefined }
7077 </ DetailsSectionRow >
7178 < DetailsSectionRow label = "License" className = " pb-6 border-b" >
72- Apache-2.0
79+ < > { app . metadata ?. [ 'net.oasis.rofl.license' ] } </ >
7380 </ DetailsSectionRow >
7481 < div className = "text-xl font-bold" > Policy</ div >
75- < DetailsSectionRow label = "Who can run this app" > Anyone </ DetailsSectionRow >
82+ < DetailsSectionRow label = "Who can run this app" > - </ DetailsSectionRow >
7683 < DetailsSectionRow label = "Latest Update" className = " pb-6 border-b" >
77- May 14, 2025
84+ { transaction && (
85+ < >
86+ { new Intl . DateTimeFormat ( 'en-US' , {
87+ year : 'numeric' ,
88+ month : 'long' ,
89+ day : 'numeric' ,
90+ } ) . format ( new Date ( transaction ?. timestamp ) ) }
91+ < br />
92+ < a
93+ href = { `https://explorer.oasis.io/mainnet/sapphire/tx/${ transaction . hash } ` }
94+ target = "_blank"
95+ rel = "noopener noreferrer"
96+ className = "text-primary"
97+ >
98+ { trimLongString ( transaction . eth_hash || transaction . hash ) }
99+ </ a >
100+ </ >
101+ ) }
78102 </ DetailsSectionRow >
79103 </ div >
80104 ) ;
0 commit comments