Skip to content

Commit cd49718

Browse files
committed
refactor: clean up commented code and improve wishlist template structure
1 parent 12e1f8b commit cd49718

File tree

3 files changed

+37
-40
lines changed

3 files changed

+37
-40
lines changed

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

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,31 @@
66

77
.tutor-course-card {
88
height: 100%;
9-
display: block;
9+
// display: block;
1010
@include tutor-transition(background-color);
1111

1212
&:hover {
1313
background-color: $tutor-surface-l1-hover;
1414
}
1515

16-
&-thumbnail {
17-
position: relative;
18-
width: 100%;
19-
overflow: hidden;
20-
border-radius: $tutor-radius-sm;
21-
margin-bottom: $tutor-spacing-4;
22-
23-
.tutor-ratio {
24-
width: 100%;
25-
}
26-
27-
img {
28-
width: 100%;
29-
height: 100%;
30-
object-fit: cover;
31-
object-position: center;
32-
}
33-
}
16+
// &-thumbnail {
17+
// position: relative;
18+
// width: 100%;
19+
// overflow: hidden;
20+
// border-radius: $tutor-radius-sm;
21+
// margin-bottom: $tutor-spacing-4;
22+
23+
// .tutor-ratio {
24+
// width: 100%;
25+
// }
26+
27+
// img {
28+
// width: 100%;
29+
// height: 100%;
30+
// object-fit: cover;
31+
// object-position: center;
32+
// }
33+
// }
3434

3535
&-badge {
3636
position: absolute;

templates/dashboard/courses.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
$active_course_count = is_a( $active_courses, 'WP_Query' ) ? $active_courses->found_posts : 0;
5252
$completed_course_count = is_a( $completed_courses, 'WP_Query' ) ? $completed_courses->found_posts : 0;
5353

54-
5554
// Get Paginated course list.
5655
$courses_list_array = array(
5756
'courses' => $enrolled_courses,
@@ -85,8 +84,8 @@
8584
};
8685
elseif ( 'courses' === $active_tab || 'courses/active-courses' === $active_tab || 'courses/completed-courses' === $active_tab ) :
8786
// Prepare course list based on page tab.
88-
$courses_list = $courses_list_array[ $active_tab ];
89-
?>
87+
$courses_list = $courses_list_array[ $active_tab ];
88+
?>
9089
<div class="tutor-dashboard-courses tutor-flex tutor-flex-column tutor-gap-4 tutor-p-6">
9190
<?php
9291
if ( $courses_list && $courses_list->have_posts() ) :

templates/dashboard/wishlist.php

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@
3939

4040
<!-- <?php tutor_load_template( 'demo-components.dashboard.pages.wishlist' ); ?> -->
4141

42-
<!-- <?php
42+
<!--
43+
<?php
4344
tutor_utils()->render_svg_icon( Icon::STAR, 14 );
4445
tutor_utils()->render_svg_icon( Icon::STAR_2, 14 );
45-
?> -->
46+
?>
47+
-->
4648

4749
<div class="tutor-dashboard-page-card-body">
4850
<?php if ( is_array( $wishlists ) && count( $wishlists ) ) : ?>
@@ -53,10 +55,10 @@
5355
$tutor_course_img = get_tutor_course_thumbnail_src();
5456
?>
5557
<div>
56-
<div class="tutor-card tutor-card--rounded-2xl tutor-card--padding-small tutor-course-card">
58+
<div class="tutor-card--rounded-2xl tutor-card--padding-small tutor-course-card">
5759
<a href="<?php echo esc_url( $permalink ); ?>" class="tutor-course-card-thumbnail">
58-
<div class="tutor-ratio tutor-ratio-16x9" style="max-width: 100px;">
59-
<img src="<?php echo esc_url( $tutor_course_img ); ?>"
60+
<div class="tutor-ratio tutor-ratio-16x9">
61+
<img style="max-width: 100%;" src="<?php echo esc_url( $tutor_course_img ); ?>"
6062
alt="<?php the_title(); ?>" loading="lazy" />
6163
</div>
6264
<?php if ( $show_bestseller ) : ?>
@@ -137,19 +139,15 @@
137139
</div>
138140
</div>
139141

140-
<?php tutor_course_loop_price(); ?>
141-
<?php if ( ! empty( $price ) ) : ?>
142-
<div class="tutor-course-card-footer">
143-
<span class="tutor-course-card-price">
144-
<?php echo esc_html( $price ); ?>
145-
</span>
146-
<?php if ( ! empty( $original_price ) ) : ?>
147-
<del class="tutor-course-card-price-original">
148-
<?php echo esc_html( $original_price ); ?>
149-
</del>
150-
<?php endif; ?>
151-
</div>
152-
<?php endif; ?>
142+
<div class="tutor-course-card-footer">
143+
<?php
144+
if ( null === tutor_utils()->get_course_price() ) {
145+
esc_html_e( 'Free', 'tutor' );
146+
} else {
147+
echo wp_kses_post( tutor_utils()->get_course_price() );
148+
}
149+
?>
150+
</div>
153151
</div>
154152
</div>
155153
<?php

0 commit comments

Comments
 (0)