({ children })
| 8 | } |
| 9 | |
| 10 | const SetupWrapper: React.FC<SetupWrapperProps> = ({ children }) => { |
| 11 | const { setupStatus, loading, error, refetch } = useSetup(); |
| 12 | |
| 13 | if (loading) { |
| 14 | return ( |
| 15 | <Box |
| 16 | display="flex" |
| 17 | alignItems="center" |
| 18 | justifyContent="center" |
| 19 | minHeight="100vh" |
| 20 | backgroundColor="#f5f5f5" |
| 21 | > |
| 22 | <Text fontSize="18px" color="#666"> |
| 23 | Checking setup status... |
| 24 | </Text> |
| 25 | </Box> |
| 26 | ); |
| 27 | } |
| 28 | |
| 29 | if (error) { |
| 30 | return ( |
| 31 | <Box |
| 32 | display="flex" |
| 33 | alignItems="center" |
| 34 | justifyContent="center" |
| 35 | minHeight="100vh" |
| 36 | backgroundColor="#f5f5f5" |
| 37 | > |
| 38 | <Text fontSize="18px" color="#d32f2f"> |
| 39 | Error: {error} |
| 40 | </Text> |
| 41 | </Box> |
| 42 | ); |
| 43 | } |
| 44 | |
| 45 | // If setup is not completed (no users exist), show setup view |
| 46 | if (setupStatus === false) { |
| 47 | return <SetupView onUserCreated={refetch} />; |
| 48 | } |
| 49 | |
| 50 | // If setup is completed, show the normal app |
| 51 | return <>{children}</>; |
| 52 | }; |
| 53 | |
| 54 | export default SetupWrapper; |
nothing calls this directly
no test coverage detected