Skip to content

Commit a639321

Browse files
🛑
1 parent 84e0230 commit a639321

File tree

4 files changed

+36
-31
lines changed

4 files changed

+36
-31
lines changed

components/NotionPage.tsx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
formatDate,
99
getBlockTitle,
1010
getPageProperty,
11-
normalizeTitle,
11+
// normalizeTitle,
1212
parsePageId
1313
} from 'notion-utils'
1414
import * as React from 'react'
@@ -180,22 +180,22 @@ const propertyTextValue = (
180180
return defaultFn()
181181
}
182182

183-
const propertySelectValue = (
184-
{ schema, value, key, pageHeader }: any,
185-
defaultFn: () => React.ReactNode
186-
) => {
187-
value = normalizeTitle(value)
188-
189-
if (pageHeader && schema.type === 'multi_select' && value) {
190-
return (
191-
<Link href={`/tags/${value}`} key={key} legacyBehavior>
192-
<a>{defaultFn()}</a>
193-
</Link>
194-
)
195-
}
183+
// const propertySelectValue = (
184+
// { schema, value, key, pageHeader }: any,
185+
// defaultFn: () => React.ReactNode
186+
// ) => {
187+
// value = normalizeTitle(value)
196188

197-
return defaultFn()
198-
}
189+
// if (pageHeader && schema.type === 'multi_select' && value) {
190+
// return (
191+
// <Link href={`/tags/${value}`} key={key} legacyBehavior>
192+
// <a>{defaultFn()}</a>
193+
// </Link>
194+
// )
195+
// }
196+
197+
// return defaultFn()
198+
// }
199199

200200
const HeroHeader = dynamic<{ className?: string }>(
201201
() => import('./HeroHeader').then((m) => m.HeroHeader),
@@ -224,8 +224,8 @@ export function NotionPage({
224224
Header: NotionPageHeader,
225225
propertyLastEditedTimeValue,
226226
propertyTextValue,
227-
propertyDateValue,
228-
propertySelectValue
227+
propertyDateValue
228+
// propertySelectValue
229229
}),
230230
[]
231231
)

lib/config.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,21 +113,22 @@ export const isSearchEnabled: boolean = getSiteConfig('isSearchEnabled', true)
113113
// ----------------------------------------------------------------------------
114114

115115
// Optional redis instance for persisting preview images
116-
export const isRedisEnabled: boolean = getSiteConfig('isRedisEnabled', false)
116+
export const isRedisEnabled: boolean =
117+
getSiteConfig('isRedisEnabled', false) || !!getEnv('REDIS_ENABLED')
117118

118119
// (if you want to enable redis, only REDIS_HOST and REDIS_PASSWORD are required)
119120
// we recommend that you store these in a local `.env` file
120-
export const redisHost: string | undefined = getEnv('REDIS_HOST')
121-
export const redisPassword: string | undefined = getEnv('REDIS_PASSWORD')
122-
export const redisUser: string | undefined = getEnv('REDIS_USER', 'default')
121+
export const redisHost = getEnv('REDIS_HOST', isRedisEnabled ? undefined : null)
122+
export const redisPassword = getEnv(
123+
'REDIS_PASSWORD',
124+
isRedisEnabled ? undefined : null
125+
)
126+
export const redisUser: string = getEnv('REDIS_USER', 'default')
123127
export const redisUrl = getEnv(
124128
'REDIS_URL',
125-
`redis://${redisUser}:${redisPassword}@${redisHost}`
126-
)
127-
export const redisNamespace: string | undefined = getEnv(
128-
'REDIS_NAMESPACE',
129-
'preview-images'
129+
isRedisEnabled ? `redis://${redisUser}:${redisPassword}@${redisHost}` : null
130130
)
131+
export const redisNamespace = getEnv('REDIS_NAMESPACE', 'preview-images')
131132

132133
// ----------------------------------------------------------------------------
133134

lib/get-config-value.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ export function getRequiredSiteConfig<T>(key: string): T {
4949

5050
export const isServer = typeof window === 'undefined'
5151

52-
export function getEnv(
52+
export function getEnv<T>(
5353
key: string,
54-
defaultValue?: string,
54+
defaultValue?: string | T,
5555
env = process.env
56-
): string | undefined {
56+
): string | T {
5757
const value = env[key]
5858

5959
if (value !== undefined) {
60-
return value
60+
return value as string
6161
}
6262

6363
if (defaultValue !== undefined) {
@@ -67,4 +67,6 @@ export function getEnv(
6767
if (isServer) {
6868
throw new Error(`Config error: missing required env variable "${key}"`)
6969
}
70+
71+
return null as unknown as T
7072
}

pages/tags/[tagName].tsx renamed to pages/tags/temp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// TODO: [tagName].tsx
2+
13
import { domain, isDev, rootNotionPageId } from 'lib/config'
24
import { resolveNotionPage } from 'lib/resolve-notion-page'
35
import omit from 'lodash.omit'

0 commit comments

Comments
 (0)