1- import { Alert , AlertDescription , AlertIcon , AlertTitle , Button , HStack , SimpleGrid , Spinner , Stack , Stat , StatHelpText , StatLabel , Table , TableContainer , Tbody , Td , Text , Tr , VStack } from '@chakra-ui/react' ;
2- import type { ActionFunction , LoaderFunction } from '@remix-run/node' ;
1+ import {
2+ Alert ,
3+ AlertDescription ,
4+ AlertIcon ,
5+ AlertTitle ,
6+ Button ,
7+ SimpleGrid ,
8+ Table ,
9+ TableContainer ,
10+ Tbody ,
11+ Td ,
12+ Text ,
13+ Tr ,
14+ VStack ,
15+ } from '@chakra-ui/react' ;
16+ import type { ActionFunction , LoaderFunction , MetaFunction } from '@remix-run/node' ;
317import { json } from '@remix-run/node' ;
4- import { Form , useActionData , useLoaderData , useSearchParams , useTransition } from '@remix-run/react' ;
18+ import { Form , useActionData , useLoaderData , useLocation , useSearchParams , useTransition } from '@remix-run/react' ;
519import invariant from 'tiny-invariant' ;
620
721import { FormView } from '../../components/forms/FormView' ;
@@ -54,6 +68,12 @@ export const action: ActionFunction = async ({ request, params, context }) => {
5468 return json < LoaderData > ( { action, ...response } ) ;
5569} ;
5670
71+ export const meta : MetaFunction < LoaderData > = ( { data } ) => {
72+ return {
73+ title : `${ data . action . title } | Actions` ,
74+ } ;
75+ } ;
76+
5777export default function WorkflowDetailsPage ( ) {
5878 const { view, workflowId, breadcrumbs, action } = useLoaderData ( ) as LoaderData ;
5979 const [ search ] = useSearchParams ( ) ;
@@ -66,32 +86,34 @@ export default function WorkflowDetailsPage() {
6686 const loading = transition . state === 'loading' || transition . state === 'submitting' ;
6787
6888 return (
69- < Page title = { [ 'Actions' , action . title , `Workflow ${ workflowId . slice ( 0 , 8 ) } ` ] } >
89+ < Page title = { [ 'Actions' , action . title , `Workflow ${ workflowId . slice ( 0 , 8 ) } ` ] } animationKey = { useLocation ( ) . key } >
7090 < SimpleGrid columns = { 2 } spacing = { 10 } >
7191 < Form method = "post" >
7292 < VStack alignItems = "flex-start" spacing = { 6 } >
73- { loading && < Spinner size = 'lg' /> }
74- { ! loading && < FormView name = { ROOT } view = { currentView } /> }
75- { hasNext && ! loading && (
76- < Button colorScheme = "teal" variant = "solid" type = "submit" >
93+ < FormView name = { ROOT } view = { currentView } />
94+ { hasNext && (
95+ < Button isLoading = { loading } colorScheme = "teal" variant = "solid" type = "submit" >
7796 Submit
7897 </ Button >
7998 ) }
8099 </ VStack >
81100 </ Form >
82101 < VStack alignItems = "flex-end" spacing = { 6 } >
83- < TableContainer backgroundColor = "white" boxShadow = 'sm' border = "1px solid" borderColor = 'gray.200' borderRadius = 'md' >
84- < Table variant = 'simple' >
102+ < TableContainer
103+ backgroundColor = "white"
104+ boxShadow = "sm"
105+ border = "1px solid"
106+ borderColor = "gray.200"
107+ borderRadius = "md"
108+ >
109+ < Table variant = "simple" >
85110 < Tbody >
86111 { breadcrumbs . map ( ( breadcrumb , idx ) => (
87112 < Tr key = { `${ breadcrumb . key } -${ idx } ` } >
88- < Td >
89- < Text fontWeight = { 600 } >
90- { breadcrumb . key }
91- </ Text >
92- </ Td >
93- < Td > { breadcrumb . value }
113+ < Td >
114+ < Text fontWeight = { 600 } > { breadcrumb . key } </ Text >
94115 </ Td >
116+ < Td > { breadcrumb . value } </ Td >
95117 </ Tr >
96118 ) ) }
97119 </ Tbody >
@@ -101,7 +123,9 @@ export default function WorkflowDetailsPage() {
101123 < Alert status = "info" flexDirection = "column" alignSelf = "flex-start" >
102124 < AlertIcon />
103125 < AlertTitle > Debug</ AlertTitle >
104- < AlertDescription sx = { { whiteSpace : 'pre' } } > { JSON . stringify ( { view, workflowId, breadcrumbs } , null , 2 ) } </ AlertDescription >
126+ < AlertDescription sx = { { whiteSpace : 'pre' } } >
127+ { JSON . stringify ( { view, workflowId, breadcrumbs } , null , 2 ) }
128+ </ AlertDescription >
105129 </ Alert >
106130 ) }
107131 </ VStack >
0 commit comments