Skip to content

Commit

Permalink
pr fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mwarman committed Oct 22, 2024
1 parent 1e7976c commit 4fa5e8a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
5 changes: 0 additions & 5 deletions src/common/components/Error/ErrorPage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
align-items: center;
}

&__icon {
margin-top: 4rem;
margin-bottom: 4rem;
}

&__title {
margin-bottom: 2rem;
}
Expand Down
38 changes: 20 additions & 18 deletions src/common/providers/ConfigProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,6 @@ export interface Config {
VITE_TOAST_AUTO_DISMISS_MILLIS: number;
}

/**
* The configuration validation schema.
* @see {@link https://github.com/jquense/yup | Yup}
*/
const configSchema: ObjectSchema<Config> = object({
VITE_BASE_URL_API: string().url().required('${path} is required.'),
VITE_BUILD_DATE: string().default('1970-01-01'),
VITE_BUILD_TIME: string().default('00:00:00'),
VITE_BUILD_TS: string().default('1970-01-01T00:00:00+0000'),
VITE_BUILD_COMMIT_SHA: string().default('local'),
VITE_BUILD_ENV_CODE: string().default('local'),
VITE_BUILD_WORKFLOW_RUNNER: string().default('local'),
VITE_BUILD_WORKFLOW_NAME: string().default('local'),
VITE_BUILD_WORKFLOW_RUN_NUMBER: number().default(1),
VITE_BUILD_WORKFLOW_RUN_ATTEMPT: number().default(-1),
VITE_TOAST_AUTO_DISMISS_MILLIS: number().default(5000),
});

/**
* The `ConfigContext` instance.
*/
Expand All @@ -56,6 +38,26 @@ const ConfigContextProvider = ({ children }: PropsWithChildren): JSX.Element =>
const [isReady, setIsReady] = useState<boolean>(false);
const [config, setConfig] = useState<Config>();

/**
* The configuration validation schema.
* @see {@link https://github.com/jquense/yup | Yup}
*/
const configSchema: ObjectSchema<Config> = object({
VITE_BASE_URL_API: string()
.url()
.required(({ path }) => t('validation.required-path', { path })),
VITE_BUILD_DATE: string().default('1970-01-01'),
VITE_BUILD_TIME: string().default('00:00:00'),
VITE_BUILD_TS: string().default('1970-01-01T00:00:00+0000'),
VITE_BUILD_COMMIT_SHA: string().default('local'),
VITE_BUILD_ENV_CODE: string().default('local'),
VITE_BUILD_WORKFLOW_RUNNER: string().default('local'),
VITE_BUILD_WORKFLOW_NAME: string().default('local'),
VITE_BUILD_WORKFLOW_RUN_NUMBER: number().default(1),
VITE_BUILD_WORKFLOW_RUN_ATTEMPT: number().default(-1),
VITE_TOAST_AUTO_DISMISS_MILLIS: number().default(5000),
});

useEffect(() => {
try {
const validatedConfig = configSchema.validateSync(import.meta.env, {
Expand Down
1 change: 1 addition & 0 deletions src/common/utils/i18n/resources/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"min": "Must be at least {{min}} characters. ",
"oneOf": "Must be one of: {{values}} ",
"required": "Required. ",
"required-path": "{{path}} is required. ",
"url": "Must be a URL. "
},
"no": "no",
Expand Down
1 change: 1 addition & 0 deletions src/common/utils/i18n/resources/es/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"min": "Debe tener al menos {{min}} caracteres. ",
"oneOf": "Debe ser uno de: {{values}} ",
"required": "Requerido. ",
"required-path": "{{path}} es obligatorio. ",
"url": "Debe ser una URL. "
},
"no": "no",
Expand Down
1 change: 1 addition & 0 deletions src/common/utils/i18n/resources/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"min": "Doit contenir au moins {{min}} caractères. ",
"oneOf": "Doit être l'un des: {{values}} ",
"required": "Requis. ",
"required-path": "{{path}} est obligatoire. ",
"url": "Doit être une URL. "
},
"no": "non",
Expand Down

0 comments on commit 4fa5e8a

Please sign in to comment.