Updates
This commit is contained in:
parent
9bd99ccab3
commit
3b9c8a5eae
@ -0,0 +1,3 @@
|
||||
export default function AddDeploymentUserForm() {
|
||||
return null;
|
||||
}
|
||||
15
src/components/pages/admin/users/add-user/index.tsx
Normal file
15
src/components/pages/admin/users/add-user/index.tsx
Normal file
@ -0,0 +1,15 @@
|
||||
import { Fragment, useContext } from "react";
|
||||
import { AppContext } from "@/src/pages/_app";
|
||||
import Divider from "@/twui/components/layout/Divider";
|
||||
import AdminHero from "@/src/components/general/admin/hero";
|
||||
|
||||
export default function Main() {
|
||||
const { pageProps } = useContext(AppContext);
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<AdminHero title={`Add New User`} />
|
||||
<Divider />
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
34
src/components/pages/admin/users/deployment-user/index.tsx
Normal file
34
src/components/pages/admin/users/deployment-user/index.tsx
Normal file
@ -0,0 +1,34 @@
|
||||
import { Fragment, useContext } from "react";
|
||||
import { AppContext } from "@/src/pages/_app";
|
||||
import Divider from "@/twui/components/layout/Divider";
|
||||
import AdminHero from "@/src/components/general/admin/hero";
|
||||
import Tag from "@/twui/components/elements/Tag";
|
||||
import Row from "@/twui/components/layout/Row";
|
||||
|
||||
export default function Main() {
|
||||
const { pageProps } = useContext(AppContext);
|
||||
const { deployment_user } = pageProps;
|
||||
|
||||
if (!deployment_user?.id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const is_super_admin = Boolean(deployment_user.is_super_admin);
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<AdminHero
|
||||
title={
|
||||
<Row>
|
||||
<span>{deployment_user?.first_name}</span>
|
||||
<span>{deployment_user?.last_name}</span>
|
||||
{is_super_admin ? (
|
||||
<Tag className="inline">Super Admin</Tag>
|
||||
) : null}
|
||||
</Row>
|
||||
}
|
||||
/>
|
||||
<Divider />
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
import Main from "@/src/components/pages/admin/users";
|
||||
import Main from "@/src/components/pages/admin/users/deployment-user";
|
||||
import { NSQLITE_TURBOCI_ADMIN_USERS } from "@/src/db/types";
|
||||
import { _n } from "@/src/exports/client-exports";
|
||||
import defaultAdminProps from "@/src/functions/pages/admin/default-admin-props";
|
||||
import Layout from "@/src/layouts/admin";
|
||||
import NSQLite from "@moduletrace/nsqlite";
|
||||
@ -16,7 +17,7 @@ export default function AdminSingleDeploymentUser() {
|
||||
export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
||||
return await defaultAdminProps({
|
||||
ctx,
|
||||
async propsFn({ user, props }) {
|
||||
async propsFn({ user, props, query }) {
|
||||
if (!user.super_admin) {
|
||||
return `/admin`;
|
||||
}
|
||||
@ -24,11 +25,12 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
||||
const users_res = await NSQLite.select<NSQLITE_TURBOCI_ADMIN_USERS>(
|
||||
{
|
||||
table: "users",
|
||||
targetId: _n(query?.deployment_user_id),
|
||||
},
|
||||
);
|
||||
|
||||
return {
|
||||
deployment_users: users_res.payload,
|
||||
deployment_user: users_res.singleRes,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
26
src/pages/admin/users/add-user/index.tsx
Normal file
26
src/pages/admin/users/add-user/index.tsx
Normal file
@ -0,0 +1,26 @@
|
||||
import Main from "@/src/components/pages/admin/users/add-user";
|
||||
import { _n } from "@/src/exports/client-exports";
|
||||
import defaultAdminProps from "@/src/functions/pages/admin/default-admin-props";
|
||||
import Layout from "@/src/layouts/admin";
|
||||
import { GetServerSideProps } from "next";
|
||||
|
||||
export default function AdminAddDeploymentUser() {
|
||||
return (
|
||||
<Layout>
|
||||
<Main />
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
||||
return await defaultAdminProps({
|
||||
ctx,
|
||||
async propsFn({ user, props, query }) {
|
||||
if (!user.super_admin) {
|
||||
return `/admin`;
|
||||
}
|
||||
|
||||
return {};
|
||||
},
|
||||
});
|
||||
};
|
||||
@ -199,6 +199,7 @@ export type PagePropsType = {
|
||||
ws_url?: string | null;
|
||||
host?: string | null;
|
||||
deployment_users?: NSQLITE_TURBOCI_ADMIN_USERS[] | null;
|
||||
deployment_user?: NSQLITE_TURBOCI_ADMIN_USERS | null;
|
||||
};
|
||||
|
||||
export type APIReqObject = {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user