Skip to content

Commit

Permalink
Add css; Show pinned courses for other semesters
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthiasReumann committed Aug 8, 2023
1 parent aeacd83 commit 6db90be
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
14 changes: 1 addition & 13 deletions api/courses.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,18 +266,6 @@ func (r coursesRoutes) getUsers(c *gin.Context) {
func (r coursesRoutes) getPinned(c *gin.Context) {
tumLiveContext := c.MustGet("TUMLiveContext").(tools.TUMLiveContext)

year, term := tum.GetCurrentSemester()
year, err := strconv.Atoi(c.DefaultQuery("year", strconv.Itoa(year)))
if err != nil {
_ = c.Error(tools.RequestError{
Status: http.StatusBadRequest,
CustomMessage: "invalid year",
Err: err,
})
return
}
term = c.DefaultQuery("term", term)

var pinnedCourses []model.Course
if tumLiveContext.User != nil {
pinnedCourses = tumLiveContext.User.PinnedCourses
Expand All @@ -288,7 +276,7 @@ func (r coursesRoutes) getPinned(c *gin.Context) {
pinnedCourses = commons.Unique(pinnedCourses, func(c model.Course) uint { return c.ID })
resp := make([]model.CourseDTO, 0, len(pinnedCourses))
for _, course := range pinnedCourses {
if !course.IsHidden() && course.Year == year && course.TeachingTerm == term {
if !course.IsHidden() {
resp = append(resp, course.ToDTO())
}
}
Expand Down
2 changes: 1 addition & 1 deletion model/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,5 +329,5 @@ func (u *User) BeforeCreate(tx *gorm.DB) (err error) {
if len(u.Name) == 0 {
return ErrUsernameNoText
}
return nil;
return nil
}
8 changes: 8 additions & 0 deletions web/assets/css/home.css
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@
@apply bg-blue-500 dark:bg-indigo-600
}

.tum-live-border-primary {
@apply border-blue-500 dark:border-indigo-600
}

.tum-live-font-primary {
@apply text-blue-500 dark:text-indigo-600
}

/* Elements */
.tum-live-button {
@apply rounded-full px-3 py-1 text-sm font-semibold
Expand Down
4 changes: 2 additions & 2 deletions web/template/home.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
{{else}}
<div>
<button type="button" @click="userContext.toggle(true)"
class="tum-live-button-primary mx-3 flex items-center justify-center rounded-full h-[32px] w-[32px]">
<span class="text-white font-semibold uppercase">{{printf "%.1s" $user.GetPreferredName}}</span>
class="border-2 tum-live-border-primary mx-3 flex items-center justify-center rounded-full h-[32px] w-[32px]">
<i class = "fa-solid fa-user tum-live-font-primary"></i>
</button>
<div class="relative">
<article x-cloak x-show="userContext.value"
Expand Down
2 changes: 2 additions & 0 deletions web/ts/api/courses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ export class Course {

readonly Pinned: boolean = false;

readonly UserID: number;

private readonly Streams?: Stream[];

readonly Recordings?: Stream[];
Expand Down

0 comments on commit 6db90be

Please sign in to comment.