1
- import { Box , Container , Text , Grid , Heading , Link , Flex , Icon } from "@chakra-ui/react"
1
+ import { Box , Container , Text , Grid , Heading , Link , Flex , Icon , Badge } from "@chakra-ui/react"
2
2
import { createFileRoute } from "@tanstack/react-router"
3
3
import { FiDatabase , FiServer , FiMonitor , FiCpu , FiExternalLink } from "react-icons/fi"
4
4
import { useColorModeValue } from "@/components/ui/color-mode"
@@ -14,16 +14,18 @@ function Dashboard() {
14
14
const cardBg = useColorModeValue ( "white" , "gray.800" )
15
15
const borderColor = useColorModeValue ( "gray.200" , "gray.700" )
16
16
const statBg = useColorModeValue ( "blue.50" , "blue.900" )
17
+ const domain = import . meta. env . VITE_DOMAIN || 'localhost.nip.io'
18
+ const protocol = import . meta. env . VITE_USE_HTTPS === 'false' ? 'http' : 'https'
17
19
18
- // Deployment information from environment
20
+ // Deployment information from environment - updated format
19
21
const deploymentTools = [
20
- { name : "Admin Dashboard" , url : `https:// admin. ${ import . meta . env . VITE_DOMAIN || 'localhost.nip.io' } ` , description : "Admin management interface" } ,
21
- { name : "User Dashboard" , url : `https:// dashboard. ${ import . meta . env . VITE_DOMAIN || 'localhost.nip.io' } ` , description : "User-facing dashboard" } ,
22
- { name : "API Backend" , url : `https:// api. ${ import . meta . env . VITE_DOMAIN || 'localhost.nip.io' } ` , description : "Backend API server" } ,
23
- { name : "Adminer" , url : `https:// adminer. ${ import . meta . env . VITE_DOMAIN || 'localhost.nip.io' } ` , description : "Database management" } ,
24
- { name : "PG Admin" , url : `https:// pgadmin. ${ import . meta . env . VITE_DOMAIN || 'localhost.nip.io' } ` , description : "PostgreSQL administration" } ,
25
- { name : "LiteLLM" , url : `https:// llm. ${ import . meta . env . VITE_DOMAIN || 'localhost.nip.io' } ` , description : "LLM proxy service" } ,
26
- { name : "Prometheus" , url : `https:// prometheus. ${ import . meta . env . VITE_DOMAIN || 'localhost.nip.io' } ` , description : "Monitoring and metrics" } ,
22
+ { name : "Admin Dashboard" , subdomain : " admin" , description : "Admin management interface" } ,
23
+ { name : "User Dashboard" , subdomain : " dashboard" , description : "User-facing dashboard" } ,
24
+ { name : "API Backend" , subdomain : " api" , description : "Backend API server" } ,
25
+ { name : "Adminer" , subdomain : " adminer" , description : "Database management" } ,
26
+ { name : "PG Admin" , subdomain : " pgadmin" , description : "PostgreSQL administration" } ,
27
+ { name : "LiteLLM" , subdomain : " llm" , description : "LLM proxy service" } ,
28
+ { name : "Prometheus" , subdomain : " prometheus" , description : "Monitoring and metrics" } ,
27
29
]
28
30
29
31
// System information
@@ -75,38 +77,48 @@ function Dashboard() {
75
77
76
78
< Box h = "1px" bg = { borderColor } my = { 6 } />
77
79
78
- < Heading size = "md" mb = { 4 } > Project Deployment Resources</ Heading >
80
+ < Heading size = "md" mb = { 4 } >
81
+ Project Deployment Resources
82
+ < Badge ml = { 2 } colorScheme = { domain === 'localhost.nip.io' ? 'yellow' : 'green' } >
83
+ { domain === 'localhost.nip.io' ? 'Local' : 'Production' }
84
+ </ Badge >
85
+ </ Heading >
79
86
80
87
< Grid templateColumns = { { base : "repeat(1, 1fr)" , md : "repeat(2, 1fr)" , lg : "repeat(3, 1fr)" } } gap = { 4 } >
81
- { deploymentTools . map ( ( tool ) => (
82
- < Box
83
- key = { tool . name }
84
- p = { 4 }
85
- borderWidth = "1px"
86
- borderRadius = "lg"
87
- borderColor = { borderColor }
88
- bg = { cardBg }
89
- boxShadow = "sm"
90
- transition = "all 0.2s"
91
- _hover = { { transform : "translateY(-2px)" , boxShadow : "md" } }
92
- >
93
- < Heading size = "sm" mb = { 2 } > { tool . name } </ Heading >
94
- < Text fontSize = "sm" color = "gray.500" mb = { 3 } > { tool . description } </ Text >
95
- < Link
96
- href = { tool . url }
97
- target = "_blank"
98
- rel = "noopener noreferrer"
99
- color = "blue.500"
100
- fontSize = "sm"
101
- display = "flex"
102
- alignItems = "center"
103
- _hover = { { textDecoration : "underline" , color : "blue.600" } }
88
+ { deploymentTools . map ( ( tool ) => {
89
+ const url = `${ protocol } ://${ tool . subdomain } .${ domain } ` ;
90
+ return (
91
+ < Box
92
+ key = { tool . name }
93
+ p = { 4 }
94
+ borderWidth = "1px"
95
+ borderRadius = "lg"
96
+ borderColor = { borderColor }
97
+ bg = { cardBg }
98
+ boxShadow = "sm"
99
+ transition = "all 0.2s"
100
+ _hover = { { transform : "translateY(-2px)" , boxShadow : "md" } }
104
101
>
105
- { tool . url . replace ( / ^ h t t p s ? : \/ \/ / , '' ) }
106
- < Icon as = { FiExternalLink } ml = { 1 } />
107
- </ Link >
108
- </ Box >
109
- ) ) }
102
+ < Heading size = "sm" mb = { 2 } > { tool . name } </ Heading >
103
+ < Text fontSize = "sm" color = "gray.500" mb = { 3 } > { tool . description } </ Text >
104
+ < Box title = { url } >
105
+ < Link
106
+ href = { url }
107
+ target = "_blank"
108
+ rel = "noopener noreferrer"
109
+ color = "blue.500"
110
+ fontSize = "sm"
111
+ display = "flex"
112
+ alignItems = "center"
113
+ _hover = { { textDecoration : "underline" , color : "blue.600" } }
114
+ >
115
+ { tool . subdomain } .{ domain }
116
+ < Icon as = { FiExternalLink } ml = { 1 } />
117
+ </ Link >
118
+ </ Box >
119
+ </ Box >
120
+ ) ;
121
+ } ) }
110
122
</ Grid >
111
123
</ Box >
112
124
</ Container >
0 commit comments