diff --git a/front/app/_orgs/[orgslug]/layout.tsx b/front/app/_orgs/[orgslug]/layout.tsx
index 4cdf5644..d9d693ce 100644
--- a/front/app/_orgs/[orgslug]/layout.tsx
+++ b/front/app/_orgs/[orgslug]/layout.tsx
@@ -1,15 +1,11 @@
-"use client";
+
import "@styles/globals.css";
-import { Menu } from "@components/UI/Elements/Menu";
-import AuthProvider from "@components/Security/AuthProvider";
export default function RootLayout({ children, params }: { children: React.ReactNode , params:any}) {
return (
<>
-
{children}
-
>
);
}
diff --git a/front/app/_orgs/[orgslug]/page.tsx b/front/app/_orgs/[orgslug]/page.tsx
index aeb615d3..20345208 100644
--- a/front/app/_orgs/[orgslug]/page.tsx
+++ b/front/app/_orgs/[orgslug]/page.tsx
@@ -1,21 +1,83 @@
-"use client";
-import { Title } from "@components/UI/Elements/Styles/Title";
-import { getUriWithOrg } from "@services/config/config";
-import Link from "next/link";
-import { usePathname } from "next/navigation";
-const OrgHomePage = (params: any) => {
+import { Menu } from "@components/UI/Elements/Menu";
+import { getBackendUrl, getUriWithOrg } from "@services/config/config";
+import { getOrgCourses } from "@services/courses/courses";
+import CoursesLogo from "public/svg/courses.svg";
+import CollectionsLogo from "public/svg/collections.svg";
+import Link from "next/link";
+import Image from "next/image";
+import { log } from "console";
+import AuthProvider from "@components/Security/AuthProvider";
+import { getOrgCollections } from "@services/courses/collections";
+
+const OrgHomePage = async (params: any) => {
const orgslug = params.params.orgslug;
- const pathname = usePathname();
+ const courses = await getOrgCourses(orgslug);
+ const collections = await getOrgCollections();
+
+ // function to remove "course_" from the course_id
+ function removeCoursePrefix(course_id: string) {
+ return course_id.replace("course_", "");
+ }
return (
-
Welcome {orgslug} 👋🏻
-
-
-
+
+
+
+
+
+ {/* Collections */}
+
+
+ {collections.map((collection: any) => (
+
+
+
+
{collection.name}
+
+ {collection.courses.slice(0,3).map((course: any) => (
+
+
}content/uploads/img/${course.thumbnail}`})
+
+ ))}
+
+
+
+
+ ))}
+
+
+ {/* Courses */}
+
+
+ {courses.map((course: any) => (
+
+
+
+
+
+
{course.name}
+
+ ))}
+
+
+
);
};
+
+const Title = (props: any) => {
+ return (
+
+ )
+}
+
+
export default OrgHomePage;
diff --git a/front/app/_orgs/[orgslug]/settings/layout.tsx b/front/app/_orgs/[orgslug]/settings/layout.tsx
index dfdb8154..10402e16 100644
--- a/front/app/_orgs/[orgslug]/settings/layout.tsx
+++ b/front/app/_orgs/[orgslug]/settings/layout.tsx
@@ -12,7 +12,7 @@ function SettingsLayout({ children, params }: { children: React.ReactNode, param
return (
<>
-
+
@@ -37,7 +37,7 @@ function SettingsLayout({ children, params }: { children: React.ReactNode, param
{children}
-
+
>
)
}
diff --git a/front/public/svg/collections.svg b/front/public/svg/collections.svg
new file mode 100644
index 00000000..c8c608f5
--- /dev/null
+++ b/front/public/svg/collections.svg
@@ -0,0 +1,3 @@
+
diff --git a/front/public/svg/courses.svg b/front/public/svg/courses.svg
new file mode 100644
index 00000000..1fe47207
--- /dev/null
+++ b/front/public/svg/courses.svg
@@ -0,0 +1,3 @@
+
diff --git a/front/services/courses/collections.ts b/front/services/courses/collections.ts
index 09ca1610..9228fbc2 100644
--- a/front/services/courses/collections.ts
+++ b/front/services/courses/collections.ts
@@ -18,3 +18,12 @@ export async function createCollection(collection: any) {
const res = await errorHandling(result);
return res;
}
+
+// Get collections
+// TODO : add per org filter
+export async function getOrgCollections() {
+ const result: any = await fetch(`${getAPIUrl()}collections/page/1/limit/10`);
+ const res = await errorHandling(result);
+ return res;
+}
+
diff --git a/front/services/courses/courses.ts b/front/services/courses/courses.ts
index 13486429..f200f46b 100644
--- a/front/services/courses/courses.ts
+++ b/front/services/courses/courses.ts
@@ -7,8 +7,9 @@ import { RequestBody, RequestBodyForm, errorHandling } from "@services/utils/ts/
*/
export async function getOrgCourses(org_id: number) {
- const result: any = await fetch(`${getAPIUrl()}courses/${org_id}/page/1/limit/10`, RequestBody("GET", null));
+ const result: any = await fetch(`${getAPIUrl()}courses/org_slug/${org_id}/page/1/limit/10`, RequestBody("GET", null));
const res = await errorHandling(result);
+
return res;
}
diff --git a/front/services/utils/ts/requests.ts b/front/services/utils/ts/requests.ts
index 802f92ec..253675b5 100644
--- a/front/services/utils/ts/requests.ts
+++ b/front/services/utils/ts/requests.ts
@@ -8,6 +8,10 @@ export const RequestBody = (method: string, data: any) => {
headers: HeadersConfig,
redirect: "follow",
credentials: "include",
+ // Next.js
+ next: {
+ revalidate: 1,
+ },
};
if (data) {
options.body = JSON.stringify(data);
diff --git a/src/services/users/schemas/users.py b/src/services/users/schemas/users.py
index 7bb24865..4dc33490 100644
--- a/src/services/users/schemas/users.py
+++ b/src/services/users/schemas/users.py
@@ -8,6 +8,8 @@ class UserOrganization(BaseModel):
def __getitem__(self, item):
return getattr(self, item)
+
+
class User(BaseModel):