File tree Expand file tree Collapse file tree 12 files changed +95
-47
lines changed Expand file tree Collapse file tree 12 files changed +95
-47
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ on: [pull_request]
7
7
8
8
env :
9
9
VERSION : ${{ github.event.pull_request.number }}
10
+ HUSKY : 0
10
11
11
12
jobs :
12
13
build :
Original file line number Diff line number Diff line change
1
+ /* SPDX-FileCopyrightText: 2014-present Kriasoft */
2
+ /* SPDX-License-Identifier: MIT */
3
+
4
+ export type EnvName = "prod" | "test" | "local" ;
5
+ export type Config = {
6
+ app : {
7
+ env : EnvName ;
8
+ name : string ;
9
+ origin : string ;
10
+ hostname : string ;
11
+ } ;
12
+ firebase : {
13
+ projectId : string ;
14
+ appId : string ;
15
+ apiKey : string ;
16
+ authDomain : string ;
17
+ measurementId : string ;
18
+ } ;
19
+ } ;
20
+
21
+ export const configs = JSON . parse ( import . meta. env . VITE_CONFIG ) ;
22
+ export const config : Config =
23
+ location . hostname === configs . prod . hostname
24
+ ? configs . prod
25
+ : location . hostname === configs . test . hostname
26
+ ? configs . test
27
+ : configs . local ;
Original file line number Diff line number Diff line change @@ -14,17 +14,11 @@ import {
14
14
type Auth ,
15
15
type UserCredential ,
16
16
} from "firebase/auth" ;
17
+ import { config } from "./config.js" ;
17
18
export { AuthErrorCodes , linkWithCredential } from "firebase/auth" ;
18
19
export { FirebaseError } ;
19
20
20
- export const app = initializeApp ( {
21
- projectId : import . meta. env . VITE_GOOGLE_CLOUD_PROJECT ,
22
- appId : import . meta. env . VITE_FIREBASE_APP_ID ,
23
- apiKey : import . meta. env . VITE_FIREBASE_API_KEY ,
24
- authDomain : import . meta. env . VITE_FIREBASE_AUTH_DOMAIN ,
25
- measurementId : import . meta. env . VITE_GA_MEASUREMENT_ID ,
26
- } ) ;
27
-
21
+ export const app = initializeApp ( config . firebase ) ;
28
22
export const auth = getAuth ( app ) ;
29
23
export const analytics = getAnalytics ( app ) ;
30
24
Original file line number Diff line number Diff line change 4
4
import { getAnalytics , logEvent } from "firebase/analytics" ;
5
5
import * as React from "react" ;
6
6
import { useLocation } from "react-router-dom" ;
7
+ import { config } from "./config.js" ;
7
8
8
9
export function usePageEffect (
9
10
options ?: Options ,
@@ -17,10 +18,10 @@ export function usePageEffect(
17
18
18
19
document . title =
19
20
location . pathname === "/"
20
- ? options ?. title ?? import . meta . env . VITE_APP_NAME
21
+ ? options ?. title ?? config . app . name
21
22
: options ?. title
22
- ? `${ options . title } - ${ import . meta . env . VITE_APP_NAME } `
23
- : import . meta . env . VITE_APP_NAME ;
23
+ ? `${ options . title } - ${ config . app . name } `
24
+ : config . app . name ;
24
25
25
26
return function ( ) {
26
27
document . title = previousTitle ;
@@ -36,7 +37,7 @@ export function usePageEffect(
36
37
React . useEffect ( ( ) => {
37
38
if ( ! ( options ?. trackPageView === false ) ) {
38
39
logEvent ( getAnalytics ( ) , "page_view" , {
39
- page_title : options ?. title ?? import . meta . env . VITE_APP_NAME ,
40
+ page_title : options ?. title ?? config . app . name ,
40
41
page_path : `${ location . pathname } ${ location . search } ` ,
41
42
} ) ;
42
43
}
Original file line number Diff line number Diff line change 1
1
/* SPDX-FileCopyrightText: 2014-present Kriasoft */
2
2
/* SPDX-License-Identifier: MIT */
3
3
4
- declare const APP_NAME : string ;
5
- declare const APP_HOSTNAME : string ;
6
- declare const GOOGLE_CLOUD_PROJECT : string ;
7
- declare const FIREBASE_APP_ID : string ;
8
- declare const FIREBASE_API_KEY : string ;
9
- declare const FIREBASE_AUTH_DOMAIN : string ;
10
- declare const GA_MEASUREMENT_ID : string ;
11
-
12
4
interface Window {
13
5
dataLayer : unknown [ ] ;
14
6
}
7
+
8
+ interface ImportMetaEnv {
9
+ /**
10
+ * Client-side configuration for the production, test/QA, and local
11
+ * development environments. See `core/config.ts`, `vite.config.ts`.
12
+ */
13
+ readonly VITE_CONFIG : string ;
14
+ }
15
+
16
+ declare module "relay-runtime" {
17
+ interface PayloadError {
18
+ errors ?: Record < string , string [ ] | undefined > ;
19
+ }
20
+ }
21
+
22
+ declare module "*.css" ;
Original file line number Diff line number Diff line change 2
2
/* SPDX-License-Identifier: MIT */
3
3
4
4
import { Typography , TypographyProps } from "@mui/material" ;
5
+ import { config } from "../../core/config.js" ;
5
6
6
7
export function Logo ( props : TypographyProps ) : JSX . Element {
7
8
const { sx, ...other } = props ;
@@ -18,7 +19,7 @@ export function Logo(props: TypographyProps): JSX.Element {
18
19
variant = "h1"
19
20
{ ...other }
20
21
>
21
- { import . meta . env . VITE_APP_NAME }
22
+ { config . app . name }
22
23
</ Typography >
23
24
) ;
24
25
}
Original file line number Diff line number Diff line change 41
41
"typescript" : " ^4.9.5" ,
42
42
"vite" : " ^4.1.4" ,
43
43
"vitest" : " ^0.28.5"
44
- },
45
- "envars" : {
46
- "cwd" : " ../env"
47
44
}
48
45
}
Original file line number Diff line number Diff line change 2
2
/* SPDX-License-Identifier: MIT */
3
3
4
4
import { Link , Typography , TypographyProps } from "@mui/material" ;
5
+ import { config } from "../../core/config.js" ;
5
6
6
7
export function Notice ( props : NoticeProps ) : JSX . Element {
7
8
const { sx, ...other } = props ;
@@ -20,7 +21,7 @@ export function Notice(props: NoticeProps): JSX.Element {
20
21
>
21
22
< span >
22
23
By clicking Continue above, your acknowledge that your have read and
23
- understood, and agree to { import . meta . env . VITE_APP_NAME } 's
24
+ understood, and agree to { config . app . name } 's
24
25
</ span > { " " }
25
26
< Link color = "inherit" href = "/terms" >
26
27
Terms & Conditions
Original file line number Diff line number Diff line change 2
2
/* SPDX-License-Identifier: MIT */
3
3
4
4
import { Container , Link , Typography } from "@mui/material" ;
5
+ import { config } from "../../core/config.js" ;
5
6
import { usePageEffect } from "../../core/page.js" ;
6
7
7
- const appName = import . meta. env . VITE_APP_NAME ;
8
- const appOrigin = `https://${ import . meta. env . VITE_APP_HOSTNAME } ` ;
9
- const email = `support@${ import . meta. env . VITE_APP_HOSTNAME } ` ;
10
-
11
8
/**
12
9
* Generated by https://getterms.io
13
10
*/
14
11
export default function Privacy ( ) : JSX . Element {
15
12
usePageEffect ( { title : "Privacy Policy" } ) ;
16
13
14
+ const appName = config . app . name ;
15
+ const appOrigin = config . app . origin ;
16
+ const email = `hello@${ config . app . hostname } ` ;
17
+
17
18
return (
18
19
< Container
19
20
maxWidth = "sm"
Original file line number Diff line number Diff line change 2
2
/* SPDX-License-Identifier: MIT */
3
3
4
4
import { Container , Link , Typography } from "@mui/material" ;
5
+ import { config } from "../../core/config.js" ;
5
6
import { usePageEffect } from "../../core/page.js" ;
6
7
7
- const appName = import . meta. env . VITE_APP_NAME ;
8
- const appOrigin = `https://${ import . meta. env . VITE_APP_HOSTNAME } ` ;
9
-
10
8
/**
11
9
* Generated by https://getterms.io
12
10
*/
13
11
export default function Terms ( ) : JSX . Element {
14
12
usePageEffect ( { title : "Terms of Use" } ) ;
15
13
14
+ const appName = config . app . name ;
15
+ const appOrigin = config . app . origin ;
16
+
16
17
return (
17
18
< Container
18
19
maxWidth = "sm"
You can’t perform that action at this time.
0 commit comments