Merge pull request 'learning online by default all as null' (#4) from main into testing
Reviewed-on: #4
This commit is contained in:
@@ -53,7 +53,8 @@ export function LearningOnline() {
|
|||||||
const [selectedPriceRange, setSelectedPriceRange] = useState('All Prices');
|
const [selectedPriceRange, setSelectedPriceRange] = useState('All Prices');
|
||||||
const [selectedDuration, setSelectedDuration] = useState('All Durations');
|
const [selectedDuration, setSelectedDuration] = useState('All Durations');
|
||||||
const [selectedRating, setSelectedRating] = useState('All Ratings');
|
const [selectedRating, setSelectedRating] = useState('All Ratings');
|
||||||
const [sortBy, setSortBy] = useState('most_popular'); // ✅ Changed to match API value
|
const [sortBy, setSortBy] = useState(''); // ✅ Changed to match API value
|
||||||
|
// const [sortBy, setSortBy] = useState('most_popular'); // ✅ Changed to match API value
|
||||||
const [viewMode, setViewMode] = useState<'grid' | 'list'>('grid');
|
const [viewMode, setViewMode] = useState<'grid' | 'list'>('grid');
|
||||||
const [currentPage, setCurrentPage] = useState(1);
|
const [currentPage, setCurrentPage] = useState(1);
|
||||||
const coursesPerPage = 9;
|
const coursesPerPage = 9;
|
||||||
@@ -204,7 +205,7 @@ export function LearningOnline() {
|
|||||||
|
|
||||||
// Sort by
|
// Sort by
|
||||||
const apiSortBy = getSortByForApi(sortBy);
|
const apiSortBy = getSortByForApi(sortBy);
|
||||||
if (apiSortBy) {
|
if (apiSortBy && sortBy !== '') {
|
||||||
filters.sort_by = apiSortBy;
|
filters.sort_by = apiSortBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,7 +291,7 @@ export function LearningOnline() {
|
|||||||
setSelectedPriceRange('All Prices');
|
setSelectedPriceRange('All Prices');
|
||||||
setSelectedDuration('All Durations');
|
setSelectedDuration('All Durations');
|
||||||
setSelectedRating('All Ratings');
|
setSelectedRating('All Ratings');
|
||||||
setSortBy('most_popular'); // ✅ Updated to match API value
|
setSortBy('');
|
||||||
};
|
};
|
||||||
|
|
||||||
const hasActiveFilters = searchTerm ||
|
const hasActiveFilters = searchTerm ||
|
||||||
@@ -434,7 +435,7 @@ export function LearningOnline() {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Select value={sortBy} onValueChange={setSortBy}>
|
<Select value={sortBy || undefined} onValueChange={setSortBy}>
|
||||||
<SelectTrigger className="w-40 text-body">
|
<SelectTrigger className="w-40 text-body">
|
||||||
<SelectValue placeholder="Sort by" />
|
<SelectValue placeholder="Sort by" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
|
|||||||
Reference in New Issue
Block a user