Design comparison
Solution retrospective
Drag and Drop
During this project, I've learned how to work with dnd-kit and make draggable content based on examples provided by their playground. You can use drag and drop to change board order on the big screen. You can drag any task between columns. On AddBoardModal and EditBoardModal you can change column order. On AddTaskModal or EditTaskModal you can change the subtask order
Radix-UI
First time I've used it. I wanted to try to improve accessibility features on my project. Beginning was hard but I managed to prepare this app using Radix-UI
FireBase
You can log in by clicking the login button, LoginModal will open if you don't have an account, you have to sign up using RegisterModal, and any changes you do to your task will be uploaded to the FireBase. It also tracks if you have DarkMode On and which current opened board.
React-firebase-hooks
It was used for login and sign-in purposes
useCreateUserWithEmailAndPassword(auth); useSignInWithEmailAndPassword(auth);
React-loading-skeleton
To improve the user experience when the web is loading
Recoil
For managing states through project boardAtom - when the page is loaded, it keeps all boards, and it's updated with every change modalAtom - keep tracking if any of the models are opened and if yes which one should be opened settingsModalAtom - tracks:
darkMode: boolean; isSidebarOpen: boolean; isLoaded: boolean; activeBoard: string; isBoardModalListOpen: boolean; activateColumn: number; activateTask: number; activateTaskName: string;
Features improvement
On Firebase all users' boards are uploaded with one property, for performance and readability, creating a collection for each board will be better. In some situations, the code is not DRY. In the future refactor the code to be drier.
Also because the database has a lot of nested levels I'm not sure mapping a couple of times to update a task is a good practice but I couldn't find another solution for this And this nested mapping is occurring a few times in my project.
const updatedBoard = boardState.map((board) => {
if (board.name === settingState.activeBoard) {
const activatedColumns = board.columns.map((col) => {
if (col.name === getValues("status")) {
const updatedTask = col.tasks.map((task) => {
return task.id === editedTask?.id ? editedTask : task;
});
return { ...col, tasks: updatedTask };
}
return col;
});
return { ...board, columns: activatedColumns };
}
return board;
});
Community feedback
- @scottmotionPosted over 1 year ago
Hey Kamil, I'm working on this project now and I ran across similar problems with nested data in Firebase. I solved this by flattening the data structure to be a top level collection of Boards with 2 sub-collections: Columns and Tasks. I changed Task.status to Task.columnId and put in the Firebase key of the parent column. Then I did a querySnapshot for each column's tasks based on the columnId. Now moving the Task to a different Column is as simple as changing the Task.columnId value. BTW I'm holding the subtasks in an array within each Task, not a sub-collection.
Marked as helpful0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord