- Notifications
You must be signed in to change notification settings - Fork668
Add Code Snippets and Daily Challenge Selection Features#982
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Open
XzZZzX02 wants to merge5 commits intoLeetCode-OpenSource:masterChoose a base branch fromXzZZzX02:modification
base:master
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Uh oh!
There was an error while loading.Please reload this page.
Open
Changes fromall commits
Commits
Show all changes
5 commits Select commitHold shift + click to select a range
c71b057
feat: add custom code snippets support for LeetCode problems
XzZZzX02beefdc6
feat: update version and add daily challenge feature
XzZZzX020696a48
feat: add daily challenge category and implement related node retrieval
XzZZzX02cac44ad
feat: refactor endpoint retrieval and enhance daily challenge query h…
XzZZzX0290e9670
fix
XzZZzX02File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
4 changes: 2 additions & 2 deletionspackage-lock.json
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
16 changes: 16 additions & 0 deletionspackage.json
This file contains hidden or 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
5 changes: 2 additions & 3 deletionssrc/commands/plugin.ts
This file contains hidden or 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
11 changes: 11 additions & 0 deletionssrc/commands/show.ts
This file contains hidden or 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
2 changes: 2 additions & 0 deletionssrc/explorer/LeetCodeTreeDataProvider.ts
This file contains hidden or 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
10 changes: 10 additions & 0 deletionssrc/explorer/explorerNodeManager.ts
This file contains hidden or 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
3 changes: 2 additions & 1 deletionsrc/extension.ts
This file contains hidden or 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
15 changes: 14 additions & 1 deletionsrc/leetCodeExecutor.ts
This file contains hidden or 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
57 changes: 57 additions & 0 deletionssrc/request/query-daily-challange.ts
This file contains hidden or 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,57 @@ | ||
import {getUrl, getEndpoint, Endpoint} from "../shared"; | ||
import {LcAxios} from "../utils/httpUtils"; | ||
import {AxiosResponse} from "axios"; | ||
export const getDailyQueryStr = (): string => { | ||
const dailyQueryStrs = { | ||
LeetCode: ` | ||
query questionOfToday { | ||
activeDailyCodingChallengeQuestion { | ||
question { | ||
frontendQuestionId: questionFrontendId | ||
} | ||
} | ||
} | ||
`, | ||
LeetCodeCN: ` | ||
query questionOfToday { | ||
todayRecord { | ||
question { | ||
frontendQuestionId: questionFrontendId | ||
} | ||
} | ||
} | ||
` | ||
} | ||
const point: string = getEndpoint(); | ||
switch (point) { | ||
case Endpoint.LeetCodeCN: | ||
return dailyQueryStrs.LeetCodeCN; | ||
case Endpoint.LeetCode: | ||
return dailyQueryStrs.LeetCode; | ||
} | ||
return ""; | ||
} | ||
export const getDailyProblemID = (res: AxiosResponse<any, any>): string => { | ||
const point = getEndpoint(); | ||
switch (point) { | ||
case Endpoint.LeetCodeCN: | ||
return res.data.data.todayRecord[0].question.frontendQuestionId; | ||
case Endpoint.LeetCode: | ||
return res.data.data.todayRecord[0].question.frontendQuestionId; | ||
} | ||
return ""; | ||
} | ||
export const queryDailyChallenge = async (): Promise<string> => { | ||
return LcAxios(getUrl("graphql"), { | ||
method: "POST", | ||
data: { | ||
query: getDailyQueryStr(), | ||
variables: {}, | ||
operationName: 'questionOfToday' | ||
}, | ||
}).then((res) => getDailyProblemID(res)); | ||
}; |
9 changes: 7 additions & 2 deletionssrc/shared.ts
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.