-
-
Notifications
You must be signed in to change notification settings - Fork 11
835-fix: Stale data on the website #843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 11 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
224911c
fix: 835 - to evaluate is course stale on the client
Quiddlee 0c156e3
feat: 835 - implement to filter stale mentorship courses
Quiddlee 12dc5c8
refactor: 835 - move mentorship stale calculation to the separate method
Quiddlee fe5f8c4
feat: 835 - implement to evaluate course availability on the client
Quiddlee 80f6eaa
feat: 835 - implement to disable registration link if the course is sβ¦
Quiddlee fd466c5
fix: 835 - hero course test
Quiddlee 816f2e2
fix: 835 - registration link label when disabled
Quiddlee c2fd57a
refactor: 835 - remove unnecessary course sorting
Quiddlee ab878d2
refactor: 835 - move header all courses to the client component
Quiddlee 2de9ce5
fix: 835 - move all static parts to server component
Quiddlee 6413da6
fix: 835 - move all static parts to server component
Quiddlee 5ffacbb
refactor: 835 - encapsulate course menu items in reusable component
Quiddlee 6dc48b6
refactor: 835 - implement to reuse fresh courses component in as manyβ¦
Quiddlee ec6cd2b
refactor: 835 - replace default export with named export
Quiddlee 01d9171
refactor: 835 - remove variable reassignment
Quiddlee d90c937
refactor: 835 - add explicit types
Quiddlee 9927125
refactor: 835 - rename variable
Quiddlee cba7bad
chore: 835 - resolve merge conflicts
Quiddlee c6d3310
chore: 835 - resolve merge conflicts
Quiddlee 4719ecb
chore: 835 - resolve merge conflict
Quiddlee 6e96876
chore: 835 - resolve merge conflicts
Quiddlee 2a14c70
fix: 835 - to evaluate date on the client
Quiddlee 6ea440b
fix: 835 - upcoming courses view
Quiddlee 7e24a3c
fix: 835 - course card normal view
Quiddlee 713c915
chore: 835 - resolve merge conflicts
Quiddlee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,30 @@ | ||
'use client'; | ||
|
||
import type { Course } from '@/entities/course'; | ||
import { getActualData } from '@/shared/helpers/getActualData'; | ||
import { SchoolMenu } from '@/widgets/school-menu'; | ||
|
||
type AllCoursesProps = { | ||
courses: Course[]; | ||
}; | ||
|
||
const AllCourses = ({ courses }: AllCoursesProps) => { | ||
const actualCourses = getActualData({ | ||
data: courses, | ||
filterStale: false, | ||
sort: false, | ||
}); | ||
|
||
return actualCourses.map((course) => ( | ||
<SchoolMenu.Item | ||
key={course.id} | ||
icon={course.iconFooter} | ||
title={course.title} | ||
description={course.startDate} | ||
url={course.detailsUrl} | ||
color="light" | ||
/> | ||
)); | ||
}; | ||
|
||
export default AllCourses; | ||
ansivgit marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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 hidden or 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,29 @@ | ||
'use client'; | ||
|
||
import { Course } from '@/entities/course'; | ||
import { getActualData } from '@/shared/helpers/getActualData'; | ||
import { SchoolMenu } from '@/widgets/school-menu'; | ||
|
||
type AllCoursesProps = { | ||
courses: Course[]; | ||
}; | ||
|
||
const AllCourses = ({ courses }: AllCoursesProps) => { | ||
ansivgit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const actualCourses = getActualData({ | ||
data: courses, | ||
filterStale: false, | ||
sort: false, | ||
}); | ||
|
||
return actualCourses.map((course) => ( | ||
<SchoolMenu.Item | ||
key={course.id} | ||
icon={course.iconSmall} | ||
title={course.title} | ||
description={course.startDate} | ||
url={course.detailsUrl} | ||
/> | ||
)); | ||
}; | ||
|
||
export default AllCourses; |
This file contains hidden or 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 hidden or 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 hidden or 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,28 @@ | ||
'use client'; | ||
|
||
import { PropsWithChildren } from 'react'; | ||
|
||
import { calculateFreshDate } from '@/shared/helpers/getCourseDate'; | ||
import { DateSimple } from '@/shared/ui/date-simple'; | ||
|
||
type CourseStartLabelProps = PropsWithChildren & { | ||
startDate: string | null; | ||
registrationEndDate: string | null; | ||
label: string | undefined; | ||
}; | ||
|
||
export const CourseStartLabel = ({ | ||
startDate, | ||
registrationEndDate, | ||
label, | ||
children, | ||
}: CourseStartLabelProps) => { | ||
const freshDate = | ||
startDate && registrationEndDate ? calculateFreshDate(startDate, registrationEndDate) : null; | ||
|
||
return ( | ||
<DateSimple label={label} startDate={freshDate}> | ||
{children} | ||
</DateSimple> | ||
); | ||
}; |
This file contains hidden or 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
30 changes: 30 additions & 0 deletions
30
src/views/mentorship/ui/mentorship-courses/course-items.tsx
This file contains hidden or 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,30 @@ | ||
'use client'; | ||
|
||
import React from 'react'; | ||
|
||
import { Course, CourseCard } from '@/entities/course'; | ||
import { getActualData } from '@/shared/helpers/getActualData'; | ||
import { | ||
transformCoursesToMentorship, | ||
} from '@/views/mentorship/helpers/transformCoursesToMentorship'; | ||
|
||
type CourseItems = { | ||
courses: Course[]; | ||
className: string; | ||
}; | ||
|
||
const CourseItems = ({ courses, className }: CourseItems) => { | ||
const actualCourses = getActualData({ | ||
data: courses, | ||
filterStale: false, | ||
isMentorship: true, | ||
sort: false, | ||
}); | ||
const coursesWithMentorship = transformCoursesToMentorship(actualCourses); | ||
|
||
return coursesWithMentorship.map((course) => ( | ||
<CourseCard key={course.id} className={className} {...course} showMentoringStartDate={true} /> | ||
)); | ||
}; | ||
|
||
export default CourseItems; |
16 changes: 3 additions & 13 deletions
16
src/views/mentorship/ui/mentorship-courses/mentorship-courses.tsx
This file contains hidden or 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 hidden or 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,23 @@ | ||
'use client'; | ||
|
||
import { Course, CourseCard } from '@/entities/course'; | ||
import { getActualData } from '@/shared/helpers/getActualData'; | ||
|
||
type CourseItemsProps = { | ||
courses: Course[]; | ||
}; | ||
|
||
const CourseItems = ({ courses }: CourseItemsProps) => { | ||
const actualCourses = getActualData({ | ||
data: courses, | ||
filterStale: false, | ||
}); | ||
|
||
return ( | ||
actualCourses.map((course) => | ||
<CourseCard size="sm" key={course.id} {...course} />, | ||
) | ||
); | ||
}; | ||
|
||
export default CourseItems; |
This file contains hidden or 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 hidden or 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,16 @@ | ||
'use client'; | ||
|
||
import { dayJS } from '@/shared/helpers/dayJS'; | ||
import { SectionLabel } from '@/shared/ui/section-label'; | ||
import { getCourseStatus } from '@/widgets/hero-course/helpers/get-course-status'; | ||
|
||
type AvailabilityStatusProps = { | ||
startDate: string; | ||
registrationEndDate: string; | ||
}; | ||
|
||
export const AvailabilityStatus = ({ startDate, registrationEndDate }: AvailabilityStatusProps) => { | ||
const status = getCourseStatus(startDate, dayJS(registrationEndDate).diff(startDate, 'd')); | ||
|
||
return <SectionLabel data-testid="course-label">{status}</SectionLabel>; | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.