From 5fd794e9ebc2588f54956bca7c39b9aca24b1523 Mon Sep 17 00:00:00 2001 From: swve Date: Sun, 6 Apr 2025 14:05:54 +0200 Subject: [PATCH 1/4] fix: course structure edition bugs --- .../DraggableElements/ActivityElement.tsx | 14 +++-- .../DraggableElements/ChapterElement.tsx | 39 +++++++------- .../EditCourseStructure.tsx | 54 ++++++++----------- 3 files changed, 55 insertions(+), 52 deletions(-) diff --git a/apps/web/components/Dashboard/Pages/Course/EditCourseStructure/DraggableElements/ActivityElement.tsx b/apps/web/components/Dashboard/Pages/Course/EditCourseStructure/DraggableElements/ActivityElement.tsx index e7f99809..de2b844e 100644 --- a/apps/web/components/Dashboard/Pages/Course/EditCourseStructure/DraggableElements/ActivityElement.tsx +++ b/apps/web/components/Dashboard/Pages/Course/EditCourseStructure/DraggableElements/ActivityElement.tsx @@ -127,17 +127,25 @@ function ActivityElement(props: ActivitiyElementProps) { > {(provided, snapshot) => (
{/* Activity Type Icon */} {/* Centered Activity Name */} -
+
{selectedActivity === props.activity.id ? (
{/* Edit, View, Publish, and Delete Buttons */} -
+
{/* Publishing */} + ); + + const Pagination = () => { + if (totalPages <= 1) return null; + + return ( +
+ {Array.from({ length: totalPages }, (_, i) => i + 1).map((pageNum) => ( + + ))} +
+ ); + }; + + const LoadingState = () => ( +
+ {[1, 2, 3, 4, 5, 6].map((i) => ( +
+
+
+
+
+
+
+ ))} +
+ ); + + const EmptyState = () => ( +
+
+ +
+

No results found

+

+ We couldn't find any matches for "{query}". Try adjusting your search terms or browse our featured content. +

+
+ ); + + return ( +
+ {/* Search Header */} +
+
+
+

Search

+ + {/* Search Input */} +
+ setSearchQuery(e.target.value)} + placeholder="Search courses, users, collections..." + className="w-full h-12 pl-12 pr-4 rounded-xl nice-shadow bg-white + focus:outline-none focus:ring-1 focus:ring-black/5 focus:border-black/20 + text-sm placeholder:text-black/40 transition-all" + /> +
+ +
+ +
+ + {/* Filters */} +
+ + + + +
+
+
+
+ + {/* Search Results */} +
+
+ {query && ( +
+ Found {totalResults} results for "{query}" +
+ )} + + {isLoading ? ( + + ) : totalResults === 0 && query ? ( + + ) : ( +
+ {/* Courses Grid */} + {(selectedType === 'all' || selectedType === 'courses') && searchResults.courses.length > 0 && ( +
+

+ + Courses ({searchResults.courses.length}) +

+
+ {searchResults.courses.map((course) => ( + +
+ {course.thumbnail_image ? ( + {course.name} + ) : ( +
+ +
+ )} +
+
+

{course.name}

+

{course.description}

+ {course.authors && course.authors.length > 0 && ( +
+ + + {course.authors[0].user.first_name} {course.authors[0].user.last_name} + +
+ )} +
+ + ))} +
+
+ )} + + {/* Collections Grid */} + {(selectedType === 'all' || selectedType === 'collections') && searchResults.collections.length > 0 && ( +
+

+ + Collections ({searchResults.collections.length}) +

+
+ {searchResults.collections.map((collection) => ( + +
+ +
+
+

{collection.name}

+

{collection.description}

+
+ + ))} +
+
+ )} + + {/* Users Grid */} + {(selectedType === 'all' || selectedType === 'users') && searchResults.users.length > 0 && ( +
+

+ + Users ({searchResults.users.length}) +

+
+ {searchResults.users.map((user) => ( + + +
+

+ {user.first_name} {user.last_name} +

+

@{user.username}

+ {user.details?.title?.text && ( +

{user.details.title.text}

+ )} +
+ + ))} +
+
+ )} +
+ )} + + +
+
+
+ ); +} + +export default SearchPage; \ No newline at end of file diff --git a/apps/web/components/Objects/Search/SearchBar.tsx b/apps/web/components/Objects/Search/SearchBar.tsx index e84c8cad..e0a3171b 100644 --- a/apps/web/components/Objects/Search/SearchBar.tsx +++ b/apps/web/components/Objects/Search/SearchBar.tsx @@ -238,42 +238,6 @@ export const SearchBar: React.FC = ({ Quick Results
- {/* Users Section */} - {searchResults.users.length > 0 && ( -
-
- - Users -
- {searchResults.users.map((user) => ( - - -
-
-

- {user.first_name} {user.last_name} -

- User -
-

@{user.username}

-
- - ))} -
- )} - {/* Courses Section */} {searchResults.courses.length > 0 && (
@@ -342,6 +306,42 @@ export const SearchBar: React.FC = ({ ))}
)} + + {/* Users Section */} + {searchResults.users.length > 0 && ( +
+
+ + Users +
+ {searchResults.users.map((user) => ( + + +
+
+

+ {user.first_name} {user.last_name} +

+ User +
+

@{user.username}

+
+ + ))} +
+ )}
); }, [searchResults, orgslug, org?.org_uuid]); diff --git a/apps/web/styles/globals.css b/apps/web/styles/globals.css index e48ae9b2..966db14b 100644 --- a/apps/web/styles/globals.css +++ b/apps/web/styles/globals.css @@ -113,6 +113,10 @@ layer(base); text-decoration: none; } + button { + @apply cursor-pointer; + } + * { box-sizing: border-box; }