summaryrefslogtreecommitdiff
path: root/src-migrate/modules/page-content
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-09-25 14:07:26 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-09-25 14:07:26 +0700
commite7313b4d7006bed37a408d26f15028892839b73a (patch)
treed0d6c9455ca6aac305efc094639dd6886b34fb14 /src-migrate/modules/page-content
parentd1c0e083ac8f64dfaa8505fc11e30728dbd5a58d (diff)
parente8f640d3fd4984fe5854c2faf7ead9b3b5aebbf2 (diff)
Merge branch 'new-release' into bug-product
Diffstat (limited to 'src-migrate/modules/page-content')
-rw-r--r--src-migrate/modules/page-content/index.tsx61
1 files changed, 31 insertions, 30 deletions
diff --git a/src-migrate/modules/page-content/index.tsx b/src-migrate/modules/page-content/index.tsx
index 547b1957..af597641 100644
--- a/src-migrate/modules/page-content/index.tsx
+++ b/src-migrate/modules/page-content/index.tsx
@@ -1,44 +1,45 @@
-import { useMemo } from "react"
-import { useQuery } from "react-query"
-import { PageContentProps } from "~/types/pageContent"
-import { getPageContent } from "~/services/pageContent"
+import { useMemo } from 'react';
+import { useQuery } from 'react-query';
+import { PageContentProps } from '~/types/pageContent';
+import { getPageContent } from '~/services/pageContent';
type Props = {
- path: string
-}
+ path: string;
+};
const PageContent = ({ path }: Props) => {
- const { data, isLoading } = useQuery<PageContentProps>(`page-content:${path}`, async () => await getPageContent({ path }))
+ const { data, isLoading } = useQuery<PageContentProps>(
+ `page-content:${path}`,
+ async () => await getPageContent({ path })
+ );
const parsedContent = useMemo<string>(() => {
- if (!data) return ''
+ if (!data) return '';
return data.content.replaceAll(
'src="/web/image',
`src="${process.env.NEXT_PUBLIC_ODOO_API_HOST}/web/image`
- )
- }, [data])
+ );
+ }, [data]);
+ console.log('parsedContent', parsedContent);
+ if (isLoading) return <PageContentSkeleton />;
- if (isLoading) return <PageContentSkeleton />
-
- return (
- <div dangerouslySetInnerHTML={{ __html: parsedContent || '' }}></div>
- )
-}
+ return <div dangerouslySetInnerHTML={{ __html: parsedContent || '' }}></div>;
+};
const PageContentSkeleton = () => (
- <div className="animate-pulse grid gap-y-4">
- <div className="w-full h-10 bg-gray-300 rounded" />
- <div className="h-2" />
- <div className="w-full h-4 bg-gray-300 rounded" />
- <div className="w-full h-4 bg-gray-300 rounded" />
- <div className="w-full h-4 bg-gray-300 rounded" />
- <div className="w-8/12 h-4 bg-gray-300 rounded" />
- <div className="h-2" />
- <div className="w-full h-4 bg-gray-300 rounded" />
- <div className="w-full h-4 bg-gray-300 rounded" />
- <div className="w-full h-4 bg-gray-300 rounded" />
- <div className="w-1/2 h-4 bg-gray-300 rounded" />
+ <div className='animate-pulse grid gap-y-4'>
+ <div className='w-full h-10 bg-gray-300 rounded' />
+ <div className='h-2' />
+ <div className='w-full h-4 bg-gray-300 rounded' />
+ <div className='w-full h-4 bg-gray-300 rounded' />
+ <div className='w-full h-4 bg-gray-300 rounded' />
+ <div className='w-8/12 h-4 bg-gray-300 rounded' />
+ <div className='h-2' />
+ <div className='w-full h-4 bg-gray-300 rounded' />
+ <div className='w-full h-4 bg-gray-300 rounded' />
+ <div className='w-full h-4 bg-gray-300 rounded' />
+ <div className='w-1/2 h-4 bg-gray-300 rounded' />
</div>
-)
+);
-export default PageContent \ No newline at end of file
+export default PageContent;