-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
34125b3
commit 59c32f7
Showing
18 changed files
with
178 additions
and
96 deletions.
There are no files selected for viewing
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,38 +1,39 @@ | ||
import { parseAsString } from "nuqs/server"; | ||
import { useFetchRepositoriesPage } from "@/hooks/useFetchRepositoriesPage"; | ||
import { RepositoriesProvider } from "@/context/repositoriesContext"; | ||
import { RepositoriesFilter } from "@/components/organisms/RepositoriesFilter/_index"; | ||
import { RepositoriesGridInfiniteScroll } from "@/components/organisms/RepositoriesGrid/RepositoriesGridInfiniteScroll"; | ||
import { DataSharingAgreementForm } from "@/components/organisms/_forms/dataSharingAgreement.form"; | ||
import { AddRepositoryForm } from "@/components/organisms/_forms/addrepository.form"; | ||
import { useQueryParser } from "@/hooks/useQueryParser"; | ||
import { QueryParamsProvider } from "@/context/queryParamsContext"; | ||
import { ParamsType } from "@/types"; | ||
|
||
type Props = { | ||
searchParams?: { | ||
query?: string; | ||
language?: string; | ||
params?: ParamsType; | ||
}; | ||
}; | ||
|
||
const queryParser = parseAsString.withDefault(""); | ||
|
||
export default async function RepositoriesPage({ searchParams }: Props) { | ||
const queryParams = queryParser.parseServerSide(searchParams?.query); | ||
const languageParams = queryParser.parseServerSide(searchParams?.language); | ||
const { user, likes, languages } = await useFetchRepositoriesPage(); | ||
const { queryParams, languageParams, params } = useQueryParser({ | ||
searchParams, | ||
}); | ||
|
||
return ( | ||
<RepositoriesProvider user={user} likes={likes}> | ||
<RepositoriesFilter languages={languages} /> | ||
<RepositoriesGridInfiniteScroll | ||
user={user} | ||
queryParams={queryParams} | ||
languageParams={languageParams} | ||
/> | ||
<DataSharingAgreementForm user={user} /> | ||
<AddRepositoryForm | ||
<RepositoriesProvider user={user} likes={likes} languages={languages}> | ||
<QueryParamsProvider | ||
queryParams={queryParams} | ||
languageParams={languageParams} | ||
/> | ||
params={params} | ||
> | ||
<RepositoriesFilter /> | ||
<RepositoriesGridInfiniteScroll /> | ||
<DataSharingAgreementForm /> | ||
<AddRepositoryForm /> | ||
</QueryParamsProvider> | ||
</RepositoriesProvider> | ||
); | ||
} |
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
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
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"use client"; | ||
import { useQueryParams } from "@/hooks/useQueryParams"; | ||
import { | ||
Select, | ||
SelectContent, | ||
SelectItem, | ||
SelectTrigger, | ||
SelectValue, | ||
} from "@/components/atoms/select"; | ||
|
||
export const SelectParams = () => { | ||
const { params, setParams: setParams } = useQueryParams({ | ||
key: "params", | ||
}); | ||
const handleChange = async (value: string) => { | ||
value === "all" ? await setParams("") : await setParams(value); | ||
}; | ||
|
||
return ( | ||
<Select | ||
defaultValue={params || "all"} | ||
onValueChange={(value) => handleChange(value)} | ||
> | ||
<SelectTrigger className="w-[180px]"> | ||
<SelectValue placeholder="Languages" /> | ||
</SelectTrigger> | ||
<SelectContent> | ||
<SelectItem value="all">All</SelectItem> | ||
<SelectItem value="latest">First added</SelectItem> | ||
<SelectItem value="starred">Most starred</SelectItem> | ||
<SelectItem value="liked">Most Liked</SelectItem> | ||
</SelectContent> | ||
</Select> | ||
); | ||
}; |
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,18 +1,13 @@ | ||
import { DirectionListToggle } from "@/components/molecules/DirectionListToggle"; | ||
import { AlreadyStarredToggle } from "@/components/molecules/AlreadyStarredToggle"; | ||
import { SelectLanguages } from "@/components/molecules/SelectLanguages"; | ||
import type { Language } from "@prisma/client"; | ||
import { SelectParams } from "@/components/molecules/SelectParams"; | ||
|
||
type Props = { | ||
languages: Language[]; | ||
}; | ||
|
||
export const RepositoriesFilter = ({ languages }: Props) => { | ||
export const RepositoriesFilter = () => { | ||
return ( | ||
<div className="flex space-x-4"> | ||
<DirectionListToggle /> | ||
{/* <AlreadyStarredToggle /> */} | ||
<SelectLanguages languages={languages} /> | ||
<SelectLanguages /> | ||
<SelectParams /> | ||
</div> | ||
); | ||
}; |
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
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
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
4 changes: 2 additions & 2 deletions
4
src/components/organisms/RepositoryCard/RepositoryCardHeader.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
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
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
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.