diff --git a/apps/app/.env.local b/apps/app/.env.local-example similarity index 100% rename from apps/app/.env.local rename to apps/app/.env.local-example diff --git a/apps/app/.gitignore b/apps/app/.gitignore index 2068bd05..de8cee3b 100644 --- a/apps/app/.gitignore +++ b/apps/app/.gitignore @@ -1,3 +1,4 @@ .vscode .vercel storybook-static +.env*.local diff --git a/apps/app/public/select.svg b/apps/app/public/select.svg new file mode 100644 index 00000000..7b6b73ca --- /dev/null +++ b/apps/app/public/select.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/apps/app/src/app/(main-layout)/questions/[technology]/[page]/page.tsx b/apps/app/src/app/(main-layout)/questions/[technology]/[page]/page.tsx index a0b732f1..621715e1 100644 --- a/apps/app/src/app/(main-layout)/questions/[technology]/[page]/page.tsx +++ b/apps/app/src/app/(main-layout)/questions/[technology]/[page]/page.tsx @@ -1,16 +1,21 @@ import { redirect } from "next/navigation"; import { QuestionItem } from "../../../../../components/QuestionItem/QuestionItem"; +import { QuestionsHeader } from "../../../../../components/QuestionsHeader/QuestionsHeader"; import { QuestionsPagination } from "../../../../../components/QuestionsPagination"; import { PAGE_SIZE } from "../../../../../lib/constants"; +import { getQuerySortBy, DEFAULT_SORT_BY_QUERY } from "../../../../../lib/order"; import { technologies } from "../../../../../lib/technologies"; import { getAllQuestions } from "../../../../../services/questions.service"; export default async function QuestionsPage({ params, + searchParams, }: { params: { technology: string; page: string }; + searchParams?: { sortBy?: string }; }) { const page = parseInt(params.page); + const querySortBy = getQuerySortBy(searchParams?.sortBy || DEFAULT_SORT_BY_QUERY); if (!technologies.includes(params.technology) || isNaN(page)) { return redirect("/"); @@ -20,10 +25,13 @@ export default async function QuestionsPage({ category: params.technology, limit: PAGE_SIZE, offset: (page - 1) * PAGE_SIZE, + orderBy: querySortBy?.orderBy, + order: querySortBy?.order, }); return (