refactor(config): improve projectConfig file with types
This commit is contained in:
parent
5a82f96c7d
commit
2d2ef2457d
8
types/projectConfig.ts
Normal file
8
types/projectConfig.ts
Normal file
@ -0,0 +1,8 @@
|
||||
type PCKeys = 'shortName' | 'longName' | 'description' | 'url' | 'color'
|
||||
type PCIconsKeys = 'default' | 'image' | 'apple' | '16_16' | '32_32'
|
||||
|
||||
type PCProps = Record<PCKeys, string>
|
||||
|
||||
export interface PCDefaultValues extends PCProps {
|
||||
icons: Record<PCIconsKeys, string>
|
||||
}
|
@ -1,33 +1,16 @@
|
||||
type PCProps = 'shortName' | 'longName' | 'description' | 'url' | 'color'
|
||||
type PCDefaultValues = Record<PCProps, string>
|
||||
import { PCDefaultValues } from 'types/projectConfig'
|
||||
|
||||
const projectDefaultConfigValues: PCDefaultValues = {
|
||||
export const projectConfig: PCDefaultValues = {
|
||||
shortName: 'Unknown project name',
|
||||
longName: 'Unknown project name',
|
||||
description: 'Unknown project description',
|
||||
url: 'Unknown project url',
|
||||
color: '#FF0000'
|
||||
}
|
||||
|
||||
export const projectConfig = {
|
||||
shortName:
|
||||
process.env.NEXT_PUBLIC_PROJECT_SHORT_NAME != null
|
||||
? process.env.NEXT_PUBLIC_PROJECT_SHORT_NAME
|
||||
: projectDefaultConfigValues.shortName,
|
||||
longName:
|
||||
process.env.NEXT_PUBLIC_PROJECT_LONG_NAME != null
|
||||
? process.env.NEXT_PUBLIC_PROJECT_LONG_NAME
|
||||
: projectDefaultConfigValues.longName,
|
||||
description:
|
||||
process.env.NEXT_PUBLIC_PROJECT_DESCRIPTION != null
|
||||
? process.env.NEXT_PUBLIC_PROJECT_DESCRIPTION
|
||||
: projectDefaultConfigValues.description,
|
||||
url:
|
||||
process.env.NEXT_PUBLIC_PROJECT_URL != null
|
||||
? process.env.NEXT_PUBLIC_PROJECT_URL
|
||||
: projectDefaultConfigValues.url,
|
||||
color:
|
||||
process.env.NEXT_PUBLIC_PROJECT_COLOR != null
|
||||
? process.env.NEXT_PUBLIC_PROJECT_COLOR
|
||||
: projectDefaultConfigValues.color
|
||||
color: '#FF0000',
|
||||
icons: {
|
||||
image: '/images/Logo.png',
|
||||
default: '/icons/favicons/favicon.ico',
|
||||
apple: '/icons/favicons/apple-touch-icon.png',
|
||||
'16_16': '/icons/favicons/favicon-16x16.png',
|
||||
'32_32': '/icons/favicons/favicon-32x32.png'
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user