66 SelectContent ,
77 SelectItem ,
88 SelectTrigger ,
9- SelectValue ,
9+ SelectValue
1010} from '@/components/ui/select' ;
1111import { Server } from '@/redux/types/server' ;
1212import {
@@ -32,13 +32,16 @@ import { imagesApi } from '@/redux/services/container/imagesApi';
3232import { Skeleton } from '@/components/ui/skeleton' ;
3333import { ServerIcon } from 'lucide-react' ;
3434import { cn } from '@/lib/utils' ;
35- import { useTranslation } from '@/hooks/use-translation' ;
35+ import { useTranslation , type translationKey } from '@/hooks/use-translation' ;
3636
3737interface ServerSelectorProps {
3838 className ?: string ;
3939}
4040
41- const getStatusLabel = ( status : string , t : ( key : string ) => string ) => {
41+ const getStatusLabel = (
42+ status : string ,
43+ t : ( key : translationKey , params ?: Record < string , string > ) => string
44+ ) => {
4245 switch ( status ) {
4346 case 'active' :
4447 return t ( 'servers.selector.status.active' ) ;
@@ -82,9 +85,19 @@ export function ServerSelector({ className }: ServerSelectorProps) {
8285 dispatch ( userApi . util . invalidateTags ( [ { type : 'User' , id : 'LIST' } ] ) ) ;
8386 dispatch ( notificationApi . util . invalidateTags ( [ { type : 'Notification' , id : 'LIST' } ] ) ) ;
8487 dispatch ( domainsApi . util . invalidateTags ( [ { type : 'Domains' , id : 'LIST' } ] ) ) ;
85- dispatch ( serversApi . util . invalidateTags ( [ { type : 'Servers' , id : 'LIST' } , { type : 'Servers' , id : 'ACTIVE' } ] ) ) ;
88+ dispatch (
89+ serversApi . util . invalidateTags ( [
90+ { type : 'Servers' , id : 'LIST' } ,
91+ { type : 'Servers' , id : 'ACTIVE' }
92+ ] )
93+ ) ;
8694 dispatch ( GithubConnectorApi . util . invalidateTags ( [ { type : 'GithubConnector' , id : 'LIST' } ] ) ) ;
87- dispatch ( deployApi . util . invalidateTags ( [ { type : 'Deploy' , id : 'LIST' } , { type : 'Applications' , id : 'LIST' } ] ) ) ;
95+ dispatch (
96+ deployApi . util . invalidateTags ( [
97+ { type : 'Deploy' , id : 'LIST' } ,
98+ { type : 'Applications' , id : 'LIST' }
99+ ] )
100+ ) ;
88101 dispatch ( fileManagersApi . util . invalidateTags ( [ { type : 'FileListAll' , id : 'LIST' } ] ) ) ;
89102 dispatch ( auditApi . util . invalidateTags ( [ { type : 'AuditLogs' , id : 'LIST' } ] ) ) ;
90103 dispatch ( FeatureFlagsApi . util . invalidateTags ( [ { type : 'FeatureFlags' , id : 'LIST' } ] ) ) ;
@@ -138,19 +151,12 @@ export function ServerSelector({ className }: ServerSelectorProps) {
138151 }
139152
140153 return (
141- < Select
142- value = { activeServer ?. id || 'default' }
143- onValueChange = { handleServerChange }
144- >
154+ < Select value = { activeServer ?. id || 'default' } onValueChange = { handleServerChange } >
145155 < SelectTrigger className = { cn ( 'w-[200px]' , className ) } >
146156 < div className = "flex items-center gap-2" >
147157 < ServerIcon className = "h-4 w-4" />
148158 < SelectValue placeholder = { t ( 'servers.selector.placeholder' ) } >
149- { activeServer ? (
150- < span > { activeServer . name } </ span >
151- ) : (
152- t ( 'servers.selector.default' )
153- ) }
159+ { activeServer ? < span > { activeServer . name } </ span > : t ( 'servers.selector.default' ) }
154160 </ SelectValue >
155161 </ div >
156162 </ SelectTrigger >
@@ -164,7 +170,9 @@ export function ServerSelector({ className }: ServerSelectorProps) {
164170 < SelectItem key = { server . id } value = { server . id } >
165171 < div className = "flex items-center gap-2" >
166172 < span > { server . name } </ span >
167- < span className = "text-xs text-muted-foreground" > { getStatusLabel ( server . status , t ) } </ span >
173+ < span className = "text-xs text-muted-foreground" >
174+ { getStatusLabel ( server . status , t ) }
175+ </ span >
168176 </ div >
169177 </ SelectItem >
170178 ) ) }
0 commit comments