-
Notifications
You must be signed in to change notification settings - Fork 0
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
1b262fa
commit 2aa7d86
Showing
15 changed files
with
1,505 additions
and
451 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 |
---|---|---|
|
@@ -31,6 +31,7 @@ module.exports = { | |
"Pillar", | ||
"Sdg", | ||
"Download-email", | ||
"Other-tool" | ||
], | ||
}, | ||
}, | ||
|
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,45 @@ | ||
import { dehydrate, Hydrate } from "@tanstack/react-query"; | ||
import { getGetOtherToolsQueryOptions } from "@/types/generated/other-tool"; | ||
import getQueryClient from "@/lib/react-query/getQueryClient"; | ||
import OtherToolsList from "@/containers/other-tools"; | ||
|
||
async function prefetchQueries() { | ||
const queryClient = getQueryClient(); | ||
try { | ||
const { queryKey, queryFn } = getGetOtherToolsQueryOptions({ | ||
populate: "other_tools_category", | ||
sort: "other_tools_category.name", | ||
}); | ||
|
||
await queryClient.prefetchQuery({ | ||
queryKey, | ||
queryFn, | ||
}); | ||
return dehydrate(queryClient); | ||
} catch (error) { | ||
console.info(error); | ||
return null; | ||
} | ||
} | ||
|
||
export default async function OtherTools() { | ||
const dehydratedState = await prefetchQueries(); | ||
|
||
return ( | ||
<Hydrate state={dehydratedState}> | ||
<> | ||
<div className="relative z-10 h-full w-full bg-white"> | ||
<div className="h-full overflow-auto"> | ||
<div className="space-y-5 px-5 py-10"> | ||
<h1 className="font-metropolis text-3xl tracking-tight text-gray-700">Other Tools</h1> | ||
|
||
<div className="space-y-5"> | ||
<OtherToolsList /> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</> | ||
</Hydrate> | ||
); | ||
} |
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,49 @@ | ||
"use client"; | ||
|
||
import { Search } from "@/components/ui/search"; | ||
import { useGetOtherTools } from "@/types/generated/other-tool"; | ||
import { useMemo, useState } from "react"; | ||
import ToolCard from "./tool-card"; | ||
|
||
const OtherTools = () => { | ||
const [search, setSearch] = useState(""); | ||
|
||
const { data } = useGetOtherTools({ | ||
populate: "other_tools_category", | ||
sort: "other_tools_category.name", | ||
}); | ||
|
||
const otherTools = useMemo( | ||
() => | ||
data?.data?.filter( | ||
({ attributes }) => | ||
attributes?.name?.toLowerCase()?.includes(search.toLowerCase()) || | ||
attributes?.other_tools_category?.data?.attributes?.name | ||
?.toLowerCase() | ||
?.includes(search.toLowerCase()) || | ||
attributes?.description?.toLowerCase()?.includes(search.toLowerCase()), | ||
), | ||
[search, data], | ||
); | ||
|
||
return ( | ||
<div className="relative z-10 h-full w-full bg-white"> | ||
<div className="h-full overflow-auto"> | ||
<div className="p-1 pb-0"> | ||
<Search | ||
placeholder="Search by name, category or description" | ||
type="text" | ||
value={search} | ||
onChange={(e) => setSearch(e.target.value)} | ||
/> | ||
</div> | ||
<div className="space-y-5 px-5 py-10"> | ||
<div className="space-y-5"> | ||
{otherTools?.map((a) => <ToolCard key={a.id} tool={a.attributes} />)} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
export default OtherTools; |
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,25 @@ | ||
import { OtherTool } from "@/types/generated/strapi.schemas"; | ||
|
||
type ToolCardProps = { | ||
tool?: OtherTool; | ||
}; | ||
|
||
const ToolCard = ({ tool }: ToolCardProps) => { | ||
return ( | ||
<div className="flex items-center space-x-5 rounded-lg border border-gray-200 p-5"> | ||
<a href={tool?.link} target="_blank" rel="noopener noreferrer"> | ||
<div className="space-y-2"> | ||
<div className="flex justify-between"> | ||
<h2 className="font-metropolis font-semibold text-gray-800">{tool?.name}</h2> | ||
<div className="rounded-lg bg-gray-100 px-2 text-sm"> | ||
{tool?.other_tools_category?.data?.attributes?.name} | ||
</div> | ||
</div> | ||
<p className="text-sm text-gray-600">{tool?.description}</p> | ||
</div> | ||
</a> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ToolCard; |
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
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.