mirror of
https://github.com/lemeow125/Borrowing-TrackerFrontend.git
synced 2024-11-17 06:19:27 +08:00
Added set types to restriction components and added placeholder content for students and teachers in dashboard page
This commit is contained in:
parent
34bb54f8b1
commit
63b32feb38
3 changed files with 8 additions and 2 deletions
|
@ -5,7 +5,7 @@ import { CircularProgress } from "@mui/material";
|
||||||
import styles from "../../styles";
|
import styles from "../../styles";
|
||||||
|
|
||||||
type props = {
|
type props = {
|
||||||
allow_only: string;
|
allow_only: "Student" | "Teacher" | "Technician";
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
};
|
};
|
||||||
export default function RestrictedComponent(props: props) {
|
export default function RestrictedComponent(props: props) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { toast } from "react-toastify";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
|
||||||
type props = {
|
type props = {
|
||||||
allow_only: string;
|
allow_only: "Student" | "Teacher" | "Technician";
|
||||||
};
|
};
|
||||||
export default function RestrictedPage(props: props) {
|
export default function RestrictedPage(props: props) {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
|
@ -13,6 +13,12 @@ export default function Dashboard() {
|
||||||
<TechnicianEquipmentButtons />
|
<TechnicianEquipmentButtons />
|
||||||
<TechnicianLogButtons />
|
<TechnicianLogButtons />
|
||||||
</RestrictedComponent>
|
</RestrictedComponent>
|
||||||
|
<RestrictedComponent allow_only={"Student"}>
|
||||||
|
<p style={styles.text_dark}>Welcome student!</p>
|
||||||
|
</RestrictedComponent>
|
||||||
|
<RestrictedComponent allow_only={"Teacher"}>
|
||||||
|
<p style={styles.text_dark}>Welcome teacher!</p>
|
||||||
|
</RestrictedComponent>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue