move a bunch of files around
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import React from 'react';
|
||||
|
||||
import System from '../Components/Private/System.js'
|
||||
import Memberlist from '../Components/Private/Memberlist.js'
|
||||
|
||||
export default function Dash(props) {
|
||||
|
||||
return (<>
|
||||
<System />
|
||||
<Memberlist />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import * as BS from 'react-bootstrap';
|
||||
import { useParams } from "react-router-dom";
|
||||
import MemberPage from '../Components/Private/MemberPage.js'
|
||||
|
||||
export default function MemberPages(props) {
|
||||
const { memberID } = useParams();
|
||||
|
||||
|
||||
const memberpages = props.members.filter((member) => member.id === memberID)
|
||||
const memberpage = memberpages.map((member) => <MemberPage key={member.id} member={member} edit={props.edit}/>)
|
||||
const noMatch = memberpages.length === 0;
|
||||
|
||||
useEffect (() => {
|
||||
if (memberpages.length === 0) {
|
||||
}
|
||||
}, [memberpages])
|
||||
|
||||
if (noMatch) return (
|
||||
<BS.Alert variant="danger">You do not have a member with the ID '{memberID}' in your system. Please check the ID again.</BS.Alert>
|
||||
)
|
||||
|
||||
return (
|
||||
<>
|
||||
{memberpage}
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import * as BS from 'react-bootstrap';
|
||||
import { useParams } from "react-router-dom";
|
||||
import ProfilePage from '../Components/Public/ProfilePage.js'
|
||||
|
||||
export default function MemberPages(props) {
|
||||
const { memberID } = useParams();
|
||||
|
||||
const memberpages = props.members.filter((member) => member.id === memberID)
|
||||
const memberpage = memberpages.map((member) => <ProfilePage key={member.id} member={member}/>)
|
||||
const noMatch = memberpages.length === 0;
|
||||
|
||||
useEffect (() => {
|
||||
if (memberpages.length === 0) {
|
||||
}
|
||||
}, [memberpages])
|
||||
|
||||
if (noMatch) return (
|
||||
<BS.Alert variant="danger">This system does not have a member with the ID '{memberID}', or the member's visibility is set to private.</BS.Alert>
|
||||
)
|
||||
|
||||
return (
|
||||
<>
|
||||
{memberpage}
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import React from 'react';
|
||||
import * as BS from 'react-bootstrap';
|
||||
import { FaStar } from "react-icons/fa";
|
||||
import { useForm } from "react-hook-form";
|
||||
import history from "../History.js";
|
||||
import { Switch, Route, useRouteMatch } from 'react-router-dom';
|
||||
import Profile from '../Components/Public/Profile.js'
|
||||
|
||||
export default function Public () {
|
||||
const { path, url } = useRouteMatch();
|
||||
const { register, handleSubmit } = useForm();
|
||||
|
||||
const submitID = (data) => {
|
||||
history.push(`${url}/${data.sysID}`);
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
<Switch>
|
||||
<Route exact path={path}>
|
||||
<BS.Card>
|
||||
<BS.Card.Header>
|
||||
<BS.Card.Title><FaStar className="mr-3" />Profile</BS.Card.Title>
|
||||
</BS.Card.Header>
|
||||
<BS.Card.Body>
|
||||
<BS.Form onSubmit={handleSubmit(submitID)}>
|
||||
<BS.Form.Label>
|
||||
Submit a system ID to view to that system's profile.
|
||||
</BS.Form.Label>
|
||||
<BS.Form.Row>
|
||||
<BS.Col className="mb-1" xs={12} lg={10}>
|
||||
<BS.Form.Control name="sysID" {...register("sysID")} defaultValue="" />
|
||||
</BS.Col>
|
||||
<BS.Col>
|
||||
<BS.Button variant="primary" type="submit" block >Submit</BS.Button>
|
||||
</BS.Col>
|
||||
</BS.Form.Row>
|
||||
</BS.Form>
|
||||
</BS.Card.Body>
|
||||
</BS.Card>
|
||||
</Route>
|
||||
<Route path={`${path}/:sysID`}>
|
||||
<Profile />
|
||||
</Route>
|
||||
</Switch>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user