From 0f4a154c8db19c6503f29db48431d7a37b383c73 Mon Sep 17 00:00:00 2001 From: swve Date: Sun, 14 May 2023 16:16:49 +0000 Subject: [PATCH 1/4] fix: settings inputs --- .../settings/account/passwords/page.tsx | 37 +++++++++--- .../settings/account/profile/page.tsx | 42 ++++++++++++-- .../settings/organization/general/page.tsx | 58 +++++++++++++++---- front/next.config.js | 3 +- 4 files changed, 115 insertions(+), 25 deletions(-) diff --git a/front/app/_orgs/[orgslug]/settings/account/passwords/page.tsx b/front/app/_orgs/[orgslug]/settings/account/passwords/page.tsx index 9fc62bfe..4bca9638 100644 --- a/front/app/_orgs/[orgslug]/settings/account/passwords/page.tsx +++ b/front/app/_orgs/[orgslug]/settings/account/passwords/page.tsx @@ -21,7 +21,7 @@ function SettingsProfilePasswordsPage() { {auth.isAuthenticated && (
-

Account Password

+

Account Password



{({ isSubmitting }) => ( -
- Old Password
- New password
- - +
+ + + + + + + + + )}
diff --git a/front/app/_orgs/[orgslug]/settings/account/profile/page.tsx b/front/app/_orgs/[orgslug]/settings/account/profile/page.tsx index 40c11323..ea0e297b 100644 --- a/front/app/_orgs/[orgslug]/settings/account/profile/page.tsx +++ b/front/app/_orgs/[orgslug]/settings/account/profile/page.tsx @@ -12,7 +12,7 @@ function SettingsProfilePage() { {auth.isAuthenticated && (
-

Profile Settings

+

Profile Settings



{({ isSubmitting }) => ( -
- Full name
- Email
- Bio
- + )}
diff --git a/front/app/_orgs/[orgslug]/settings/organization/general/page.tsx b/front/app/_orgs/[orgslug]/settings/organization/general/page.tsx index 048f4fc2..63c4b227 100644 --- a/front/app/_orgs/[orgslug]/settings/organization/general/page.tsx +++ b/front/app/_orgs/[orgslug]/settings/organization/general/page.tsx @@ -37,7 +37,7 @@ function SettingsOrganizationGeneral(params: any) { return (
-

Oganization Settings

+

Oganization Settings



{error &&

Failed to load

} {!org ? ( @@ -55,15 +55,53 @@ function SettingsOrganizationGeneral(params: any) { }} > {({ isSubmitting }) => ( -
- Name
- Description
- Slug
- Email
- - +
+ + + + + + + + + + + + + + + )} )} diff --git a/front/next.config.js b/front/next.config.js index 704aab78..0bacc25a 100644 --- a/front/next.config.js +++ b/front/next.config.js @@ -9,8 +9,9 @@ const nextConfig = { reactStrictMode: false, experimental: { appDir : true, + swcFileReading: false, }, - swcMinify: true, + swcMinify: false, compiler: { styledComponents: true, }, From 72597fcda679966342431190b24c80308e1e09ad Mon Sep 17 00:00:00 2001 From: swve Date: Sun, 14 May 2023 16:54:28 +0000 Subject: [PATCH 2/4] fix: improve collection creation page --- .../(withmenu)/collections/new/page.tsx | 90 ++++++++++++------- front/app/organizations/page.tsx | 31 ++++--- 2 files changed, 78 insertions(+), 43 deletions(-) diff --git a/front/app/_orgs/[orgslug]/(withmenu)/collections/new/page.tsx b/front/app/_orgs/[orgslug]/(withmenu)/collections/new/page.tsx index 84421186..28185a44 100644 --- a/front/app/_orgs/[orgslug]/(withmenu)/collections/new/page.tsx +++ b/front/app/_orgs/[orgslug]/(withmenu)/collections/new/page.tsx @@ -8,7 +8,7 @@ import { getAPIUrl, getUriWithOrg } from "@services/config/config"; import { swrFetcher } from "@services/utils/ts/requests"; import { getOrganizationContextInfo } from "@services/organizations/orgs"; -function NewCollection(params : any) { +function NewCollection(params: any) { const orgslug = params.params.orgslug; const [name, setName] = React.useState(""); const [org, setOrg] = React.useState({}) as any; @@ -50,38 +50,64 @@ function NewCollection(params : any) { return ( <> - Add new -
- - {!courses ? ( -

Loading...

- ) : ( -
- {courses.map((course: any) => ( -
- { - if (e.target.checked) { - setSelectedCourses([...selectedCourses, e.target.value]); - } else { - setSelectedCourses(selectedCourses.filter((item: any) => item !== e.target.value)); - } - }} - /> - -
- ))} -
- )} +
+ Add new + + + +{!courses ? ( +

Loading...

+) : ( +
+ {courses.map((course: any) => ( +
+ { + const courseId = e.target.value; + setSelectedCourses((prevSelectedCourses: string[]) => { + if (e.target.checked) { + return [...prevSelectedCourses, courseId]; + } else { + return prevSelectedCourses.filter((selectedCourse) => selectedCourse !== courseId); + } + }); + }} + className="mr-2 focus:outline-none focus:ring-2 focus:ring-blue-500" + /> + +
+ ))} + +
+)} + + + + +
-
- -
- ); } diff --git a/front/app/organizations/page.tsx b/front/app/organizations/page.tsx index 312ec33b..84b3fb64 100644 --- a/front/app/organizations/page.tsx +++ b/front/app/organizations/page.tsx @@ -9,38 +9,47 @@ import { getAPIUrl, getUriWithOrg } from "@services/config/config"; import AuthProvider from "@components/Security/AuthProvider"; const Organizations = () => { - const { data : organizations , error } = useSWR(`${getAPIUrl()}orgs/user/page/1/limit/10`, swrFetcher) + const { data: organizations, error } = useSWR(`${getAPIUrl()}orgs/user/page/1/limit/10`, swrFetcher) async function deleteOrganization(org_id: any) { const response = await deleteOrganizationFromBackend(org_id); - response && mutate(`${getAPIUrl()}orgs/user/page/1/limit/10`, organizations.filter((org: any) => org.org_id !== org_id)); + response && mutate(`${getAPIUrl()}orgs/user/page/1/limit/10`, organizations.filter((org: any) => org.org_id !== org_id)); } return ( <> - + Your Organizations{" "} - <Link href={"/organizations/new"}> - <button>+</button> + <Link href="/organizations/new"> + <button className="bg-blue-500 text-white px-2 py-1 rounded-md hover:bg-blue-600 focus:outline-none"> + + + </button> </Link>
- {error &&

Failed to load

} + + {error &&

Failed to load

} {!organizations ? ( -

Loading...

+

Loading...

) : (
{organizations.map((org: any) => ( -
- -

{org.name}

+
+ +

{org.name}

- +
))}
)} + ); }; From a5751b0a363b362144ab0854f29d0dcb8ebabdd4 Mon Sep 17 00:00:00 2001 From: swve Date: Sun, 14 May 2023 17:18:44 +0000 Subject: [PATCH 3/4] fix: css input issues --- .../course/[courseid]/edit/page.tsx | 4 +- .../(withmenu)/course/[courseid]/page.tsx | 40 ++++++++++--------- .../Pages/CourseEdit/Draggables/Activity.tsx | 34 +++++----------- .../Pages/CourseEdit/Draggables/Chapter.tsx | 6 +-- 4 files changed, 37 insertions(+), 47 deletions(-) diff --git a/front/app/_orgs/[orgslug]/(withmenu)/course/[courseid]/edit/page.tsx b/front/app/_orgs/[orgslug]/(withmenu)/course/[courseid]/edit/page.tsx index f77317c9..0422e5d0 100644 --- a/front/app/_orgs/[orgslug]/(withmenu)/course/[courseid]/edit/page.tsx +++ b/front/app/_orgs/[orgslug]/(withmenu)/course/[courseid]/edit/page.tsx @@ -96,10 +96,10 @@ function CourseEdit(params: any) { }; // Submit YouTube Video Upload - const submitExternalVideo = async (external_video_data : any, activity: any, chapterId: string) => { + const submitExternalVideo = async (external_video_data: any, activity: any, chapterId: string) => { console.log("submitExternalVideo", external_video_data); await updateChaptersMetadata(courseid, data); - await createExternalVideoActivity(external_video_data , activity, chapterId); + await createExternalVideoActivity(external_video_data, activity, chapterId); await getCourseChapters(); setNewActivityModal(false); }; diff --git a/front/app/_orgs/[orgslug]/(withmenu)/course/[courseid]/page.tsx b/front/app/_orgs/[orgslug]/(withmenu)/course/[courseid]/page.tsx index 37f0ce0e..a533d424 100644 --- a/front/app/_orgs/[orgslug]/(withmenu)/course/[courseid]/page.tsx +++ b/front/app/_orgs/[orgslug]/(withmenu)/course/[courseid]/page.tsx @@ -45,8 +45,8 @@ const CourseIdPage = (params: any) => { ) : (

-

Course

-

+

Course

+

{course.course.name}{" "} @@ -61,12 +61,12 @@ const CourseIdPage = (params: any) => { <> - + /> - + ); })} @@ -81,38 +81,42 @@ const CourseIdPage = (params: any) => { -

Description

+

Description

-

{course.course.description}

+

{course.course.description}

-

What you will learn

+

What you will learn

-

{course.course.learnings == ![] ? "no data" : course.course.learnings}

+

{course.course.learnings == ![] ? "no data" : course.course.learnings}

-

Course Lessons

+

Course Lessons

{course.chapters.map((chapter: any) => { return ( - <> -

{chapter.name}

- {chapter.activities.map((activity: any) => { +
+

{chapter.name}

+
{chapter.activities.map((activity: any) => { return ( <> -

+

{activity.name} - + {" "}

); - })} -      - + })}
+
); })}
diff --git a/front/components/Pages/CourseEdit/Draggables/Activity.tsx b/front/components/Pages/CourseEdit/Draggables/Activity.tsx index 3202099b..c3afd69d 100644 --- a/front/components/Pages/CourseEdit/Draggables/Activity.tsx +++ b/front/components/Pages/CourseEdit/Draggables/Activity.tsx @@ -1,6 +1,6 @@ import Link from "next/link"; import React from "react"; -import { Draggable } from "react-beautiful-dnd"; +import { Draggable } from "react-beautiful-dnd"; import { EyeOpenIcon, Pencil2Icon } from '@radix-ui/react-icons' import styled from "styled-components"; import { getUriWithOrg } from "@services/config/config"; @@ -10,38 +10,24 @@ function Activity(props: any) { return ( {(provided) => ( - +

{props.activity.name}

-   + href={getUriWithOrg(props.orgslug, "") + `/course/${props.courseid}/activity/${props.activity.id.replace("activity_", "")}`} + + rel="noopener noreferrer"> -   + - +
)}
); } -export const ActivityWrapper = styled.div` - padding: 2px; - padding-left: 17px; - list-style: none; - /* padding-left: 2px; */ - background-color: #f4f4f4c5; - border-radius: 7px; - margin: 15px; - display: flex; - align-items: center; - &:hover { - background-color: #8c949c7b; - } - -`; + export default Activity; diff --git a/front/components/Pages/CourseEdit/Draggables/Chapter.tsx b/front/components/Pages/CourseEdit/Draggables/Chapter.tsx index 850e189a..a26b1c86 100644 --- a/front/components/Pages/CourseEdit/Draggables/Chapter.tsx +++ b/front/components/Pages/CourseEdit/Draggables/Chapter.tsx @@ -1,7 +1,7 @@ import React from "react"; import styled from "styled-components"; import { DragDropContext, Droppable, Draggable } from "react-beautiful-dnd"; -import Activity, { ActivityWrapper } from "./Activity"; +import Activity from "./Activity"; function Chapter(props: any) { return ( @@ -14,8 +14,8 @@ function Chapter(props: any) { // isDragging={snapshot.isDragging} key={props.info.list.chapter.id} > -

- {props.info.list.chapter.name}{" "} +

+ {props.info.list.chapter.name} - - +