made adjustments to the button for add task in the viewer
This commit is contained in:
parent
ea94fab0a5
commit
d7439f5244
3 changed files with 36 additions and 17 deletions
|
|
@ -273,7 +273,7 @@ export default function FieldDrawer(props: Props) {
|
||||||
<Weather longitude={field.center().longitude} latitude={field.center().latitude} />
|
<Weather longitude={field.center().longitude} latitude={field.center().latitude} />
|
||||||
</TabPanelMine>
|
</TabPanelMine>
|
||||||
<TabPanelMine value={value} index={2}>
|
<TabPanelMine value={value} index={2}>
|
||||||
<TaskViewer drawerView objectKey={field.key()} loadKeys={taskLoadKeys} />
|
<TaskViewer drawerView objectKey={field.key()} loadKeys={taskLoadKeys} overlayButton />
|
||||||
</TabPanelMine>
|
</TabPanelMine>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ export default function Tasks() {
|
||||||
return (
|
return (
|
||||||
<PageContainer>
|
<PageContainer>
|
||||||
<Box padding={2}>
|
<Box padding={2}>
|
||||||
<TaskViewer />
|
<TaskViewer overlayButton/>
|
||||||
</Box>
|
</Box>
|
||||||
</PageContainer>
|
</PageContainer>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ interface ViewProps {
|
||||||
label?: string;
|
label?: string;
|
||||||
drawerView?: boolean;
|
drawerView?: boolean;
|
||||||
loadKeys?: string[]; //if you want to load tasks for a specific object(s)
|
loadKeys?: string[]; //if you want to load tasks for a specific object(s)
|
||||||
|
overlayButton?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface TabPanelProps {
|
interface TabPanelProps {
|
||||||
|
|
@ -51,6 +52,22 @@ const useStyles = makeStyles((theme: Theme) => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fab: {
|
fab: {
|
||||||
|
zIndex: 20,
|
||||||
|
background: theme.palette.primary.main,
|
||||||
|
"&:hover": {
|
||||||
|
background: theme.palette.primary.main
|
||||||
|
},
|
||||||
|
"&:focus": {
|
||||||
|
background: theme.palette.primary.main
|
||||||
|
},
|
||||||
|
position: "absolute",
|
||||||
|
bottom: theme.spacing(8), //for mobile navigator
|
||||||
|
right: theme.spacing(2),
|
||||||
|
[theme.breakpoints.up("sm")]: {
|
||||||
|
bottom: theme.spacing(2)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
overlayFab: {
|
||||||
zIndex: 20,
|
zIndex: 20,
|
||||||
background: theme.palette.primary.main,
|
background: theme.palette.primary.main,
|
||||||
"&:hover": {
|
"&:hover": {
|
||||||
|
|
@ -70,7 +87,7 @@ const useStyles = makeStyles((theme: Theme) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
export default function TaskViewer(props: ViewProps) {
|
export default function TaskViewer(props: ViewProps) {
|
||||||
const { objectKey, label, drawerView, loadKeys } = props;
|
const { objectKey, label, drawerView, loadKeys, overlayButton } = props;
|
||||||
const [{ user, as }] = useGlobalState();
|
const [{ user, as }] = useGlobalState();
|
||||||
//const [{ as }] = useGlobalState();
|
//const [{ as }] = useGlobalState();
|
||||||
const taskAPI = useTaskAPI();
|
const taskAPI = useTaskAPI();
|
||||||
|
|
@ -133,11 +150,13 @@ export default function TaskViewer(props: ViewProps) {
|
||||||
taskAPI
|
taskAPI
|
||||||
.getMultiTasks(loadKeys, as)
|
.getMultiTasks(loadKeys, as)
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
|
if(resp.data.tasks){
|
||||||
resp.data.tasks.forEach(task => {
|
resp.data.tasks.forEach(task => {
|
||||||
if (task.settings) {
|
if (task.settings) {
|
||||||
temp.set(task.key, Task.any(task));
|
temp.set(task.key, Task.any(task));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
setTasks(temp);
|
setTasks(temp);
|
||||||
setLoaded(true);
|
setLoaded(true);
|
||||||
})
|
})
|
||||||
|
|
@ -229,14 +248,7 @@ export default function TaskViewer(props: ViewProps) {
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
{isMobile || drawerView ? (
|
{isMobile || drawerView ? (
|
||||||
<Box>
|
<Box height={"100%"} position={"relative"}>
|
||||||
<Fab
|
|
||||||
onClick={openDialog}
|
|
||||||
aria-label="Create Task"
|
|
||||||
className={classes.fab}
|
|
||||||
size={isMobile ? "medium" : "large"}>
|
|
||||||
<AddIcon />
|
|
||||||
</Fab>
|
|
||||||
<TabPanelMine value={value} index={0}>
|
<TabPanelMine value={value} index={0}>
|
||||||
<Box paddingBottom={2}>
|
<Box paddingBottom={2}>
|
||||||
<TaskCalendar
|
<TaskCalendar
|
||||||
|
|
@ -309,6 +321,13 @@ export default function TaskViewer(props: ViewProps) {
|
||||||
openTask={(taskId: string) => openSelectedTask(taskId)}
|
openTask={(taskId: string) => openSelectedTask(taskId)}
|
||||||
/>
|
/>
|
||||||
</TabPanelMine>
|
</TabPanelMine>
|
||||||
|
<Fab
|
||||||
|
onClick={openDialog}
|
||||||
|
aria-label="Create Task"
|
||||||
|
className={overlayButton ? classes.overlayFab : classes.fab}
|
||||||
|
size={isMobile ? "medium" : "large"}>
|
||||||
|
<AddIcon />
|
||||||
|
</Fab>
|
||||||
</Box>
|
</Box>
|
||||||
) : (
|
) : (
|
||||||
<Grid container direction="row" alignContent="center" alignItems="center">
|
<Grid container direction="row" alignContent="center" alignItems="center">
|
||||||
|
|
@ -398,7 +417,7 @@ export default function TaskViewer(props: ViewProps) {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box height={"100%"}>
|
||||||
{!loaded ? <LinearProgress style={{ marginTop: 20 }} /> : viewer()}
|
{!loaded ? <LinearProgress style={{ marginTop: 20 }} /> : viewer()}
|
||||||
<TaskSettings
|
<TaskSettings
|
||||||
open={newTaskDialog}
|
open={newTaskDialog}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue