ENCOA-316 ENCOA-317:
Refactor components to remove Layout wrapper and pass it in the App component , implemented a skeleton feedback while loading page and improved API calls related to Dashboard/User Profile
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import Layout from "@/components/High/Layout";
|
||||
import useUser from "@/hooks/useUser";
|
||||
import useUsers from "@/hooks/useUsers";
|
||||
|
||||
import { Type, User } from "@/interfaces/user";
|
||||
import {sessionOptions} from "@/lib/session";
|
||||
import useFilterStore from "@/stores/listFilterStore";
|
||||
@@ -10,8 +8,7 @@ import { shouldRedirectHome } from "@/utils/navigation.disabled";
|
||||
import {withIronSessionSsr} from "iron-session/next";
|
||||
import Head from "next/head";
|
||||
import {useRouter} from "next/router";
|
||||
import {useEffect} from "react";
|
||||
import {BsArrowLeft, BsChevronLeft} from "react-icons/bs";
|
||||
import { BsChevronLeft} from "react-icons/bs";
|
||||
import {ToastContainer} from "react-toastify";
|
||||
import UserList from "../(admin)/Lists/UserList";
|
||||
|
||||
@@ -51,7 +48,7 @@ export default function UsersListPage({ user, type }: Props) {
|
||||
</Head>
|
||||
<ToastContainer />
|
||||
|
||||
<Layout user={user}>
|
||||
<>
|
||||
<UserList
|
||||
user={user}
|
||||
type={type}
|
||||
@@ -70,7 +67,7 @@ export default function UsersListPage({ user, type }: Props) {
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
</Layout>
|
||||
</>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,27 +1,22 @@
|
||||
import useFilterRecordsByUser from "@/hooks/useFilterRecordsByUser";
|
||||
import useGroups from "@/hooks/useGroups";
|
||||
import useUsers, { userHashStudent } from "@/hooks/useUsers";
|
||||
import { Group, Stat, StudentUser, User } from "@/interfaces/user";
|
||||
import { getUserCompanyName } from "@/resources/user";
|
||||
import clsx from "clsx";
|
||||
import { useRouter } from "next/router";
|
||||
import { BsArrowLeft, BsArrowRepeat, BsChevronLeft } from "react-icons/bs";
|
||||
import { BsChevronLeft } from "react-icons/bs";
|
||||
import { mapBy, serialize } from "@/utils";
|
||||
import { withIronSessionSsr } from "iron-session/next";
|
||||
import { getEntitiesUsers, getUsers } from "@/utils/users.be";
|
||||
import { sessionOptions } from "@/lib/session";
|
||||
import { checkAccess, findAllowedEntities } from "@/utils/permissions";
|
||||
import { getEntities, getEntitiesWithRoles } from "@/utils/entities.be";
|
||||
import { getEntitiesWithRoles } from "@/utils/entities.be";
|
||||
import { Entity } from "@/interfaces/entity";
|
||||
import { getParticipantGroups, getParticipantsGroups } from "@/utils/groups.be";
|
||||
import { getParticipantsGroups } from "@/utils/groups.be";
|
||||
import StudentPerformanceList from "../(admin)/Lists/StudentPerformanceList";
|
||||
import Head from "next/head";
|
||||
import { ToastContainer } from "react-toastify";
|
||||
import Layout from "@/components/High/Layout";
|
||||
import { requestUser } from "@/utils/api";
|
||||
import { redirect } from "@/utils";
|
||||
|
||||
export const getServerSideProps = withIronSessionSsr(async ({ req, res, query }) => {
|
||||
export const getServerSideProps = withIronSessionSsr(async ({ req, res }) => {
|
||||
const user = await requestUser(req, res)
|
||||
if (!user) return redirect("/login")
|
||||
|
||||
@@ -74,7 +69,7 @@ const StudentPerformance = ({ user, students, entities, groups }: Props) => {
|
||||
</Head>
|
||||
<ToastContainer />
|
||||
|
||||
<Layout user={user}>
|
||||
<>
|
||||
<div className="flex items-center gap-2">
|
||||
<button
|
||||
onClick={() => {
|
||||
@@ -86,7 +81,7 @@ const StudentPerformance = ({ user, students, entities, groups }: Props) => {
|
||||
<h2 className="font-bold text-2xl">Student Performance ({students.length})</h2>
|
||||
</div>
|
||||
<StudentPerformanceList items={performanceStudents} stats={stats} />
|
||||
</Layout>
|
||||
</>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user