diff options
| author | trisusilo <tri.susilo@altama.co.id> | 2023-12-05 02:59:30 +0000 |
|---|---|---|
| committer | trisusilo <tri.susilo@altama.co.id> | 2023-12-05 02:59:30 +0000 |
| commit | 80caa8f6ad5fecc213fd1533b972c6173102721e (patch) | |
| tree | f70c8ec03cf2a1cdb8eb3f30ecd83e200986b70b /src-migrate | |
| parent | eca358fd93f1ea5d88c6a6fcc315624cc3bbb910 (diff) | |
| parent | 4ac372ff318ee78e5d5019a1dbe95bf47b661766 (diff) | |
Merged in Feature/popup_information (pull request #118)
Feature/popup information
Diffstat (limited to 'src-migrate')
| -rw-r--r-- | src-migrate/common/components/elements/Seo.tsx | 34 | ||||
| -rw-r--r-- | src-migrate/modules/page-content/index.tsx | 15 | ||||
| -rw-r--r-- | src-migrate/modules/popup-information/index.tsx | 38 | ||||
| -rw-r--r-- | src-migrate/pages/register.tsx | 2 |
4 files changed, 85 insertions, 4 deletions
diff --git a/src-migrate/common/components/elements/Seo.tsx b/src-migrate/common/components/elements/Seo.tsx new file mode 100644 index 00000000..2245663a --- /dev/null +++ b/src-migrate/common/components/elements/Seo.tsx @@ -0,0 +1,34 @@ +import { useRouter } from 'next/router' +import React from 'react' +import { NextSeo } from "next-seo" +import { MetaTag, NextSeoProps } from 'next-seo/lib/types'; + +const Seo = (props: NextSeoProps) => { + const router = useRouter() + + const additionalMetaTags: MetaTag[] = [ + { + property: 'fb:app_id', + content: '270830718811' + }, + { + property: 'fb:page_id', + content: '101759953569' + }, + ] + + if (!!props.additionalMetaTags) additionalMetaTags.push(...props.additionalMetaTags) + + return ( + <NextSeo + defaultTitle='Indoteknik.com: B2B Industrial Supply & Solution' + canonical={process.env.NEXT_PUBLIC_SELF_HOST + router.asPath} + description={props.title} + {...props} + openGraph={{ siteName: 'Indoteknik.com', ...props.openGraph }} + additionalMetaTags={additionalMetaTags} + /> + ) +} + +export default Seo
\ No newline at end of file diff --git a/src-migrate/modules/page-content/index.tsx b/src-migrate/modules/page-content/index.tsx index cbd58633..608079f8 100644 --- a/src-migrate/modules/page-content/index.tsx +++ b/src-migrate/modules/page-content/index.tsx @@ -1,3 +1,4 @@ +import { useMemo } from "react" import { useQuery } from "react-query" import PageContentSkeleton from "~/common/components/skeleton/PageContentSkeleton" import { PageContentProps } from "~/common/types/pageContent" @@ -10,12 +11,18 @@ type Props = { const PageContent = ({ path }: Props) => { const { data, isLoading } = useQuery<PageContentProps>(`page-content:${path}`, async () => await getPageContent({ path })) - if (isLoading) { - return <PageContentSkeleton /> - } + const parsedContent = useMemo<string>(() => { + if (!data) return '' + return data.content.replaceAll( + 'src="/web/image', + `src="${process.env.NEXT_PUBLIC_ODOO_API_HOST}/web/image` + ) + }, [data]) + + if (isLoading) return <PageContentSkeleton /> return ( - <div dangerouslySetInnerHTML={{ __html: data?.content || '' }}></div> + <div dangerouslySetInnerHTML={{ __html: parsedContent || '' }}></div> ) } diff --git a/src-migrate/modules/popup-information/index.tsx b/src-migrate/modules/popup-information/index.tsx new file mode 100644 index 00000000..0d48a92a --- /dev/null +++ b/src-migrate/modules/popup-information/index.tsx @@ -0,0 +1,38 @@ +import { useRouter } from 'next/router'; +import { useEffect, useState } from 'react'; +import Modal from '~/common/components/elements/Modal'; +import { getAuth } from '~/common/libs/auth'; +import PageContent from '../page-content'; +import Link from 'next/link'; + +const PagePopupInformation = () => { + const router = useRouter(); + const isHomePage = router.pathname === '/'; + const auth = getAuth(); + const [active, setActive] = useState<boolean>(false); + + useEffect(() => { + if (isHomePage && !auth) { + setActive(true); + } + }, [isHomePage, auth]); + return ( + <div className='group'> + <Modal + active={active} + className='w-10/12 md:w-fit' + close={() => setActive(false)} + mode='desktop' + > + <div> + <PageContent path='/onbording-popup' /> + <Link href={'/register'} className='btn-yellow w-full mt-2'> + Daftar Sekarang + </Link> + </div> + </Modal> + </div> + ); +}; + +export default PagePopupInformation; diff --git a/src-migrate/pages/register.tsx b/src-migrate/pages/register.tsx index bd5c37f4..1246c6f5 100644 --- a/src-migrate/pages/register.tsx +++ b/src-migrate/pages/register.tsx @@ -1,6 +1,7 @@ import BasicLayout from "@/core/components/layouts/BasicLayout" import { useWindowSize } from "usehooks-ts" +import Seo from "~/common/components/elements/Seo" import Register from "~/modules/register" const RegisterPage = () => { @@ -10,6 +11,7 @@ const RegisterPage = () => { return ( <Layout> + <Seo title="Register - Indoteknik.com" /> <Register /> </Layout> ) |
