@@ -3,6 +3,8 @@ import { Button, Flex, Spinner } from '@chakra-ui/react';
3
3
import { TicketStatus , TicketType , UserRole } from '@prisma/client' ;
4
4
import { TicketWithNames } from '../../server/trpc/router/ticket' ;
5
5
import { trpc } from '../../utils/trpc' ;
6
+ import useSiteSettings from '../../utils/hooks/useSiteSettings' ;
7
+ import { SiteSettings , SiteSettingsValues } from '@prisma/client' ;
6
8
7
9
interface TicketCardProps {
8
10
ticket : TicketWithNames ;
@@ -25,6 +27,8 @@ const TicketButtons = (props: TicketCardProps) => {
25
27
26
28
const [ areButtonsLoading , setAreButtonsLoading ] = useState ( false ) ;
27
29
const [ areButtonsDisabled , setAreButtonsDisabled ] = useState ( false ) ;
30
+ const { siteSettings } = useSiteSettings ( ) ;
31
+
28
32
const approveTicketsMutation = trpc . ticket . approveTickets . useMutation ( ) ;
29
33
const resolveTicketsMutation = trpc . ticket . resolveTickets . useMutation ( ) ;
30
34
const requeueTicketsMutation = trpc . ticket . requeueTickets . useMutation ( ) ;
@@ -155,6 +159,10 @@ const TicketButtons = (props: TicketCardProps) => {
155
159
) ( ) ;
156
160
} ;
157
161
162
+ if ( siteSettings === undefined ) {
163
+ return < > </ > ;
164
+ }
165
+
158
166
return (
159
167
< Flex justifyContent = 'center' flexDirection = { [ 'column' , 'column' , 'column' , 'row' ] } >
160
168
< Button
@@ -249,6 +257,7 @@ const TicketButtons = (props: TicketCardProps) => {
249
257
onClick = { handleToggleIsPublic }
250
258
colorScheme = 'teal'
251
259
hidden = {
260
+ siteSettings ?. get ( SiteSettings . ARE_PUBLIC_TICKETS_ENABLED ) === SiteSettingsValues . FALSE ||
252
261
isAbsent ||
253
262
isResolved ||
254
263
isClosed ||
0 commit comments