-
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.
Merge pull request #17 from pesto-students/feature-kaban-board
kanban board
- Loading branch information
Showing
39 changed files
with
1,810 additions
and
69 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
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
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,38 @@ | ||
export interface Icard { | ||
_id: string; | ||
title: string; | ||
description: string; | ||
id: string; | ||
project?: Iproject; | ||
createdBy?: string; | ||
assignee?: string; | ||
estimatedDate?: Date; | ||
prioroity?: string; | ||
status?: string; | ||
reporter?: Iuser; | ||
} | ||
|
||
export interface Iproject { | ||
name: string; | ||
description: string; | ||
logo: string; | ||
users: Iuser[]; | ||
admins: Iadmin[]; | ||
id: string; | ||
} | ||
|
||
export interface Iuser { | ||
_id: string; | ||
firstName: string; | ||
lastName: string; | ||
email: string; | ||
imageUrl: string; | ||
} | ||
|
||
export interface Iadmin { | ||
_id: string; | ||
firstName: string; | ||
lastName: string; | ||
email: string; | ||
imageUrl: string; | ||
} |
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,48 @@ | ||
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit'; | ||
import { Iboard } from './types'; | ||
import { request } from 'app/axios'; | ||
|
||
export const fetchProject = createAsyncThunk('board/fetchProject', async () => { | ||
return request | ||
.get('/api/v1/projects/642569949ef06adb176ed64e') | ||
.then(({ data: { data } }) => data.data); | ||
}); | ||
|
||
const initialState: Iboard = { | ||
title: 'Kanban Board', | ||
project: null, | ||
loading: true, | ||
error: '', | ||
allUsers: [], | ||
}; | ||
|
||
const boardSlice = createSlice({ | ||
name: 'board', | ||
initialState, | ||
reducers: { | ||
setTitle: (state, action) => { | ||
state.title = action.payload; | ||
}, | ||
}, | ||
extraReducers: (builder) => { | ||
// builder.addCase(fetchProject.pending, (state) => { | ||
// state.loading = true; | ||
// }); | ||
builder.addCase(fetchProject.fulfilled, (state, action) => { | ||
const { admins, users } = action.payload; | ||
state.loading = false; | ||
state.project = action.payload; | ||
state.error = ''; | ||
state.allUsers = [...admins, ...users]; | ||
}); | ||
builder.addCase(fetchProject.rejected, (state, action) => { | ||
state.loading = false; | ||
state.project = null; | ||
state.error = action.error.message || 'Something went wrong'; | ||
}); | ||
}, | ||
}); | ||
|
||
export const { setTitle } = boardSlice.actions; | ||
|
||
export default boardSlice.reducer; |
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,35 @@ | ||
import { createSlice } from '@reduxjs/toolkit'; | ||
import { Ifilters } from '../types'; | ||
|
||
const initialState: Ifilters = { | ||
searchTerm: '', | ||
userIds: [], | ||
myOnly: false, | ||
recent: false, | ||
}; | ||
|
||
const filterSlice = createSlice({ | ||
name: 'board/filter', | ||
initialState, | ||
reducers: { | ||
setSearchTerm: (state, action) => { | ||
console.log('action', action); | ||
state.searchTerm = action.payload; | ||
}, | ||
setUserIds: (state, action) => { | ||
state.userIds = action.payload; | ||
}, | ||
setMyOnly: (state, action) => { | ||
state.myOnly = action.payload; | ||
}, | ||
setRecent: (state, action) => { | ||
state.recent = action.payload; | ||
}, | ||
setClearAll: () => initialState, | ||
}, | ||
}); | ||
|
||
export const { setSearchTerm, setUserIds, setMyOnly, setRecent, setClearAll } = | ||
filterSlice.actions; | ||
|
||
export default filterSlice.reducer; |
Oops, something went wrong.