-
Notifications
You must be signed in to change notification settings - Fork 655
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support toggle favorite problem (#405)
- Loading branch information
Showing
9 changed files
with
84 additions
and
4 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,26 @@ | ||
|
||
// Copyright (c) jdneo. All rights reserved. | ||
// Licensed under the MIT license. | ||
|
||
import { LeetCodeNode } from "../explorer/LeetCodeNode"; | ||
import { leetCodeTreeDataProvider } from "../explorer/LeetCodeTreeDataProvider"; | ||
import { leetCodeExecutor } from "../leetCodeExecutor"; | ||
import { DialogType, promptForOpenOutputChannel } from "../utils/uiUtils"; | ||
|
||
export async function addFavorite(node: LeetCodeNode): Promise<void> { | ||
try { | ||
await leetCodeExecutor.toggleFavorite(node, true); | ||
leetCodeTreeDataProvider.refresh(); | ||
} catch (error) { | ||
await promptForOpenOutputChannel("Failed to add the problem to favorite. Please open the output channel for details.", DialogType.error); | ||
} | ||
} | ||
|
||
export async function removeFavorite(node: LeetCodeNode): Promise<void> { | ||
try { | ||
await leetCodeExecutor.toggleFavorite(node, false); | ||
leetCodeTreeDataProvider.refresh(); | ||
} catch (error) { | ||
await promptForOpenOutputChannel("Failed to remove the problem from favorite. Please open the output channel for details.", DialogType.error); | ||
} | ||
} |
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