Skip to content

Commit

Permalink
fix: move common types
Browse files Browse the repository at this point in the history
  • Loading branch information
TopETH committed Jul 19, 2024
1 parent 6f2d844 commit ef3508e
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 24 deletions.
8 changes: 2 additions & 6 deletions apps/webapp/app/(routes)/[lang]/[project]/auction/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
getProjects
} from '@/lib/projects'
import { redirect } from 'next/navigation'
import { ProjectPageProps, ProjectPageParams } from '@/types/routing.type'

export default async function AuctionPage({ params }: ProjectPageProps) {
const dict = await getDictionary(params.lang)
Expand Down Expand Up @@ -72,9 +73,4 @@ export async function generateStaticParams(): Promise<ProjectPageParams[]> {
).flat()

return params
}

type ProjectPageParams = { project: string; lang: Lang }
export type ProjectPageProps = {
params: ProjectPageParams
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MetadataRoute } from 'next'
import { getDictionary } from '@/dictionaries'
import { getProjects } from '@/lib/projects'
import { ProjectPageProps } from './page'
import { ProjectPageProps } from '@/types/routing.type'

export default async function sitemap({
params
Expand Down
7 changes: 1 addition & 6 deletions apps/webapp/app/(routes)/[lang]/[project]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getDictionary } from '@/dictionaries'
import { Lang } from '@/dictionaries/locales'
import { getProjectBySlug } from '@/lib/projects'
import { ProjectPageProps } from '@/types/routing.type'
import { Metadata } from 'next'

export default function ProjectPagesLayout({ children }: ProjectPageProps) {
Expand All @@ -20,8 +20,3 @@ export async function generateMetadata({
}
}
}
interface ProjectPageProps {
children: React.ReactNode
params: ProjectPageParams
}
type ProjectPageParams = { project: string; lang: Lang }
6 changes: 2 additions & 4 deletions apps/webapp/app/(routes)/[lang]/[project]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { Lang, locales } from '@/dictionaries/locales'
import { getDictionary } from '@/dictionaries'
import { appConfig } from '@/lib/config'
import Image from 'next/image'
import { ProjectPageProps, ProjectPageParams } from '@/types/routing.type'

export default async function ProjectPage({ params }: ProjectPageProps) {
const dict = await getDictionary(params.lang)
Expand Down Expand Up @@ -130,10 +131,7 @@ export async function generateStaticParams(): Promise<ProjectPageParams[]> {
return params
}

type ProjectPageParams = { project: string; lang: Lang }
export type ProjectPageProps = {
params: ProjectPageParams
}


const DynamicAddressForm = dynamic(
() =>
Expand Down
6 changes: 1 addition & 5 deletions apps/webapp/app/(routes)/[lang]/[project]/presale/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Countdown } from '@/components/shared/countdown'
import { ProjectDataCard } from '@/components/routes/project/project-data-card'
import { ProjectPresaleData } from '@/components/routes/project/project-presale-data'
import { PresaleTransactionsCard } from '@/components/routes/project/presale-transactions-card'
import { Lang } from '@/dictionaries/locales'
import { ProjectPageProps } from '@/types/routing.type'

export default async function ProjectPage({ params }: ProjectPageProps) {
const project = (await getProjectBySlug(
Expand Down Expand Up @@ -35,7 +35,3 @@ export default async function ProjectPage({ params }: ProjectPageProps) {
</div>
)
}

export type ProjectPageProps = {
params: { project: string; lang: Lang }
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MetadataRoute } from 'next'
import { getDictionary } from '@/dictionaries'
import { getProjects } from '@/lib/projects'
import { ProjectPageProps } from './page'
import { ProjectPageProps } from '@/types/routing.type'

export default async function sitemap({
params
Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/app/(routes)/[lang]/[project]/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MetadataRoute } from 'next'
import { getDictionary } from '@/dictionaries'
import { getProjects } from '@/lib/projects'
import { ProjectPageProps } from './page'
import { ProjectPageProps } from '@/types/routing.type'

export default async function sitemap({
params
Expand Down
7 changes: 7 additions & 0 deletions apps/webapp/types/routing.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ export interface CommonPageParams extends LangProp {}
export interface CommonPageProps {
params: CommonPageParams
}

export type ProjectPageParams = { project: string; lang: Lang }

export type ProjectPageProps = {
children: React.ReactNode
params: ProjectPageParams
}

0 comments on commit ef3508e

Please sign in to comment.