Skip to content

Commit

Permalink
fix: all the current blocking issues (#724)
Browse files Browse the repository at this point in the history
* fix: admin not being able to add tracks

* fix: filter for cohort selection
  • Loading branch information
devsargam authored Feb 4, 2025
2 parents f885800 + 6ff0e70 commit e10c846
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 19 deletions.
5 changes: 4 additions & 1 deletion apps/web/app/api/AddTracks/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ export async function POST(req: NextRequest) {
const notion = new NotionAPI();
try {
const recordMap = await notion.getPage(notionId);
const data = Object.keys(recordMap.block).map((key) => {
const data = Object.keys(recordMap.block).filter((key) => {
const block = recordMap.block[key];
return block?.role !== "none"
}).map((key) => {
const block = recordMap.block[key];
return {
notionDocId: block?.value.id,
Expand Down
14 changes: 7 additions & 7 deletions apps/web/components/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ export default function Hero({ tracks }: { tracks: TrackPros[] }) {
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(12.12436 -7 4.2 7.27461 16 16)"
>
<stop stop-color="#7D7D7D" />
<stop offset=".267" stop-color="#7E7C7A" />
<stop offset=".45" stop-color="#817871" />
<stop offset=".608" stop-color="#867162" />
<stop offset=".753" stop-color="#8D684C" />
<stop offset=".886" stop-color="#965C30" />
<stop offset="1" stop-color="#A04F12" />
<stop stopColor="#7D7D7D" />
<stop offset=".267" stopColor="#7E7C7A" />
<stop offset=".45" stopColor="#817871" />
<stop offset=".608" stopColor="#867162" />
<stop offset=".753" stopColor="#8D684C" />
<stop offset=".886" stopColor="#965C30" />
<stop offset="1" stopColor="#A04F12" />
</radialGradient>
</defs>
</motion.svg>
Expand Down
11 changes: 1 addition & 10 deletions apps/web/components/Tracks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,7 @@ export const Tracks = ({ tracks, categories }: TracksWithCategoriesProps) => {

const filterTracks = () => {
setLoading(true);
let newFilteredTracks = tracks;
if (selectedCohort) {
newFilteredTracks = newFilteredTracks.filter((t) => t.cohort === selectedCohort);
}
if (selectedCategory && selectedCategory !== "All") {
newFilteredTracks = newFilteredTracks.filter((t) =>
t.categories.some((c) => c.category.category === selectedCategory)
);
}
setFilteredTracks(newFilteredTracks);
setFilteredTracks(tracks.filter((t) => selectedCohort === 3 ? t.cohort === 3 : t.cohort !== 3));
setCurrentPage(1); // Reset to first page on filtering
setLoading(false);
};
Expand Down
1 change: 1 addition & 0 deletions apps/web/components/admin/CompleteTrackCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const CompleteTrackCard = ({ notionId, TrackData }: { notionId: string; TrackDat
problems: problems,
selectedCategory: TrackData.selectedCategory,
cohort: parseInt(TrackData.cohort),
trackType: "NOTION",
});
await insertData(TrackData.trackId);
setIsSubmitting(true);
Expand Down
2 changes: 1 addition & 1 deletion apps/web/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
module.exports = {
darkMode: ["class"],
content: [
"../../packages/ui/**/*.{ts,tsx}",
"../../packages/ui/src/**/*.{ts,tsx}",
"./app/**/*.{ts,tsx}",
"./pages/**/*.{ts,tsx}",
"./components/**/*.{ts,tsx}",
Expand Down

0 comments on commit e10c846

Please sign in to comment.