Skip to content

Commit

Permalink
refactor: purge blog components
Browse files Browse the repository at this point in the history
and move remaining folders from /blog to /components
  • Loading branch information
mathiazom committed Oct 10, 2024
1 parent 973c8cc commit 124f459
Show file tree
Hide file tree
Showing 52 changed files with 14 additions and 1,614 deletions.
55 changes: 10 additions & 45 deletions src/app/(main)/[lang]/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,28 @@
import { Metadata } from "next";

import { Blog } from "src/blog/Blog";
import BlogPreview from "src/blog/BlogPreview";
import CustomErrorMessage from "src/blog/components/customErrorMessage/CustomErrorMessage";
import Legal from "src/blog/components/legal/Legal";
import LegalPreview from "src/blog/components/legal/LegalPreview";
import { homeLink } from "src/blog/components/utils/linkTypes";
import Compensations from "src/compensations/Compensations";
import CompensationsPreview from "src/compensations/CompensationsPreview";
import CustomerCases from "src/customerCases/CustomerCases";
import CustomerCasesPreview from "src/customerCases/CustomerCasesPreview";
import Compensations from "src/components/compensations/Compensations";
import CompensationsPreview from "src/components/compensations/CompensationsPreview";
import CustomerCases from "src/components/customerCases/CustomerCases";
import CustomerCasesPreview from "src/components/customerCases/CustomerCasesPreview";
import CustomErrorMessage from "src/components/customErrorMessage/CustomErrorMessage";
import Legal from "src/components/legal/Legal";
import LegalPreview from "src/components/legal/LegalPreview";
import { homeLink } from "src/components/utils/linkTypes";
import { getDraftModeInfo } from "src/utils/draftmode";
import SectionRenderer from "src/utils/renderSection";
import { fetchSeoData, generateMetadataFromSeo } from "src/utils/seo";
import { CompanyLocation } from "studio/lib/interfaces/companyDetails";
import { CompensationsPage } from "studio/lib/interfaces/compensations";
import { LegalDocument } from "studio/lib/interfaces/legalDocuments";
import { LocaleDocument } from "studio/lib/interfaces/locale";
import { BlogPage, PageBuilder, Post } from "studio/lib/interfaces/pages";
import { PageBuilder } from "studio/lib/interfaces/pages";
import { CustomerCasePage } from "studio/lib/interfaces/specialPages";
import {
COMPANY_LOCATIONS_QUERY,
LEGAL_DOCUMENT_BY_SLUG_AND_LANG_QUERY,
} from "studio/lib/queries/admin";
import { LOCALE_QUERY } from "studio/lib/queries/locale";
import {
BLOG_PAGE_QUERY,
PAGE_BY_SLUG_QUERY,
POSTS_QUERY,
SEO_SLUG_QUERY,
} from "studio/lib/queries/pages";
import { PAGE_BY_SLUG_QUERY, SEO_SLUG_QUERY } from "studio/lib/queries/pages";
import {
COMPENSATIONS_PAGE_QUERY,
CUSTOMER_CASES_PAGE_QUERY,
Expand Down Expand Up @@ -63,7 +56,6 @@ async function Page({ params }: Props) {

const [
initialPage,
initialBlogPage,
initialCompensationsPage,
initialLocationsData,
initialCustomerCases,
Expand All @@ -75,7 +67,6 @@ async function Page({ params }: Props) {
{ slug, language: lang },
{ perspective },
),
loadStudioQuery<BlogPage>(BLOG_PAGE_QUERY, { slug }, { perspective }),
loadStudioQuery<CompensationsPage>(
COMPENSATIONS_PAGE_QUERY,
{ slug, language: lang },
Expand Down Expand Up @@ -116,32 +107,6 @@ async function Page({ params }: Props) {
);
}

if (initialBlogPage.data) {
const initialPosts = await loadStudioQuery<Post[]>(
POSTS_QUERY,
{ slug },
{ perspective },
);

if (!initialPosts) {
return Page404;
}

return isDraftMode ? (
<BlogPreview
initialBlog={initialBlogPage}
initialPosts={initialPosts.data}
slug={slug}
/>
) : (
<Blog
blog={initialBlogPage.data}
initialPosts={initialPosts.data}
slug={slug}
/>
);
}

if (initialCompensationsPage.data && initialLocationsData.data) {
return isDraftMode ? (
<CompensationsPreview
Expand Down
6 changes: 3 additions & 3 deletions src/app/(main)/[lang]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Metadata } from "next";

import CustomErrorMessage from "src/blog/components/customErrorMessage/CustomErrorMessage";
import InformationSection from "src/blog/components/informationSection/InformationSection";
import { homeLink } from "src/blog/components/utils/linkTypes";
import CustomErrorMessage from "src/components/customErrorMessage/CustomErrorMessage";
import InformationSection from "src/components/informationSection/InformationSection";
import { homeLink } from "src/components/utils/linkTypes";
import { getDraftModeInfo } from "src/utils/draftmode";
import SectionRenderer from "src/utils/renderSection";
import { fetchSeoData, generateMetadataFromSeo } from "src/utils/seo";
Expand Down
141 changes: 0 additions & 141 deletions src/blog/Blog.tsx

This file was deleted.

32 changes: 0 additions & 32 deletions src/blog/BlogPreview.tsx

This file was deleted.

22 changes: 0 additions & 22 deletions src/blog/blog.module.css

This file was deleted.

55 changes: 0 additions & 55 deletions src/blog/components/hero/BlogHero.stories.tsx

This file was deleted.

Loading

0 comments on commit 124f459

Please sign in to comment.