-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(frontend): Move lang & advanced pages admin to package
- Loading branch information
1 parent
0ab072c
commit e60da7e
Showing
52 changed files
with
761 additions
and
359 deletions.
There are no files selected for viewing
66 changes: 5 additions & 61 deletions
66
apps/frontend/app/[locale]/(admin)/admin/(auth)/core/advanced/files/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,8 @@ | ||
import { getTranslations } from 'next-intl/server'; | ||
import { Metadata } from 'next'; | ||
import { Card } from 'vitnode-frontend/components/ui/card'; | ||
import { fetcher } from 'vitnode-frontend/graphql/fetcher'; | ||
import { HeaderContent } from 'vitnode-frontend/components/ui/header-content'; | ||
|
||
import { | ||
Admin__Core_Files__Show, | ||
ShowCoreFilesSortingColumnEnum, | ||
Admin__Core_Files__ShowQuery, | ||
Admin__Core_Files__ShowQueryVariables, | ||
} from '@/graphql/hooks'; | ||
import { | ||
usePaginationAPISsr, | ||
SearchParamsPagination, | ||
} from '@/plugins/core/hooks/utils/use-pagination-api-ssr'; | ||
import { FilesAdvancedCoreAdminView } from '@/plugins/admin/views/core/advanced/files/files-advanced-core-admin-view'; | ||
|
||
const getData = async (variables: Admin__Core_Files__ShowQueryVariables) => { | ||
const { data } = await fetcher< | ||
Admin__Core_Files__ShowQuery, | ||
Admin__Core_Files__ShowQueryVariables | ||
>({ | ||
query: Admin__Core_Files__Show, | ||
variables, | ||
}); | ||
|
||
return data; | ||
}; | ||
|
||
interface Props { | ||
searchParams: SearchParamsPagination; | ||
} | ||
|
||
export async function generateMetadata(): Promise<Metadata> { | ||
const t = await getTranslations('admin.core.advanced.files'); | ||
|
||
return { | ||
title: t('title'), | ||
}; | ||
} | ||
|
||
export default async function Page({ searchParams }: Props) { | ||
const variables = usePaginationAPISsr({ | ||
searchParams, | ||
defaultPageSize: 10, | ||
search: true, | ||
sortByEnum: ShowCoreFilesSortingColumnEnum, | ||
}); | ||
const [t, data] = await Promise.all([ | ||
getTranslations('admin.core.advanced.files'), | ||
getData(variables), | ||
]); | ||
|
||
return ( | ||
<> | ||
<HeaderContent h1={t('title')} /> | ||
FilesAdvancedCoreAdminView, | ||
FilesAdvancedCoreAdminViewProps, | ||
} from 'vitnode-frontend/admin/core/advanced/files/files-advanced-core-admin-view'; | ||
|
||
<Card className="p-6"> | ||
<FilesAdvancedCoreAdminView {...data} /> | ||
</Card> | ||
</> | ||
); | ||
export default function Page(props: FilesAdvancedCoreAdminViewProps) { | ||
return <FilesAdvancedCoreAdminView {...props} />; | ||
} |
29 changes: 0 additions & 29 deletions
29
apps/frontend/app/[locale]/(admin)/admin/(auth)/core/advanced/layout.tsx
This file was deleted.
Oops, something went wrong.
74 changes: 5 additions & 69 deletions
74
apps/frontend/app/[locale]/(admin)/admin/(auth)/core/langs/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,8 @@ | ||
import { Metadata } from 'next'; | ||
import { getTranslations } from 'next-intl/server'; | ||
import { Card } from 'vitnode-frontend/components/ui/card'; | ||
import { fetcher } from 'vitnode-frontend/graphql/fetcher'; | ||
import { HeaderContent } from 'vitnode-frontend/components/ui/header-content'; | ||
|
||
import { | ||
Core_Languages__Show, | ||
ShowCoreLanguagesSortingColumnEnum, | ||
Core_Languages__ShowQuery, | ||
Core_Languages__ShowQueryVariables, | ||
} from '@/graphql/hooks'; | ||
import { | ||
usePaginationAPISsr, | ||
SearchParamsPagination, | ||
} from '@/plugins/core/hooks/utils/use-pagination-api-ssr'; | ||
import { ActionsLangsAdmin } from '@/plugins/admin/views/core/langs/actions/actions'; | ||
import { RebuildRequiredAdmin } from '@/plugins/admin/global/rebuild-required'; | ||
import { LangsCoreAdminView } from '@/plugins/admin/views/core/langs/langs-core-admin-view'; | ||
|
||
const getData = async (variables: Core_Languages__ShowQueryVariables) => { | ||
const { data } = await fetcher< | ||
Core_Languages__ShowQuery, | ||
Core_Languages__ShowQueryVariables | ||
>({ | ||
query: Core_Languages__Show, | ||
variables, | ||
}); | ||
|
||
return data; | ||
}; | ||
interface Props { | ||
params: { | ||
locale: string; | ||
}; | ||
searchParams: SearchParamsPagination; | ||
} | ||
|
||
export async function generateMetadata(): Promise<Metadata> { | ||
const t = await getTranslations('admin.core.langs'); | ||
|
||
return { | ||
title: t('title'), | ||
}; | ||
} | ||
|
||
export default async function Page({ searchParams }: Props) { | ||
const variables = usePaginationAPISsr({ | ||
searchParams, | ||
defaultPageSize: 10, | ||
search: true, | ||
sortByEnum: ShowCoreLanguagesSortingColumnEnum, | ||
}); | ||
|
||
const [t, data] = await Promise.all([ | ||
getTranslations('admin.core.langs'), | ||
getData(variables), | ||
]); | ||
|
||
return ( | ||
<> | ||
<HeaderContent h1={t('title')}> | ||
<ActionsLangsAdmin /> | ||
</HeaderContent> | ||
LangsCoreAdminView, | ||
LangsCoreAdminViewProps, | ||
} from 'vitnode-frontend/admin/core/langs/langs-core-admin-view'; | ||
|
||
<Card className="p-6"> | ||
<RebuildRequiredAdmin /> | ||
<LangsCoreAdminView data={data} /> | ||
</Card> | ||
</> | ||
); | ||
export default function Page(props: LangsCoreAdminViewProps) { | ||
return <LangsCoreAdminView {...props} />; | ||
} |
23 changes: 0 additions & 23 deletions
23
apps/frontend/plugins/admin/views/core/langs/table/actions/download/hooks/query-api.ts
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
apps/frontend/plugins/core/graphql/queries/languages/core_languages__show.gql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
query Core_languages__show( | ||
query Admin_Core_languages__show( | ||
$first: Int | ||
$last: Int | ||
$cursor: Int | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.