-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1dbc8bb
commit c4b1b02
Showing
9 changed files
with
12,496 additions
and
44 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { FC } from 'react'; | ||
import { ModalComponent } from './ModalComponent' | ||
import { useAppDispatch } from './Store/hooks' | ||
import { deleteProject } from './Store/slices/projects' | ||
import { InfoboxComponent } from './InfoboxComponent'; | ||
|
||
type Props = { | ||
project: DBProject | ||
callback?: (status: boolean) => void | ||
} | ||
|
||
const Component: FC<Props> = ({ project, callback }) => { | ||
const dispatch = useAppDispatch(); | ||
|
||
const confirmCallback = async (evt: React.MouseEvent) => { | ||
evt.preventDefault(); | ||
const rpcResult = await window.electron.deleteProject(project.name); | ||
if (rpcResult.success) { | ||
dispatch(deleteProject({ name: project.name })); | ||
callback && callback(true); | ||
} | ||
}; | ||
|
||
const cancelCallback = async (evt: React.MouseEvent) => { | ||
evt.preventDefault(); | ||
callback && callback(false); | ||
}; | ||
|
||
return ModalComponent({ | ||
title: 'Delete Project', | ||
children: <> | ||
<p>Are you sure you want to delete this project?</p> | ||
<InfoboxComponent type="danger" title="Warning"> | ||
<p>Deleting a project is a hazardious action.</p> | ||
<p>If you delete a project, it'll also delete all its tasks and task-definitions.</p> | ||
<p>Maybe consider marking it as inactive?</p> | ||
</InfoboxComponent> | ||
</>, | ||
buttons: <> | ||
<button className="button is-danger" onClick={confirmCallback}>Yes</button> | ||
<button className="button is-primary" onClick={cancelCallback}>No</button> | ||
</> | ||
}); | ||
} | ||
|
||
export const DeleteProjectModal = Component; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { FC } from 'react'; | ||
import { ModalComponent } from './ModalComponent' | ||
import { useAppDispatch } from './Store/hooks' | ||
import { removeTaskDefinition } from './Store/slices/taskDefinitions' | ||
import { InfoboxComponent } from './InfoboxComponent'; | ||
|
||
type Props = { | ||
taskDefinition: DBTaskDefinition | ||
callback?: (status: boolean) => void | ||
} | ||
|
||
const Component: FC<Props> = ({ taskDefinition, callback }) => { | ||
const dispatch = useAppDispatch(); | ||
|
||
const confirmCallback = async (evt: React.MouseEvent) => { | ||
evt.preventDefault(); | ||
const rpcResult = await window.electron.deleteTaskDefinition(taskDefinition); | ||
if (rpcResult.success) { | ||
dispatch(removeTaskDefinition(taskDefinition)); | ||
callback && callback(true); | ||
} | ||
}; | ||
|
||
const cancelCallback = async (evt: React.MouseEvent) => { | ||
evt.preventDefault(); | ||
callback && callback(false); | ||
}; | ||
|
||
return ModalComponent({ | ||
title: 'Delete Task Definition', | ||
children: <> | ||
<p>Are you sure you want to delete this task definition?</p> | ||
<InfoboxComponent type="danger" title="Warning"> | ||
<p>Deleting a task definition is a hazardious action.</p> | ||
<p>If you delete a task definition, it'll also delete all its tasks.</p> | ||
<p>Maybe consider marking it as inactive?</p> | ||
</InfoboxComponent> | ||
</>, | ||
buttons: <> | ||
<button className="button is-danger" onClick={confirmCallback}>Yes</button> | ||
<button className="button is-primary" onClick={cancelCallback}>No</button> | ||
</> | ||
}); | ||
} | ||
|
||
export const DeleteTaskDefinitionModal = Component; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { FC } from 'react'; | ||
import { ModalComponent } from './ModalComponent' | ||
import { useAppDispatch } from './Store/hooks' | ||
import { deleteTask } from './Store/slices/tasks' | ||
|
||
type Props = { | ||
task: DBTask | ||
callback?: (status: boolean) => void | ||
} | ||
|
||
const Component: FC<Props> = ({ task, callback }) => { | ||
const dispatch = useAppDispatch(); | ||
|
||
const confirmCallback = async (evt: React.MouseEvent) => { | ||
evt.preventDefault(); | ||
const rpcResult = await window.electron.deleteTask(task); | ||
if (rpcResult.success) { | ||
dispatch(deleteTask(task)); | ||
callback && callback(true); | ||
} | ||
}; | ||
|
||
const cancelCallback = async (evt: React.MouseEvent) => { | ||
evt.preventDefault(); | ||
callback && callback(false); | ||
}; | ||
|
||
return ModalComponent({ | ||
title: 'Delete Task', | ||
children: <> | ||
<p>Are you sure you want to delete this task</p> | ||
</>, | ||
buttons: <> | ||
<button className="button is-danger" onClick={confirmCallback}>Yes</button> | ||
<button className="button is-primary" onClick={cancelCallback}>No</button> | ||
</> | ||
}); | ||
} | ||
|
||
export const DeleteTaskModal = Component; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters