Skip to content

Commit

Permalink
chore: run prettier on whole project
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiazom committed Aug 22, 2024
1 parent 53767d0 commit 5700599
Show file tree
Hide file tree
Showing 64 changed files with 248 additions and 245 deletions.
12 changes: 2 additions & 10 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@
"plugin:storybook/recommended",
"plugin:storybook/recommended"
],
"plugins": [
"prettier",
"simple-import-sort",
"eslint-plugin-import"
],
"ignorePatterns": [
"dist",
"node_modules",
".sanity"
]
"plugins": ["prettier", "simple-import-sort", "eslint-plugin-import"],
"ignorePatterns": ["dist", "node_modules", ".sanity"]
}
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Please provide a brief summary of the changes you’ve made. Explain the purpose

If applicable, please include screenshots or a short video showcasing the changes you have made.

*Insert images or videos here.*
_Insert images or videos here._

---

Expand All @@ -24,4 +24,4 @@ Please ensure that you’ve completed the following checkpoints before submittin

## Additional Notes

Other comments relevant to this pull request.
Other comments relevant to this pull request.
2 changes: 1 addition & 1 deletion .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
- name: Dry Prettify
uses: actionsx/prettier@v2
with:
args: --check .
args: --check .
4 changes: 2 additions & 2 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
images: {
images: {
remotePatterns: [
{
protocol: "https",
Expand All @@ -13,4 +13,4 @@ const nextConfig = {
},
};

export default nextConfig;
export default nextConfig;
35 changes: 24 additions & 11 deletions src/app/(main)/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { Metadata } from "next";
import { redirect } from "next/navigation";
import { Blog } from "src/blog/Blog";
import BlogPreview from "src/blog/BlogPreview";
import SalaryAndBenefits from 'src/salaryAndBenefits/SalaryAndBenefits';
import SalaryAndBenefits from "src/salaryAndBenefits/SalaryAndBenefits";
import { getDraftModeInfo } from "src/utils/draftmode";
import SectionRenderer from "src/utils/renderSection";
import { fetchSeoData, generateMetadataFromSeo } from "src/utils/seo";
import { BlogPage, PageBuilder, Post } from "studio/lib/payloads/pages";
import { SalaryAndBenefits as SalaryAndBenefitsPayload } from 'studio/lib/payloads/salaryAndBenefits';
import { SalaryAndBenefits as SalaryAndBenefitsPayload } from "studio/lib/payloads/salaryAndBenefits";
import {
BLOG_PAGE_QUERY,
POSTS_QUERY,
Expand Down Expand Up @@ -36,13 +36,22 @@ async function Page({ params }: Props) {
const { slug } = params;
const { perspective, isDraftMode } = getDraftModeInfo();

const [initialPage, initialBlogPage, initialSalaryAndBenefitsPage] = await Promise.all([
loadQuery<PageBuilder>(SLUG_QUERY, { slug }, { perspective }),
loadQuery<BlogPage>(BLOG_PAGE_QUERY, { slug }, { perspective }),
loadQuery<SalaryAndBenefitsPayload>(SALARY_AND_BENEFITS_PAGE_QUERY, { slug }, { perspective }),
]);
const [initialPage, initialBlogPage, initialSalaryAndBenefitsPage] =
await Promise.all([
loadQuery<PageBuilder>(SLUG_QUERY, { slug }, { perspective }),
loadQuery<BlogPage>(BLOG_PAGE_QUERY, { slug }, { perspective }),
loadQuery<SalaryAndBenefitsPayload>(
SALARY_AND_BENEFITS_PAGE_QUERY,
{ slug },
{ perspective },
),
]);

if (!initialPage.data && !initialBlogPage.data && !initialSalaryAndBenefitsPage.data) {
if (
!initialPage.data &&
!initialBlogPage.data &&
!initialSalaryAndBenefitsPage.data
) {
console.log(`Page ${slug} not found`);
// TODO: add error snackbar
redirect("/");
Expand All @@ -53,7 +62,7 @@ async function Page({ params }: Props) {
const initialPosts = await loadQuery<Post[]>(
POSTS_QUERY,
{ slug },
{ perspective }
{ perspective },
);

if (!initialPosts) {
Expand Down Expand Up @@ -95,9 +104,13 @@ async function Page({ params }: Props) {

if (initialSalaryAndBenefitsPage.data) {
return isDraftMode ? (
<SalaryAndBenefitsPreview initialSalaryAndBenefits={initialSalaryAndBenefitsPage} />
<SalaryAndBenefitsPreview
initialSalaryAndBenefits={initialSalaryAndBenefitsPage}
/>
) : (
<SalaryAndBenefits salaryAndBenefits={initialSalaryAndBenefitsPage.data} />
<SalaryAndBenefits
salaryAndBenefits={initialSalaryAndBenefitsPage.data}
/>
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/(main)/legal/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function Page({ params }: Props) {
const initialDocument = await loadQuery<LegalDocument>(
LEGAL_DOCUMENT_SLUG_QUERY,
{ slug: id },
{ perspective }
{ perspective },
);

if (!initialDocument) {
Expand Down
4 changes: 2 additions & 2 deletions src/app/(main)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const Home = async () => {
const { data: landingId } = await loadQuery<string>(
LANDING_QUERY,
{},
{ perspective }
{ perspective },
);

if (!landingId) {
Expand All @@ -54,7 +54,7 @@ const Home = async () => {
const initialLandingPage = await loadQuery<PageBuilder>(
PAGE_QUERY,
{ id: landingId },
{ perspective }
{ perspective },
);

if (!initialLandingPage.data) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/contactForm/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export async function POST(req: Request) {
{
error: "Form was not sent due to a technical error. Please try again.",
},
{ status: 500 }
{ status: 500 },
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/draft/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export async function GET(request: Request) {
try {
const { isValid, redirectTo = "/" } = await validatePreviewUrl(
clientWithToken,
request.url
request.url,
);

if (!isValid) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/fetchData/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export async function POST(req: Request) {
console.error("Error fetching data:", error);
return NextResponse.json(
{ error: "Failed to fetch data" },
{ status: 500 }
{ status: 500 },
);
}
}
4 changes: 2 additions & 2 deletions src/blog/Blog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ export const Blog = ({ blog, initialPosts, slug }: BlogProps) => {
const { tabListRef, selectedTabIndex } = useTabs();

const postCategories = new Set(
initialPosts.map((post) => post.category).filter((category) => category)
initialPosts.map((post) => post.category).filter((category) => category),
);

const filteredCategories = blog?.categories.filter((category) =>
postCategories.has(category.name)
postCategories.has(category.name),
);

const categories = [
Expand Down
2 changes: 1 addition & 1 deletion src/blog/BlogPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function BlogPreview({
const { data: newData } = useQuery<BlogPage | null>(
BLOG_PAGE_QUERY,
{ slug: slug, id: initialBlog.data._id },
{ initial: initialBlog }
{ initial: initialBlog },
);

const overview = newData || initialBlog.data;
Expand Down
2 changes: 1 addition & 1 deletion src/blog/components/legal/LegalPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function LegalPreview({
const { data: newDoc } = useQuery<LegalDocument | null>(
NAV_QUERY,
{},
{ initial: initialDocument }
{ initial: initialDocument },
);

return newDoc && <Legal document={newDoc} />;
Expand Down
2 changes: 1 addition & 1 deletion src/blog/components/postPreviewGrid/PostPreviewGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const PostPreviewGrid = ({
(index: number) => (el: HTMLAnchorElement | null) => {
postRefs.current[index] = el;
},
[]
[],
);

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
.container {
display: flex;
gap: 1rem;
align-items: center;
}

.label {
font-size: 1rem;
color: var(--dark-purple);
}
display: flex;
gap: 1rem;
align-items: center;
}

.disabledLabel {
color: gray;
cursor: not-allowed;
}
.label {
font-size: 1rem;
color: var(--dark-purple);
}

.input {
appearance: none;
width: 24px;
height: 24px;
border: 2px solid black;
border-radius: 50%;
transition: all 0.1s ease-in-out;
box-sizing: border-box;
background-color: white;
position: relative;
}

.input:checked::after {
content: "";
position: absolute;
top: 4px;
left: 4px;
width: 12px;
height: 12px;
border-radius: 50%;
background-color: var(--primary-green-dark);
}
.disabledLabel {
color: gray;
cursor: not-allowed;
}

.input:hover {
background-color: var(--primary-green-light);
outline: 2px solid var(--primary-green-light); ;
}
.input {
appearance: none;
width: 24px;
height: 24px;
border: 2px solid black;
border-radius: 50%;
transition: all 0.1s ease-in-out;
box-sizing: border-box;
background-color: white;
position: relative;
}

.input:focus {
outline: 2px solid var(--primary-green-light);
}
.input:checked::after {
content: "";
position: absolute;
top: 4px;
left: 4px;
width: 12px;
height: 12px;
border-radius: 50%;
background-color: var(--primary-green-dark);
}

.input[disabled]{
cursor: not-allowed;
border-color: grey;
}
.input:hover {
background-color: var(--primary-green-light);
outline: 2px solid var(--primary-green-light);
}

.input:focus {
outline: 2px solid var(--primary-green-light);
}

.input[disabled] {
cursor: not-allowed;
border-color: grey;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.fieldset{
border: 0 none;
}
.fieldset {
border: 0 none;
}

.wrapper {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.wrapper {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
8 changes: 4 additions & 4 deletions src/components/navigation/footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const Footer = ({
legalData,
}: IFooter) => {
const renderedLogo = useConvertSanityImageToNextImage(
siteSettings.brandAssets?.secondaryLogo
siteSettings.brandAssets?.secondaryLogo,
);

const currentYear = new Date().getFullYear();
Expand Down Expand Up @@ -78,7 +78,7 @@ const renderLinks = (data: Navigation) => {
<li key={link._key}>
<CustomLink link={link} type="footerLink" />
</li>
))
)),
)
);
};
Expand All @@ -92,14 +92,14 @@ const renderSoMe = (data: Navigation, soMeData: SocialMediaProfiles) => {
<li key={link._key}>
<SoMeLink link={link} />
</li>
))
)),
)
);
};

const filterSectionsByType = (
data: Navigation,
type: "content" | "socialMedia"
type: "content" | "socialMedia",
) => data.footer?.filter((section) => section.sectionType === type);

const renderList = (children: ReactNode) => (
Expand Down
4 changes: 2 additions & 2 deletions src/components/navigation/footer/FooterPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { SOMEPROFILES_QUERY } from "studio/lib/queries/socialMediaProfiles";

function useInitialData<T>(
query: string,
initialData: QueryResponseInitial<T>
initialData: QueryResponseInitial<T>,
): T | null {
const { data } = useQuery<T | null>(query, {}, { initial: initialData });
return data;
Expand All @@ -28,7 +28,7 @@ export default function FooterPreview({
const newNav = useInitialData(NAV_QUERY, initialNav);
const newSiteSettings = useInitialData(
SITESETTINGS_QUERY,
initialSiteSetting
initialSiteSetting,
);
const newSoMedata = useInitialData(SOMEPROFILES_QUERY, initialSoMe);
// TODO: add legal preview
Expand Down
2 changes: 1 addition & 1 deletion src/components/navigation/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export const Header = ({ data, assets }: IHeader) => {
export const renderPageLinks = (
links: ILink[],
isMobile: boolean,
pathname: string
pathname: string,
) => (
<ul className={isMobile ? styles.listMobile : styles.desktopLinks}>
{links?.map((link: ILink) => {
Expand Down
Loading

0 comments on commit 5700599

Please sign in to comment.