-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "Close" button to close kanban and disable auto closing #44
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,10 +127,9 @@ async function reloadConfig(noteId: string) { | |
const valid = ymlConfig !== null && (await board.loadConfig(ymlConfig)); | ||
if (valid) { | ||
openBoard = board; | ||
} else { | ||
openBoard = undefined; | ||
hideBoard(); | ||
} | ||
// Do nothing if it is not valid. | ||
// User could close the kanban by using the "x" button | ||
} | ||
|
||
// EVENT HANDLERS | ||
|
@@ -220,6 +219,10 @@ async function handleKanbanMessage(msg: Action) { | |
case "load": | ||
break; | ||
|
||
case "close": | ||
openBoard = undefined; | ||
return hideBoard(); | ||
|
||
// Propagete action to the active board | ||
default: { | ||
if (!openBoard.isValid) break; | ||
|
@@ -273,12 +276,19 @@ async function handleKanbanMessage(msg: Action) { | |
* the domain of the current board. | ||
*/ | ||
async function handleNewlyOpenedNote(newNoteId: string) { | ||
|
||
if (openBoard) { | ||
if (openBoard.configNoteId === newNoteId) return; | ||
if (await openBoard.isNoteIdOnBoard(newNoteId)) return; | ||
else { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this code was already there, but is this "else" useful? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Let's say you have opened Kanban A note , and then open another Kanban B note, the else code handle this condition and replace the the board to Kanban B. If no such code, you need to close the current board and then open the Kanban note B manually. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remark: The reloadConfig() replace the "openBoard" variable. That is why it looks a bit weird. |
||
hideBoard(); | ||
openBoard = undefined; | ||
const originalOpenBoard = openBoard; | ||
await reloadConfig(newNoteId); | ||
if (openBoard && openBoard.isValid && originalOpenBoard!==openBoard) { | ||
// If user opened a new board, close and open again to refresh the content | ||
hideBoard() | ||
showBoard(); | ||
} | ||
return; | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't it be good to set openBoard as undefined in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the code to prevent the board from closing automatically and keep the current board working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it set to undefined, I am afraid the current board will not be working any more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'll need more time to understand the code on my side then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, after additional test, this part is ok