Skip to content

Commit

Permalink
big frontend release (#44)
Browse files Browse the repository at this point in the history
* fix: fix params bulkEvents, add login import

* feat: add select login form, datapicker calendar, events timezone

* feat: add netology deadline

* feat: open rectangle

* feat: add logic exit app, loader

* feat: add loader

* feat: get event

* feat: reset cache

* feat: add style day now,prev,next

* feat: date calendar

* feat: date calendar

* feat: ics export

* add netology homework to .ics

* Fix validation error with events modeus

* Fix linter errors

* refac: change componets

* refactor: until folder

* feat: show webinars

---------

Co-authored-by: Карпович Александр <[email protected]>
  • Loading branch information
depocoder and AlexandrKarpovich authored Oct 31, 2024
1 parent 8a6d04d commit 7bd7b6b
Show file tree
Hide file tree
Showing 24 changed files with 1,524 additions and 530 deletions.
10 changes: 10 additions & 0 deletions backend/yet_another_calendar/web/api/bulk/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ def export_to_ics(calendar: schema.CalendarResponse) -> Iterable[bytes]:
description=netology_lesson.title,
url=netology_lesson.webinar_url)
ics_calendar.add_component(event)
for netology_homework in calendar.netology.homework:
if not netology_homework.deadline:
continue
dt_end = netology_homework.deadline + datetime.timedelta(hours=18)
dt_start = dt_end - datetime.timedelta(hours=2)
event = create_ics_event(title=f"Netology ДЗ: {netology_homework.block_title}", starts_at=dt_start,
ends_at=dt_end, lesson_id=netology_homework.id,
description=netology_homework.title,
url=netology_homework.url)
ics_calendar.add_component(event)
for modeus_lesson in calendar.utmn.modeus_events:
event = create_ics_event(title=f"Modeus: {modeus_lesson.course_name}", starts_at=modeus_lesson.start_time,
ends_at=modeus_lesson.end_time, lesson_id=modeus_lesson.id,
Expand Down
14 changes: 7 additions & 7 deletions backend/yet_another_calendar/web/api/modeus/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ def id(self) -> uuid.UUID:


class EventLinks(BaseModel):
course_unit_realization: Href = Field(alias="course-unit-realization")
cycle_realization: Href = Field(alias="cycle-realization")
course_unit_realization: Optional[Href] = Field(alias="course-unit-realization", default=None)
cycle_realization: Optional[Href] = Field(alias="cycle-realization", default=None)


class EventWithLinks(Event):
Expand Down Expand Up @@ -177,16 +177,16 @@ def serialize_modeus_response(self) -> list[FullEvent]:
teachers_with_events = {teacher.links.event.id: teacher.links for teacher in self.embedded.attendees}
full_events = []
for event in self.embedded.events:
course_id = event.links.course_unit_realization.id
cycle_id = event.links.cycle_realization.id
cycle_realization = None
course_id = event.links.course_unit_realization.id if event.links.course_unit_realization else None
cycle_id = event.links.cycle_realization.id if event.links.cycle_realization else None
try:
cycle_realization = cycle_realizations[cycle_id]
course_name = courses[course_id].name
cycle_realization = cycle_realizations[cycle_id] if cycle_id else 'unknown'
course_name = courses[course_id].name if course_id else 'unknown'
teacher_event = teachers_with_events[event.id]
teacher = teachers[teacher_event.person.id]
teacher_full_name = teacher.full_name
except KeyError:
cycle_realization = 'unknown'
course_name = 'unknown'
teacher_full_name = 'unknown'
location = locations[event.id]
Expand Down
2 changes: 1 addition & 1 deletion backend/yet_another_calendar/web/api/netology/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def deadline_validation(cls, data: Any) -> Any:
date = match.group(0).replace('00.', '01.')
data['deadline'] = datetime.datetime.strptime(date, "%d.%m.%y").astimezone(datetime.timezone.utc)
return data
except:
except Exception:
return data

def is_suitable_time(self, time_min: datetime.datetime, time_max: datetime.datetime) -> bool:
Expand Down
236 changes: 236 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
"axios": "^1.7.7",
"bootstrap": "^5.3.3",
"flatpickr": "^4.6.13",
"framer-motion": "^11.11.9",
"react": "^18.3.1",
"react-bootstrap": "^2.10.5",
"react-dom": "^18.3.1",
"react-router": "^6.26.2",
"react-router-dom": "^6.26.2",
"react-scripts": "5.0.1",
"react-select": "^5.8.1",
"sass-loader": "^16.0.2",
"web-vitals": "^2.1.4"
},
Expand Down
Loading

0 comments on commit 7bd7b6b

Please sign in to comment.