@@ -15,7 +15,7 @@ import {
1515 revokeAccessToken ,
1616} from "@thirdweb-dev/vault-sdk" ;
1717import { createVaultClient } from "@thirdweb-dev/vault-sdk" ;
18- import { Loader2 , Trash2 } from "lucide-react" ;
18+ import { Loader2 , LockIcon , Trash2 } from "lucide-react" ;
1919import { useState } from "react" ;
2020import { toast } from "sonner" ;
2121import { CopyTextButton } from "../../../../../../../@/components/ui/CopyTextButton" ;
@@ -30,6 +30,7 @@ import {
3030 CheckboxWithLabel ,
3131} from "../../../../../../../@/components/ui/checkbox" ;
3232import { THIRDWEB_VAULT_URL } from "../../../../../../../@/constants/env" ;
33+ import { toDateTimeLocal } from "../../../../../../../utils/date-utils" ;
3334import {
3435 SERVER_WALLET_ACCESS_TOKEN_PURPOSE ,
3536 SERVER_WALLET_MANAGEMENT_ACCESS_TOKEN_PURPOSE ,
@@ -230,7 +231,7 @@ export default function ListAccessTokensButton(props: {
230231 toast . error ( error . message ) ;
231232 } ,
232233 onSuccess : ( data ) => {
233- setNewAccessToken ( data . userAccessToken . id ) ;
234+ setNewAccessToken ( data . userAccessToken . accessToken ) ;
234235 listAccessTokensQuery . refetch ( ) ;
235236 } ,
236237 } ) ;
@@ -303,11 +304,7 @@ export default function ListAccessTokensButton(props: {
303304 t . metadata ?. purpose ?. toString ( ) !==
304305 SERVER_WALLET_MANAGEMENT_ACCESS_TOKEN_PURPOSE ,
305306 )
306- . map ( ( t ) => ( {
307- key : t . metadata ?. purpose ?. toString ( ) ?? t . id ,
308- id : t . id ,
309- policies : t . policies || [ ] ,
310- } ) ) ,
307+ . filter ( ( t ) => ! t . revokedAt ) ,
311308 } ;
312309 // Return stub data for now
313310 } ,
@@ -379,11 +376,14 @@ export default function ListAccessTokensButton(props: {
379376 </ div >
380377 < div className = "flex justify-end gap-3 border-t bg-card px-6 py-4" >
381378 < Button
382- onClick = { handleCloseModal }
379+ onClick = { ( ) => {
380+ setNewAccessToken ( null ) ;
381+ setKeysConfirmed ( false ) ;
382+ } }
383383 disabled = { ! keysConfirmed }
384384 variant = { "primary" }
385385 >
386- Close
386+ Go Back
387387 </ Button >
388388 </ div >
389389 </ div >
@@ -400,15 +400,26 @@ export default function ListAccessTokensButton(props: {
400400 < div className = "flex flex-col gap-2" >
401401 { listAccessTokensQuery . data . accessTokens . map ( ( token ) => (
402402 < div key = { token . id } className = "flex gap-2" >
403- < div className = "flex-1 justify-between rounded-lg border border-border bg-background px-3 py-3 font-mono text-xs" >
404- < h4 className = "pb-4 font-bold" > { token . key } </ h4 >
403+ < div className = "flex flex-1 flex-col justify-between gap-4 rounded-lg border border-border bg-background px-3 py-3 text-xs" >
404+ < h4 className = "font-bold" >
405+ { token . metadata ?. purpose ||
406+ "Unnamed Access Token" }
407+ </ h4 >
405408 < div className = "flex flex-row flex-wrap gap-2" >
406409 { token . policies . map ( ( policy ) => (
407- < Badge key = { policy . type } variant = { "outline" } >
410+ < Badge
411+ key = { policy . type }
412+ variant = { "outline" }
413+ className = "font-mono"
414+ >
408415 { policy . type }
409416 </ Badge >
410417 ) ) }
411418 </ div >
419+ < p className = "text-muted-foreground text-xs" >
420+ Created on:{ " " }
421+ { toDateTimeLocal ( new Date ( token . createdAt ) ) }
422+ </ p >
412423 </ div >
413424 < Button
414425 variant = "destructive"
@@ -463,8 +474,9 @@ export default function ListAccessTokensButton(props: {
463474 ) : (
464475 < div className = "px-6 pb-6" >
465476 < div className = "flex flex-col gap-4" >
466- < p className = "text-sm text-warning-text" >
467- 🔐 This action requires your Vault admin key.
477+ < p className = "flex items-center gap-2 text-sm text-warning-text" >
478+ < LockIcon className = "h-4 w-4" /> This action requires your
479+ Vault admin key.
468480 </ p >
469481 < Input
470482 type = "password"
0 commit comments