@@ -73,6 +73,7 @@ import {
73
73
environmentTextClassName ,
74
74
} from "~/components/environments/EnvironmentLabel" ;
75
75
import { GitBranchIcon } from "lucide-react" ;
76
+ import { env } from "~/env.server" ;
76
77
77
78
export const meta : MetaFunction = ( ) => {
78
79
return [
@@ -83,6 +84,16 @@ export const meta: MetaFunction = () => {
83
84
} ;
84
85
85
86
export const loader = async ( { request, params } : LoaderFunctionArgs ) => {
87
+ const githubAppEnabled = env . GITHUB_APP_ENABLED === "1" ;
88
+
89
+ if ( ! githubAppEnabled ) {
90
+ return typedjson ( {
91
+ githubAppEnabled,
92
+ githubAppInstallations : undefined ,
93
+ connectedGithubRepository : undefined ,
94
+ } ) ;
95
+ }
96
+
86
97
const userId = await requireUserId ( request ) ;
87
98
const { projectParam, organizationSlug } = EnvironmentParamSchema . parse ( params ) ;
88
99
@@ -120,6 +131,7 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => {
120
131
) ;
121
132
122
133
return typedjson ( {
134
+ githubAppEnabled,
123
135
connectedGithubRepository : {
124
136
...connectedGithubRepository ,
125
137
branchTracking : branchTrackingOrFailure . success ? branchTrackingOrFailure . data : undefined ,
@@ -158,7 +170,11 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => {
158
170
} ,
159
171
} ) ;
160
172
161
- return typedjson ( { githubAppInstallations, connectedGithubRepository : undefined } ) ;
173
+ return typedjson ( {
174
+ githubAppEnabled,
175
+ githubAppInstallations,
176
+ connectedGithubRepository : undefined ,
177
+ } ) ;
162
178
} ;
163
179
164
180
const ConnectGitHubRepoFormSchema = z . object ( {
@@ -257,8 +273,6 @@ export const action: ActionFunction = async ({ request, params }) => {
257
273
return json ( { errors : { body : "project not found" } } , { status : 404 } ) ;
258
274
}
259
275
260
- console . log ( submission . value ) ;
261
-
262
276
try {
263
277
switch ( submission . value . action ) {
264
278
case "rename" : {
@@ -400,7 +414,8 @@ export const action: ActionFunction = async ({ request, params }) => {
400
414
} ;
401
415
402
416
export default function Page ( ) {
403
- const { githubAppInstallations, connectedGithubRepository } = useTypedLoaderData < typeof loader > ( ) ;
417
+ const { githubAppInstallations, connectedGithubRepository, githubAppEnabled } =
418
+ useTypedLoaderData < typeof loader > ( ) ;
404
419
const project = useProject ( ) ;
405
420
const organization = useOrganization ( ) ;
406
421
const lastSubmission = useActionData ( ) ;
@@ -513,19 +528,21 @@ export default function Page() {
513
528
</ div >
514
529
</ div >
515
530
516
- < div >
517
- < Header2 spacing > Git settings</ Header2 >
518
- < div className = "w-full rounded-sm border border-grid-dimmed p-4" >
519
- { connectedGithubRepository ? (
520
- < ConnectedGitHubRepoForm connectedGitHubRepo = { connectedGithubRepository } />
521
- ) : (
522
- < GitHubConnectionPrompt
523
- gitHubAppInstallations = { githubAppInstallations }
524
- organizationSlug = { organization . slug }
525
- />
526
- ) }
531
+ { githubAppEnabled && (
532
+ < div >
533
+ < Header2 spacing > Git settings</ Header2 >
534
+ < div className = "w-full rounded-sm border border-grid-dimmed p-4" >
535
+ { connectedGithubRepository ? (
536
+ < ConnectedGitHubRepoForm connectedGitHubRepo = { connectedGithubRepository } />
537
+ ) : (
538
+ < GitHubConnectionPrompt
539
+ gitHubAppInstallations = { githubAppInstallations }
540
+ organizationSlug = { organization . slug }
541
+ />
542
+ ) }
543
+ </ div >
527
544
</ div >
528
- </ div >
545
+ ) }
529
546
530
547
< div >
531
548
< Header2 spacing > Danger zone</ Header2 >
0 commit comments