Refactor code and add loading components in marketing apps
This commit alters the source of the cache module import used in [...slug]/page.tsx from 'next/cache' to 'react'. Import statements in blog/page.tsx and docs/layout.tsx have been restructured for clarity, keeping local imports separate. Added new loading.tsx files in both blog and docs directories that exports the GlobalLoader from '@kit/ui/global-loader'.
This commit is contained in:
3
apps/web/app/(marketing)/blog/loading.tsx
Normal file
3
apps/web/app/(marketing)/blog/loading.tsx
Normal file
@@ -0,0 +1,3 @@
|
||||
import { GlobalLoader } from '@kit/ui/global-loader';
|
||||
|
||||
export default GlobalLoader;
|
||||
@@ -4,10 +4,11 @@ import { createCmsClient } from '@kit/cms';
|
||||
import { If } from '@kit/ui/if';
|
||||
import { Trans } from '@kit/ui/trans';
|
||||
|
||||
import { SitePageHeader } from '~/(marketing)/_components/site-page-header';
|
||||
import { createI18nServerInstance } from '~/lib/i18n/i18n.server';
|
||||
import { withI18n } from '~/lib/i18n/with-i18n';
|
||||
|
||||
// local imports
|
||||
import { SitePageHeader } from '../_components/site-page-header';
|
||||
import { BlogPagination } from './_components/blog-pagination';
|
||||
import { PostPreview } from './_components/post-preview';
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { unstable_cache as cache } from 'next/cache';
|
||||
import { cache } from 'react';
|
||||
|
||||
import { notFound } from 'next/navigation';
|
||||
|
||||
import { ContentRenderer, createCmsClient } from '@kit/cms';
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { Cms } from '@kit/cms';
|
||||
|
||||
import { DocsNavigation } from '~/(marketing)/docs/_components/docs-navigation';
|
||||
import { getDocs } from '~/(marketing)/docs/_lib/server/docs.loader';
|
||||
import { createI18nServerInstance } from '~/lib/i18n/i18n.server';
|
||||
|
||||
// local imports
|
||||
import { DocsNavigation } from './_components/docs-navigation';
|
||||
import { getDocs } from './_lib/server/docs.loader';
|
||||
|
||||
async function DocsLayout({ children }: React.PropsWithChildren) {
|
||||
const { resolvedLanguage } = await createI18nServerInstance();
|
||||
const pages = await getDocs(resolvedLanguage);
|
||||
|
||||
3
apps/web/app/(marketing)/docs/loading.tsx
Normal file
3
apps/web/app/(marketing)/docs/loading.tsx
Normal file
@@ -0,0 +1,3 @@
|
||||
import { GlobalLoader } from '@kit/ui/global-loader';
|
||||
|
||||
export default GlobalLoader;
|
||||
Reference in New Issue
Block a user