Skip to content

Commit ed100d8

Browse files
committed
Merge branch '4.0.0-dev' of github.com:themeum/tutor into course-card-v4
2 parents f8ac577 + 57bf833 commit ed100d8

File tree

9 files changed

+3468
-4258
lines changed

9 files changed

+3468
-4258
lines changed

assets/src/scss/frontend/dashboard/_progress-card.scss

Lines changed: 165 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -5,161 +5,168 @@
55
@use '@Core/scss/mixins' as *;
66

77
.tutor-progress-card {
8-
@include tutor-flex(row, stretch, flex-start);
9-
position: relative;
10-
padding: $tutor-spacing-4;
11-
gap: $tutor-spacing-5;
12-
border: 1px solid $tutor-border-idle;
13-
border-radius: $tutor-radius-2xl;
14-
overflow: hidden;
15-
@include tutor-transition();
16-
17-
&:hover {
18-
background-color: $tutor-surface-l1-hover;
19-
}
20-
21-
&-thumbnail {
22-
position: relative;
23-
flex: 0 0 auto;
24-
max-width: 200px;
25-
aspect-ratio: 200 / 112;
26-
border-radius: $tutor-radius-lg;
27-
overflow: hidden;
28-
29-
img {
30-
width: 100%;
31-
height: 100%;
32-
object-fit: cover;
33-
object-position: center;
34-
}
35-
}
36-
37-
&-kebab-overlay {
38-
display: none;
39-
}
40-
41-
&-content {
42-
@include tutor-flex(column, stretch, space-between);
43-
flex: 1 1 auto;
44-
max-width: 412px;
45-
}
46-
47-
&-header {
48-
@include tutor-flex(column, stretch, flex-start);
49-
gap: $tutor-spacing-1;
50-
}
51-
52-
&-category {
53-
@include tutor-typography('tiny', 'regular', 'secondary');
54-
@include tutor-text-truncate();
55-
margin-bottom: $tutor-spacing-1;
56-
}
57-
58-
&-title {
59-
@include tutor-typography('small', 'medium', 'primary');
60-
margin: 0;
61-
}
62-
63-
&-details {
64-
@include tutor-typography('tiny', 'regular', 'secondary');
65-
display: flex;
66-
align-items: center;
67-
gap: $tutor-spacing-2;
68-
margin-bottom: $tutor-spacing-2;
69-
}
70-
71-
&-separator {
72-
color: $tutor-icon-secondary;
73-
}
74-
75-
&-actions {
76-
position: absolute;
77-
top: $tutor-spacing-4;
78-
@include right($tutor-spacing-4);
79-
@include tutor-flex(row, center, flex-end);
80-
gap: $tutor-spacing-3;
81-
opacity: 0;
82-
visibility: hidden;
83-
z-index: $tutor-z-dropdown;
84-
@include tutor-transition((opacity, visibility));
85-
}
86-
87-
&-resume-btn {
88-
display: inline-flex;
89-
align-items: center;
90-
gap: $tutor-spacing-2;
91-
white-space: nowrap;
92-
}
93-
94-
&-menu {
95-
display: inline-flex;
96-
}
97-
98-
&-menu-btn {
99-
padding: $tutor-spacing-2;
100-
min-width: auto;
101-
min-height: auto;
102-
background-color: $tutor-button-ghost-hover;
103-
104-
&:hover:not(:disabled) {
105-
background-color: $tutor-button-ghost-hover;
106-
}
107-
}
108-
109-
&-footer {
110-
display: none;
111-
}
112-
113-
&:hover &-actions {
114-
opacity: 1;
115-
visibility: visible;
116-
}
117-
118-
// Mobile styles
119-
@include tutor-breakpoint-down(sm) {
120-
@include tutor-flex(column, stretch, flex-start);
121-
height: auto;
122-
gap: $tutor-spacing-none;
123-
padding: $tutor-spacing-4 $tutor-spacing-4 $tutor-spacing-5;
124-
125-
&:hover {
126-
background-color: transparent;
127-
}
128-
129-
&-thumbnail {
130-
width: 100%;
131-
max-width: 100%;
132-
margin-bottom: $tutor-spacing-4;
133-
aspect-ratio: 16 / 9;
134-
}
135-
136-
&-kebab-overlay {
137-
display: block;
138-
position: absolute;
139-
top: $tutor-spacing-4;
140-
@include right($tutor-spacing-4);
141-
z-index: $tutor-z-dropdown;
142-
}
143-
144-
&-header {
145-
margin-bottom: $tutor-spacing-4;
146-
}
147-
148-
&-details {
149-
margin-bottom: $tutor-spacing-3;
150-
}
151-
152-
&-content {
153-
padding: 0 $tutor-spacing-3;
154-
}
155-
156-
&-actions {
157-
display: none;
158-
}
159-
160-
&-footer {
161-
display: block;
162-
padding: $tutor-spacing-6 $tutor-spacing-4 0;
163-
}
164-
}
165-
}
8+
position: relative;
9+
padding: $tutor-spacing-4;
10+
@include tutor-flex(row, stretch, flex-start);
11+
gap: $tutor-spacing-5;
12+
border: 1px solid $tutor-border-idle;
13+
border-radius: $tutor-radius-2xl;
14+
transition: all 0.2s ease;
15+
cursor: pointer;
16+
overflow: hidden;
17+
18+
&:hover {
19+
background-color: $tutor-surface-l1-hover;
20+
}
21+
22+
.tutor-courses-thumb {
23+
position: relative;
24+
flex: 0 0 200px;
25+
aspect-ratio: 16 / 9;
26+
border-radius: $tutor-radius-lg;
27+
overflow: hidden;
28+
29+
img {
30+
width: 100%;
31+
height: 100%;
32+
object-fit: cover;
33+
object-position: center;
34+
}
35+
}
36+
37+
&-kebab-overlay {
38+
display: none;
39+
}
40+
41+
&-content {
42+
flex: 1 1 calc(100% - 224px);
43+
@include tutor-flex(column, stretch, space-between);
44+
}
45+
46+
&-header {
47+
@include tutor-flex(column, stretch, flex-start);
48+
gap: $tutor-spacing-1;
49+
}
50+
51+
&-category {
52+
@include tutor-typography('tiny', 'regular', 'secondary');
53+
margin-bottom: $tutor-spacing-1;
54+
}
55+
56+
&-title {
57+
@include tutor-typography('small', 'medium', 'primary');
58+
margin: 0;
59+
}
60+
61+
&-details {
62+
@include tutor-typography('tiny', 'regular', 'secondary');
63+
display: flex;
64+
align-items: center;
65+
gap: $tutor-spacing-2;
66+
margin-bottom: $tutor-spacing-2;
67+
}
68+
69+
&-separator {
70+
color: $tutor-text-secondary;
71+
}
72+
73+
&-actions {
74+
position: absolute;
75+
top: $tutor-spacing-4;
76+
@include right($tutor-spacing-4);
77+
@include tutor-flex(row, center, flex-end);
78+
gap: $tutor-spacing-3;
79+
opacity: 0;
80+
visibility: hidden;
81+
z-index: $tutor-z-dropdown;
82+
transition: opacity 0.2s ease, visibility 0.2s ease;
83+
}
84+
85+
&-resume-btn {
86+
display: inline-flex;
87+
align-items: center;
88+
gap: $tutor-spacing-2;
89+
white-space: nowrap;
90+
}
91+
92+
&-menu {
93+
display: inline-flex;
94+
}
95+
96+
&-menu-btn {
97+
padding: $tutor-spacing-2;
98+
min-width: auto;
99+
min-height: auto;
100+
background-color: $tutor-button-ghost-hover;
101+
102+
&:hover:not(:disabled) {
103+
background-color: $tutor-button-ghost-hover;
104+
}
105+
}
106+
107+
&-footer {
108+
display: none;
109+
}
110+
111+
&:hover &-actions {
112+
opacity: 1;
113+
visibility: visible;
114+
}
115+
116+
// Ensure button text colors remain unchanged for all button instances
117+
.tutor-btn-primary {
118+
color: $tutor-text-primary-inverse;
119+
}
120+
121+
.tutor-btn-ghost {
122+
color: $tutor-text-primary;
123+
}
124+
125+
// Mobile styles
126+
@include tutor-breakpoint-down(sm) {
127+
@include tutor-flex(column, stretch, flex-start);
128+
height: auto;
129+
gap: $tutor-spacing-none;
130+
padding: $tutor-spacing-4 $tutor-spacing-4 $tutor-spacing-5;
131+
132+
&:hover {
133+
background-color: transparent;
134+
}
135+
136+
.tutor-courses-thumb {
137+
width: 100%;
138+
max-width: 100%;
139+
margin-bottom: $tutor-spacing-4;
140+
aspect-ratio: 16 / 9;
141+
}
142+
143+
&-kebab-overlay {
144+
display: block;
145+
position: absolute;
146+
top: $tutor-spacing-4;
147+
@include right($tutor-spacing-4);
148+
z-index: $tutor-z-dropdown;
149+
}
150+
151+
&-header {
152+
margin-bottom: $tutor-spacing-4;
153+
}
154+
155+
&-details {
156+
margin-bottom: $tutor-spacing-3;
157+
}
158+
159+
&-content {
160+
padding: 0 $tutor-spacing-3;
161+
}
162+
163+
&-actions {
164+
display: none;
165+
}
166+
167+
&-footer {
168+
display: block;
169+
padding: $tutor-spacing-6 $tutor-spacing-4 0;
170+
}
171+
}
172+
}

