-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: server-only cannot be imported from a Client Component module. I…
…t should only be used from a Server Component.
- Loading branch information
1 parent
2bea40a
commit 8184d90
Showing
2 changed files
with
81 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
"use client"; | ||
|
||
import { useEffect, useState } from "react"; | ||
|
||
import { AddBanner } from "@/components/Adsense"; | ||
|
||
export default function ClientNewsPage() { | ||
const GOOGLE_ADSENSE_CLIENT_ID = | ||
process.env.NEXT_PUBLIC_GOOGLE_ADSENSE_CLIENT_ID ?? ""; | ||
|
||
const SlotAd1AndAd2 = "9630566447"; | ||
const SlotAd3 = "8700628151"; | ||
const SlotAd4 = "3500719479"; | ||
const SlotAd5AndAd6 = "7092033017"; | ||
|
||
const [isClient, setIsClient] = useState(false); | ||
|
||
useEffect(() => { | ||
setIsClient(true); | ||
}, []); | ||
|
||
return ( | ||
<> | ||
{isClient && ( | ||
<> | ||
<div id="news-page"> | ||
<div className="div-ad div-ad1"> | ||
<AddBanner | ||
AdClient={GOOGLE_ADSENSE_CLIENT_ID} | ||
AdSlot={SlotAd1AndAd2} | ||
/> | ||
</div> | ||
|
||
<div className="div-ad div-ad2"> | ||
<AddBanner | ||
AdClient={GOOGLE_ADSENSE_CLIENT_ID} | ||
AdSlot={SlotAd1AndAd2} | ||
/> | ||
</div> | ||
|
||
<div className="div-ad div-ad3"> | ||
<AddBanner | ||
AdClient={GOOGLE_ADSENSE_CLIENT_ID} | ||
AdSlot={SlotAd3} | ||
AdFormat="fluid" | ||
/> | ||
</div> | ||
|
||
<div className="div-ad div-ad4"> | ||
<AddBanner | ||
AdClient={GOOGLE_ADSENSE_CLIENT_ID} | ||
AdSlot={SlotAd4} | ||
AdFormat="autorelaxed" | ||
/> | ||
</div> | ||
|
||
<div className="div-ad div-ad5"> | ||
<AddBanner | ||
AdClient={GOOGLE_ADSENSE_CLIENT_ID} | ||
AdSlot={SlotAd5AndAd6} | ||
/> | ||
</div> | ||
|
||
<div className="div-ad div-ad6"> | ||
<AddBanner | ||
AdClient={GOOGLE_ADSENSE_CLIENT_ID} | ||
AdSlot={SlotAd5AndAd6} | ||
/> | ||
</div> | ||
</div> | ||
</> | ||
)} | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,17 @@ | ||
"use client"; | ||
|
||
import "@/css/news.css"; | ||
import { useEffect, useState } from "react"; | ||
import { setStaticParamsLocale } from "next-international/server"; | ||
|
||
import { AddBanner } from "@/components/Adsense"; | ||
import MainBg from "@/components/MainBg"; | ||
import { LocaleParams } from "@/types/Params"; | ||
|
||
export default function NewsPage() { | ||
const GOOGLE_ADSENSE_CLIENT_ID = | ||
process.env.NEXT_PUBLIC_GOOGLE_ADSENSE_CLIENT_ID ?? ""; | ||
|
||
const SlotAd1AndAd2 = "9630566447"; | ||
const SlotAd3 = "8700628151"; | ||
const SlotAd4 = "3500719479"; | ||
const SlotAd5AndAd6 = "7092033017"; | ||
import ClientNewsPage from "./client"; | ||
|
||
const [isClient, setIsClient] = useState(false); | ||
|
||
useEffect(() => { | ||
setIsClient(true); | ||
}, []); | ||
export default function NewsPage({ params: { locale } }: LocaleParams) { | ||
setStaticParamsLocale(locale); | ||
|
||
return ( | ||
<MainBg> | ||
{isClient && ( | ||
<> | ||
<div id="news-page"> | ||
<div className="div-ad div-ad1"> | ||
<AddBanner | ||
AdClient={GOOGLE_ADSENSE_CLIENT_ID} | ||
AdSlot={SlotAd1AndAd2} | ||
/> | ||
</div> | ||
|
||
<div className="div-ad div-ad2"> | ||
<AddBanner | ||
AdClient={GOOGLE_ADSENSE_CLIENT_ID} | ||
AdSlot={SlotAd1AndAd2} | ||
/> | ||
</div> | ||
|
||
<div className="div-ad div-ad3"> | ||
<AddBanner | ||
AdClient={GOOGLE_ADSENSE_CLIENT_ID} | ||
AdSlot={SlotAd3} | ||
AdFormat="fluid" | ||
/> | ||
</div> | ||
|
||
<div className="div-ad div-ad4"> | ||
<AddBanner | ||
AdClient={GOOGLE_ADSENSE_CLIENT_ID} | ||
AdSlot={SlotAd4} | ||
AdFormat="autorelaxed" | ||
/> | ||
</div> | ||
|
||
<div className="div-ad div-ad5"> | ||
<AddBanner | ||
AdClient={GOOGLE_ADSENSE_CLIENT_ID} | ||
AdSlot={SlotAd5AndAd6} | ||
/> | ||
</div> | ||
|
||
<div className="div-ad div-ad6"> | ||
<AddBanner | ||
AdClient={GOOGLE_ADSENSE_CLIENT_ID} | ||
AdSlot={SlotAd5AndAd6} | ||
/> | ||
</div> | ||
</div> | ||
</> | ||
)} | ||
<ClientNewsPage /> | ||
</MainBg> | ||
); | ||
} |