-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
12 changed files
with
275 additions
and
255 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1 +1 @@ | ||
{"boards":[{"name":"Marketing Plan","columns":[{"name":"Todo","tasks":[{"title":"Plan Product Hunt launch","description":"","status":"Todo","subtasks":[{"title":"Find hunter","isCompleted":false},{"title":"Gather assets","isCompleted":false},{"title":"Draft product page","isCompleted":false},{"title":"Notify customers","isCompleted":false},{"title":"Notify network","isCompleted":false},{"title":"Launch!","isCompleted":false}]},{"title":"Share on Show HN","description":"","status":"","subtasks":[{"title":"Draft out HN post","isCompleted":false},{"title":"Get feedback and refine","isCompleted":false},{"title":"Publish post","isCompleted":false}]},{"title":"Write launch article to publish on multiple channels","description":"","status":"","subtasks":[{"title":"Write article","isCompleted":false},{"title":"Publish on LinkedIn","isCompleted":false},{"title":"Publish on Inndie Hackers","isCompleted":false},{"title":"Publish on Medium","isCompleted":false}]}]},{"name":"Doing","tasks":[]},{"name":"Done","tasks":[]}]},{"name":"Roadmap","columns":[{"name":"Now","tasks":[{"title":"Launch version one","description":"","status":"Now","subtasks":[{"title":"Launch privately to our waitlist","isCompleted":false},{"title":"Launch publicly on PH, HN, etc.","isCompleted":false}]},{"title":"Review early feedback and plan next steps for roadmap","description":"Beyond the initial launch, we're keeping the initial roadmap completely empty. This meeting will help us plan out our next steps based on actual customer feedback.","status":"Now","subtasks":[{"title":"Interview 10 customers","isCompleted":false},{"title":"Review common customer pain points and suggestions","isCompleted":false},{"title":"Outline next steps for our roadmap","isCompleted":false}]}]},{"name":"Next","tasks":[]},{"name":"Later","tasks":[]}]},{"name":"renamed board","columns":[{"name":"col 111","tasks":[]},{"name":"col 333","tasks":[]},{"name":"9999","tasks":[]}]}]} | ||
{"boards":[{"name":"Marketing Plan","columns":[{"name":"Todo","tasks":[{"title":"Plan Product Hunt launch","description":"","status":"Todo","subtasks":[{"title":"Find hunter","isCompleted":true},{"title":"Gather assets","isCompleted":true},{"title":"Draft product page","isCompleted":false},{"title":"Notify customers","isCompleted":false},{"title":"Notify network","isCompleted":false},{"title":"Launch!","isCompleted":false}]},{"title":"Write launch article to publish on multiple channels","description":"","status":"","subtasks":[{"title":"Write article","isCompleted":false},{"title":"Publish on LinkedIn","isCompleted":false},{"title":"Publish on Inndie Hackers","isCompleted":false},{"title":"Publish on Medium","isCompleted":false}]}]},{"name":"Doing","tasks":[]},{"name":"Done","tasks":[{"title":"Share on Show HN","description":"","status":"Done","subtasks":[{"title":"Draft out HN post","isCompleted":true},{"title":"Get feedback and refine","isCompleted":true},{"title":"Publish post","isCompleted":true}]}]}]},{"name":"Roadmap","columns":[{"name":"Now","tasks":[{"title":"Launch version one","description":"","status":"Now","subtasks":[{"title":"Launch privately to our waitlist","isCompleted":true},{"title":"Launch publicly on PH, HN, etc.","isCompleted":false}]},{"title":"Review early feedback and plan next steps for roadmap","description":"Beyond the initial launch, we're keeping the initial roadmap completely empty. This meeting will help us plan out our next steps based on actual customer feedback.","status":"Now","subtasks":[{"title":"Interview 10 customers","isCompleted":false},{"title":"Review common customer pain points and suggestions","isCompleted":false},{"title":"Outline next steps for our roadmap","isCompleted":false}]}]},{"name":"Next","tasks":[]},{"name":"Later","tasks":[]}]},{"name":"fhdf","columns":[{"name":"fghfdh","tasks":[]},{"name":"sfasf","tasks":[]},{"name":"uyui","tasks":[]},{"name":"sfsdfsdfsdfs","tasks":[]}]},{"name":"fdsss","columns":[{"name":"uiouoiouio","tasks":[{"title":"yyyyrt","description":"rtyry","status":"uiouoiouio","subtasks":[{"title":"rtyry","isCompleted":false},{"title":"fgdfg","isCompleted":false}]}]},{"name":"lll","tasks":[{"title":"weeeee","description":"eeeeeee","status":"lll","subtasks":[{"title":"wwwww","isCompleted":true},{"title":"yyyyy","isCompleted":true}]}]},{"name":"www","tasks":[]}]}]} |
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,14 @@ | ||
import Board from "@/model/Board"; | ||
import { getBoards } from "@/services/apiBoards"; | ||
import { useQuery } from "@tanstack/react-query"; | ||
|
||
export const useBoard = (prefetchedData: { boards: Board[] }) => { | ||
const { | ||
data: { boards }, | ||
} = useQuery({ | ||
queryKey: ["boards"], | ||
queryFn: getBoards, | ||
initialData: prefetchedData, | ||
}); | ||
return boards; | ||
}; |
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,22 @@ | ||
import Board from "@/model/Board"; | ||
import { createBoardApi } from "@/services/apiBoards"; | ||
import { setActiveBoard, setActiveModal } from "@/store/uiSlice"; | ||
import { useMutation, useQueryClient } from "@tanstack/react-query"; | ||
import { useDispatch } from "react-redux"; | ||
|
||
export const useCreateBoard = () => { | ||
const dispatch = useDispatch(); | ||
const queryClient = useQueryClient(); | ||
const { mutate: createBoard, isLoading: isCreating } = useMutation({ | ||
mutationFn: createBoardApi, | ||
onSuccess: async () => { | ||
await queryClient.invalidateQueries({ | ||
queryKey: ["boards"], | ||
}); | ||
const data = queryClient.getQueryData(["boards"]); | ||
dispatch(setActiveBoard((data as { boards: Board[] }).boards.length - 1)); | ||
dispatch(setActiveModal(undefined)); | ||
}, | ||
}); | ||
return { isCreating, createBoard }; | ||
}; |
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,19 @@ | ||
import { deleteBoardApi } from "@/services/apiBoards"; | ||
import { setActiveBoard, setActiveModal } from "@/store/uiSlice"; | ||
import { useMutation, useQueryClient } from "@tanstack/react-query"; | ||
import { useDispatch } from "react-redux"; | ||
|
||
export const useDeleteBoard = () => { | ||
const queryClient = useQueryClient(); | ||
const dispatch = useDispatch(); | ||
const { isLoading: isDeleting, mutate: deleteBoard } = useMutation({ | ||
mutationFn: (id: string) => deleteBoardApi(id), | ||
onSuccess: () => { | ||
queryClient.invalidateQueries({ queryKey: ["boards"] }); | ||
dispatch(setActiveModal(undefined)); | ||
dispatch(setActiveBoard(0)); | ||
}, | ||
onError: () => {}, | ||
}); | ||
return { isDeleting, deleteBoard }; | ||
}; |
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,19 @@ | ||
import Board from "@/model/Board"; | ||
import { updateBoardApi } from "@/services/apiBoards"; | ||
import { setActiveModal } from "@/store/uiSlice"; | ||
import { useMutation, useQueryClient } from "@tanstack/react-query"; | ||
import { useDispatch } from "react-redux"; | ||
|
||
export const useUpdateBoard = () => { | ||
const queryClient = useQueryClient(); | ||
const dispatch = useDispatch(); | ||
const { mutate: updateBoard, isLoading: isUpdating } = useMutation({ | ||
mutationFn: ({ id, board }: { id: string; board: Board }) => | ||
updateBoardApi(id, board), | ||
onSuccess: () => { | ||
queryClient.invalidateQueries({ queryKey: ["boards"] }); | ||
dispatch(setActiveModal(undefined)); | ||
}, | ||
}); | ||
return { isUpdating, updateBoard }; | ||
}; |
This file was deleted.
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
Oops, something went wrong.