diff --git a/src/forge/Notice/Index.jsx b/src/forge/Notice/Index.jsx new file mode 100644 index 00000000..d9d04d59 --- /dev/null +++ b/src/forge/Notice/Index.jsx @@ -0,0 +1,88 @@ +import React, { useEffect, useState } from "react"; +import { Link } from 'react-router-dom'; +import './Index.scss'; + +import Loadable from "react-loadable"; +import Loading from "../../Loading"; +import { Route, Switch } from "react-router-dom"; + +const Notify = Loadable({ + loader: () => import("./Notify"), + loading: Loading, +}); +const UndoEvent = Loadable({ + loader: () => import("./UndoEvent"), + loading: Loading, +}); +function Index(props){ + const username = props.match.params.username; + const pathname = props.history.location.pathname; + const user = props.user; + const undo_messages = props.undo_messages; + + const [ menu , setMenu ] = useState("notify"); + const [ messages , setMessages ] = useState(0); + const [ transferProjects , setTransferProjects ] = useState(0); + + useEffect(()=>{ + if(user){ + setTransferProjects(user.undo_transfer_projects); + } + if(undo_messages){ + setMessages(undo_messages); + } + },[user,undo_messages]) + + useEffect(()=>{ + if(pathname && username){ + if(pathname === `/users/${username}/notice`){ + setMenu("notify"); + } + if(pathname === `/users/${username}/notice/undo`){ + setMenu("undo"); + } + } + },[pathname]) + + function fetchUser(){ + props && props.fetchUser(); + } + + function changeNum(){ + fetchUser(); + } + + return ( +
+ + + { + return ; + }} + > + { + return ; + }} + > + +
+ ); +} +export default Index;