classes/Student.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,4 +334,55 @@ public function tutor_social_profile() {
334334
wp_send_json_success( array( 'message' => __( 'Social Profile Updated', 'tutor' ) ) );
335335
die();
336336
}
337+
338+
/**
339+
* Get courses tab configuration for student dashboard
340+
*
341+
* Generates the tab structure for displaying student courses with dropdown options
342+
* for enrolled, active, and completed courses including counts and navigation URLs.
343+
*
344+
* @since 4.0.0
345+
*
346+
* @param string $active_tab The currently active tab identifier.
347+
* @param array $post_type_args Query arguments for post type filtering.
348+
* @param int $enrolled_course_count Number of enrolled courses.
349+
* @param int $active_course_count Number of active courses.
350+
* @param int $completed_course_count Number of completed courses.
351+
*
352+
* @return array Array containing tab configuration with dropdown options
353+
*/
354+
public function get_courses_tab( $active_tab, $post_type_args, $enrolled_course_count, $active_course_count, $completed_course_count ) {
355+
$courses_tab = array(
356+
array(
357+
'type' => 'dropdown',
358+
'icon' => Icon::ENROLLED,
359+
'active' => ( ( 'courses' === $active_tab ) || ( 'courses/active-courses' === $active_tab ) || ( 'courses/completed-courses' === $active_tab ) ) ? true : false,
360+
'options' => array(
361+
array(
362+
'label' => __( 'Enrolled', 'tutor' ),
363+
'icon' => Icon::ENROLLED,
364+
'url' => esc_url( add_query_arg( $post_type_args, tutor_utils()->get_tutor_dashboard_page_permalink( 'courses' ) ) ),
365+
'active' => 'courses' === $active_tab ? true : false,
366+
'count' => $enrolled_course_count,
367+
),
368+
array(
369+
'label' => __( 'Active', 'tutor' ),
370+
'icon' => Icon::PLAY_LINE,
371+
'url' => esc_url( add_query_arg( $post_type_args, tutor_utils()->get_tutor_dashboard_page_permalink( 'courses/active-courses' ) ) ),
372+
'active' => 'courses/active-courses' === $active_tab ? true : false,
373+
'count' => $active_course_count,
374+
),
375+
array(
376+
'label' => __( 'Complete', 'tutor' ),
377+
'icon' => Icon::COMPLETED_CIRCLE,
378+
'url' => esc_url( add_query_arg( $post_type_args, tutor_utils()->get_tutor_dashboard_page_permalink( 'courses/completed-courses' ) ) ),
379+
'active' => 'courses/completed-courses' === $active_tab ? true : false,
380+
'count' => $completed_course_count,
381+
),
382+
),
383+
),
384+
);
385+
386+
return $courses_tab;
387+
}
337388
}

classes/Utils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9530,7 +9530,7 @@ public function default_menus(): array {
95309530
'title' => __( 'Home', 'tutor' ),
95319531
'icon' => Icon::HOME,
95329532
),
9533-
'enrolled-courses' => array(
9533+
'courses' => array(
95349534
'title' => __( 'Courses', 'tutor' ),
95359535
'icon' => Icon::COURSES,
95369536
),

0 commit comments

Comments
 (0)