Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

minor fixes & improvements

Blue Mouse4c041c54b4f5
diff --git a/src/components/Modal/index.jsx b/src/components/Modal/index.jsx
deleted file mode 100644
index b94dd9416..000000000
--- a/src/components/Modal/index.jsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import React from 'react'
-import BM from 'react-bootstrap/Modal'
-import Button from 'react-bootstrap/Button'
-
-const NewLineText = ({ text }) => {
- return text.split('\n').map(str => <p key={str}>{str}</p>)
-}
-
-const Modal = ({ title, text, onSubmit = () => {}, onCancel, cancelText, submitText = 'Save changes' }) => (
- <BM show={true} onHide={onCancel}>
- <BM.Header closeButton>
- <BM.Title>{title}</BM.Title>
- </BM.Header>
- <BM.Body>
- <NewLineText text={text} />
- </BM.Body>
- <BM.Footer>
- {onCancel && cancelText && (
- <Button variant="secondary" onClick={onCancel}>
- {cancelText}
- </Button>
- )}
- <Button variant="primary" onClick={onSubmit}>
- {submitText}
- </Button>
- </BM.Footer>
- </BM>
-)
-
-export default Modal
\ No newline at end of file
diff --git a/src/redux/actions/ui/index.js b/src/redux/actions/ui/index.js
index cd290c70f..091efd7c7 100644
--- a/src/redux/actions/ui/index.js
+++ b/src/redux/actions/ui/index.js
@@ -11,6 +11,13 @@ const setProjects = (projects) => ({
}
})
+const removeProject = (pid) => ({
+ type: types.REMOVE_PROJECT,
+ payload: {
+ pid,
+ },
+})
+
const setProjectsError = (error) => ({
type: types.SET_PROJECTS_ERROR,
payload: {
@@ -30,6 +37,7 @@ const UIActions = {
setProjects,
setProjectsError,
setProjectsLoading,
+ removeProject,
}
export default UIActions
diff --git a/src/redux/actions/ui/types.js b/src/redux/actions/ui/types.js
index 6f9da68fc..610e807cb 100644
--- a/src/redux/actions/ui/types.js
+++ b/src/redux/actions/ui/types.js
@@ -3,6 +3,7 @@ export const types = {
LOAD_PROJECTS: 'LOAD_PROJECTS',
SET_PROJECTS_ERROR: 'SET_PROJECTS_ERROR',
SET_PROJECTS_LOADING: 'SET_PROJECTS_LOADING',
+ REMOVE_PROJECT: 'REMOVE_PROJECT',
// Async
SET_PROJECTS: 'SET_PROJECTS',
diff --git a/src/redux/reducers/ui/projects.js b/src/redux/reducers/ui/projects.js
index 02bf4ff19..ade41ad71 100644
--- a/src/redux/reducers/ui/projects.js
+++ b/src/redux/reducers/ui/projects.js
@@ -1,4 +1,5 @@
import { types } from 'redux/actions/ui/types'
+import _filter from 'lodash/filter'
const getInitialState = () => {
return {
@@ -27,6 +28,14 @@ const projectsReducer = (state = getInitialState(), { type, payload }) => {
}
}
+ case types.REMOVE_PROJECT: {
+ const { pid } = payload
+ return {
+ ...state,
+ projects: _filter(state.projects, (project) => project.id !== pid)
+ }
+ }
+
case types.SET_PROJECTS_LOADING: {
const { isLoading } = payload
return {