'use client'; import { useQuery } from '@tanstack/react-query'; import { useTRPC } from '@/trpc/utils'; const TITLE_TEXT = ` ███████╗ █████╗ ███████╗████████╗ ██╔════╝██╔══██╗██╔════╝╚══██╔══╝ █████╗ ███████║███████╗ ██║ ██╔══╝ ██╔══██║╚════██║ ██║ ██║ ██║ ██║███████║ ██║ ╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ███████╗████████╗ █████╗ ██████╗██╗ ██╗ ██╔════╝╚══██╔══╝██╔══██╗██╔════╝██║ ██╔╝ ███████╗ ██║ ███████║██║ █████╔╝ ╚════██║ ██║ ██╔══██║██║ ██╔═██╗ ███████║ ██║ ██║ ██║╚██████╗██║ ██╗ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝`; const BACKEND_URL = process.env.NEXT_PUBLIC_BACKEND_URL ?? 'http://localhost:8000'; const APP_NAME = '{{baseName}}'; export default function Home() { const trpc = useTRPC(); const { data, isPending, error } = useQuery(trpc.health.check.queryOptions()); const status = isPending ? 'CHECKING...' : data ? 'CONNECTED' : 'DISCONNECTED'; const statusColor = isPending ? 'text-yellow-400' : data ? 'text-green-400' : 'text-red-400'; return (
          {TITLE_TEXT}
        
          {[
            '+--------------------------------------+',
            `|  STATUS: ${status.padEnd(27)} |`,
            `|  HOST:   ${BACKEND_URL.padEnd(27)} |`,
            `|  APP:    ${APP_NAME.padEnd(27)} |`,
            ...(error
              ? [`|  ERROR:  ${'Connection refused'.padEnd(27)} |`]
              : []),
            '+--------------------------------------+',
          ].join('\n')}
        
); }