-
Notifications
You must be signed in to change notification settings - Fork 186
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
DEV2-3410 use welcome views #1259
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { tabNineProcess } from "./requests"; | ||
|
||
export type RefreshResponse = { | ||
is_successful: boolean; | ||
error?: string; | ||
}; | ||
|
||
export function refreshRemote(): Promise<RefreshResponse | null | undefined> { | ||
return tabNineProcess.request<RefreshResponse>({ | ||
RefreshRemoteProperties: {}, | ||
}); | ||
} |
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
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,17 @@ | ||
import { WELCOME_MESSAGE } from "./welcome.html"; | ||
|
||
const SIGN_IN_BUTTON = `<a style="display: inline-block; background-color: #007acc; color: #fff; border: none; padding: 6px 40%; border-radius: 3px; cursor: pointer; text-decoration: none;" href="command:tabnine.authenticate">Sign in</a>`; | ||
|
||
export const html = `<!DOCTYPE html> | ||
<html> | ||
<body> | ||
${WELCOME_MESSAGE} | ||
<p> | ||
|
||
Please ensure you’re signed in | ||
<div style="text-align: center;"> | ||
${SIGN_IN_BUTTON} | ||
</div> | ||
</p> | ||
</body> | ||
</html>`; |
30 changes: 30 additions & 0 deletions
30
src/tabnineChatWidget/webviews/emptyStateAuthenticateView.ts
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,30 @@ | ||
import { Disposable, ExtensionContext, Uri, WebviewView, window } from "vscode"; | ||
import { fireEvent } from "../../binary/requests/requests"; | ||
import { html } from "./authenticate.html"; | ||
|
||
export function emptyStateAuthenticateView( | ||
context: ExtensionContext | ||
): Disposable { | ||
return window.registerWebviewViewProvider("tabnine.authenticate", { | ||
resolveWebviewView(webviewView: WebviewView) { | ||
webviewView.onDidChangeVisibility(() => { | ||
if (webviewView.visible) { | ||
void fireEvent({ | ||
name: "tabnine-chat-authenticate-visible", | ||
}); | ||
} | ||
}); | ||
|
||
const view = webviewView.webview; | ||
view.options = { | ||
enableScripts: true, | ||
enableCommandUris: true, | ||
}; | ||
view.html = html; | ||
|
||
void fireEvent({ | ||
name: "tabnine-chat-authenticate-inited", | ||
}); | ||
}, | ||
}); | ||
} |
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,25 @@ | ||
import { Disposable, ExtensionContext, Uri, WebviewView, window } from "vscode"; | ||
import { fireEvent } from "../../binary/requests/requests"; | ||
import { refreshRemote } from "../../binary/requests/refreshRemote"; | ||
import { html } from "./welcome.html"; | ||
|
||
export function emptyStateWelcomeView(context: ExtensionContext): Disposable { | ||
return window.registerWebviewViewProvider("tabnine.chat.welcome", { | ||
resolveWebviewView(webviewView: WebviewView) { | ||
webviewView.onDidChangeVisibility(() => { | ||
if (webviewView.visible) { | ||
void refreshRemote(); | ||
void fireEvent({ | ||
name: "tabnine-chat-empty-visible", | ||
}); | ||
} | ||
}); | ||
void fireEvent({ | ||
name: "tabnine-chat-empty-inited", | ||
}); | ||
|
||
const view = webviewView.webview; | ||
view.html = html; | ||
}, | ||
}); | ||
} |
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,13 @@ | ||
export const WELCOME_MESSAGE = ` | ||
<h1>Welcome to Tabnine Chat</h1> | ||
<h2>Tabnine Chat is currently in Beta</h2> | ||
<p>We understand that waiting for this awesome feature isn’t easy, but we guarantee it will be worth it. | ||
Tabnine Chat will soon be available to all users, and we'll make sure to keep you informed. Thank you for your patience! | ||
<a href="https://www.tabnine.com/#ChatSection">Learn More</a></p>`; | ||
|
||
export const html = `<!DOCTYPE html> | ||
<html> | ||
<body> | ||
${WELCOME_MESSAGE} | ||
</body> | ||
</html>`; |
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.
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.
@ofekby - this is the usage of the RefreshRemoteProperties reuest