Job View
This commit is contained in:
parent
f559b653f2
commit
4e6732c09b
4 changed files with 136 additions and 10 deletions
|
@ -1,8 +1,11 @@
|
|||
import { useState, useContext, useEffect } from "react";
|
||||
import { useLocation } from "react-router-dom";
|
||||
|
||||
import StoreContext from "../ctx/StoreContext.jsx";
|
||||
import JobContext from "../ctx/JobContext.jsx";
|
||||
import JobBox from "./components/JobBox.jsx";
|
||||
import JobTestSelector from "./components/JobTestSelector.jsx";
|
||||
import JobView from "./components/JobView.jsx";
|
||||
|
||||
import Button from "@mui/material/Button";
|
||||
import Dialog from "@mui/material/Dialog";
|
||||
|
@ -26,7 +29,7 @@ export default function Jobs() {
|
|||
dispatch: jobDispatch,
|
||||
jobBuilder,
|
||||
} = useContext(JobContext);
|
||||
|
||||
const location = useLocation();
|
||||
const { state: store, updateStore } = useContext(StoreContext);
|
||||
const [quickOpen, setQuickOpen] = useState(false);
|
||||
const [jobDialogOpen, setJobDialogOpen] = useState(false);
|
||||
|
@ -48,7 +51,7 @@ export default function Jobs() {
|
|||
const handleClickOpen = () => setJobDialogOpen(true);
|
||||
|
||||
const [queued, setQueued] = useState([]);
|
||||
useEffect(() => {}, [jobState.jobs]);
|
||||
useEffect(() => { }, [jobState.jobs, location]);
|
||||
|
||||
const handleClose = (confirmed) => () => {
|
||||
setJobDialogOpen(false);
|
||||
|
@ -58,9 +61,12 @@ export default function Jobs() {
|
|||
|
||||
return (
|
||||
<div className="jobs">
|
||||
{jobState.jobs.map((v, i) => (
|
||||
<JobBox key={i} job={v} />
|
||||
{location.hash === "" && jobState.jobs.map((v, i) => (
|
||||
<a key={i} href={`/jobs#${v.name}`} style={{ textDecoration: 'none' }}><JobBox job={v} /></a>
|
||||
))}
|
||||
{jobState.jobs.find((job)=>job.name===location.hash.slice(1)) && (
|
||||
<JobView job={jobState.jobs.find((job)=>job.name===location.hash.slice(1))}/>
|
||||
)}
|
||||
|
||||
<Dialog open={jobDialogOpen} onClose={handleClose()} fullScreen>
|
||||
<Toolbar />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue