Skip to content

Commit 91c7d65

Browse files
committed
fix(website): remove window on ssr and allow build
1 parent 27a720e commit 91c7d65

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

website/src/app/(pages)/(home)/_components/showcase.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,19 @@ const DynamicConfetti = dynamic(() =>
1212
)
1313

1414
export function Showcase({ className, ...props }: { className?: string }) {
15-
const isMobile = useMemo(
16-
() => window.matchMedia('(max-width: 1023px)').matches,
17-
[],
18-
)
19-
2015
const [value, setValue] = React.useState('12')
21-
const [disabled, setDisabled] = React.useState(isMobile ? false : true)
16+
const [disabled, setDisabled] = React.useState(false)
2217

2318
const [preloadConfetti, setPreloadConfetti] = React.useState(0)
2419
const [hasGuessed, setHasGuessed] = React.useState(false)
2520

2621
const inputRef = React.useRef<HTMLInputElement>(null)
2722

2823
React.useEffect(() => {
24+
const isMobile = window.matchMedia('(max-width: 1023px)').matches
25+
if (!isMobile) {
26+
setDisabled(true)
27+
}
2928
const t1 = setTimeout(() => {
3029
setDisabled(false)
3130
}, 1_900)
@@ -40,7 +39,7 @@ export function Showcase({ className, ...props }: { className?: string }) {
4039
clearTimeout(t1)
4140
clearTimeout(t2)
4241
}
43-
}, [isMobile])
42+
}, [])
4443

4544
React.useEffect(() => {
4645
if (value.length > 3) {

website/src/components/copy-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ interface CopyButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
2020
}
2121

2222
export async function copyToClipboardWithMeta(value: string) {
23-
window.isSecureContext && navigator.clipboard.writeText(value)
23+
window && window.isSecureContext && navigator.clipboard.writeText(value)
2424
}
2525

2626
export function CopyButton({

0 commit comments

Comments
 (0)