This repository has been archived by the owner on Nov 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
f0106d2
commit dc7fe88
Showing
18 changed files
with
587 additions
and
17 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
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,38 @@ | ||
import constants from '../lib/constants'; | ||
import { l } from '../lib/utils'; | ||
import BaseWebView from './base-webview'; | ||
|
||
export default class UpgradeWebView extends BaseWebView { | ||
constructor(private version: string) { | ||
super(); | ||
} | ||
|
||
get filename(): string { | ||
return 'upgrade.html'; | ||
} | ||
|
||
get id(): string { | ||
return `${constants.UPGRADE_WEBVIEW_ID}`; | ||
} | ||
|
||
get title(): string { | ||
return l('upgradeTitle', 'CircleCI upgraded to v{0}', this.version); | ||
} | ||
|
||
onDidShow(): void { | ||
this.getContent(); | ||
} | ||
|
||
async getContent(): Promise<void> { | ||
// TODO: get changelog data for version | ||
const changelog = '# Changelog'; | ||
|
||
this.postMessage({ | ||
event: constants.CHANGELOG_CONTENT_WEBVIEW_EVENT, | ||
data: { | ||
version: this.version, | ||
content: changelog, | ||
}, | ||
}); | ||
} | ||
} |
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,38 @@ | ||
import constants from '../lib/constants'; | ||
import { l } from '../lib/utils'; | ||
import BaseWebView from './base-webview'; | ||
|
||
export default class WelcomeWebView extends BaseWebView { | ||
constructor(private version: string) { | ||
super(); | ||
} | ||
|
||
get filename(): string { | ||
return 'welcome.html'; | ||
} | ||
|
||
get id(): string { | ||
return `${constants.WELCOME_WEBVIEW_ID}`; | ||
} | ||
|
||
get title(): string { | ||
return l('welcomeTitle', 'Welcome to CircleCI for VS Code!'); | ||
} | ||
|
||
onDidShow(): void { | ||
this.getContent(); | ||
} | ||
|
||
async getContent(): Promise<void> { | ||
// TODO: get changelog data for version | ||
const changelog = '# Changelog'; | ||
|
||
this.postMessage({ | ||
event: constants.CHANGELOG_CONTENT_WEBVIEW_EVENT, | ||
data: { | ||
version: this.version, | ||
content: changelog, | ||
}, | ||
}); | ||
} | ||
} |
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,8 @@ | ||
body { | ||
padding: 10px 20px; | ||
line-height: 22px; | ||
max-width: 882px; | ||
margin: 0 auto; | ||
min-height: 100vh; | ||
box-sizing: border-box; | ||
} |
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,45 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import ReactMarkdown from 'react-markdown'; | ||
import constants from '../../../../lib/constants'; | ||
import { PostMessagePayload } from '../../../../lib/types'; | ||
import Loading from '../Loading'; | ||
import './index.scss'; | ||
|
||
const Upgrade = ({ vscode }: { vscode: any }): JSX.Element => { | ||
const [initLoaded, setInitLoaded] = useState<boolean>(false); | ||
const [changelog, setChangelog] = useState<{ content: string; version: string; } | null>(null); | ||
|
||
useEffect(() => { | ||
if (!changelog) { | ||
window.addEventListener( | ||
'message', | ||
({ data }: { data: PostMessagePayload }) => { | ||
switch (data.event) { | ||
case constants.CHANGELOG_CONTENT_WEBVIEW_EVENT: | ||
setChangelog({ | ||
content: data.data.content, | ||
version: data.data.version, | ||
}); | ||
setInitLoaded(true); | ||
break; | ||
} | ||
} | ||
); | ||
} | ||
}, [changelog]); | ||
|
||
if (!initLoaded) { | ||
return <Loading /> | ||
} | ||
|
||
return ( | ||
<div> | ||
<h1>New in CircleCI for VS Code v{changelog!.version}</h1> | ||
<div> | ||
{<ReactMarkdown source={changelog!.content} />} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Upgrade; |
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,8 @@ | ||
body { | ||
padding: 10px 20px; | ||
line-height: 22px; | ||
max-width: 882px; | ||
margin: 0 auto; | ||
min-height: 100vh; | ||
box-sizing: border-box; | ||
} |
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,49 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import ReactMarkdown from 'react-markdown'; | ||
import constants from '../../../../lib/constants'; | ||
import { PostMessagePayload } from '../../../../lib/types'; | ||
import Loading from '../Loading'; | ||
import './index.scss'; | ||
|
||
const Welcome = ({ vscode }: { vscode: any }): JSX.Element => { | ||
const [initLoaded, setInitLoaded] = useState<boolean>(false); | ||
const [changelog, setChangelog] = useState<{ content: string; version: string; } | null>(null); | ||
|
||
useEffect(() => { | ||
if (!changelog) { | ||
window.addEventListener( | ||
'message', | ||
({ data }: { data: PostMessagePayload }) => { | ||
switch (data.event) { | ||
case constants.CHANGELOG_CONTENT_WEBVIEW_EVENT: | ||
setChangelog({ | ||
content: data.data.content, | ||
version: data.data.version, | ||
}); | ||
setInitLoaded(true); | ||
break; | ||
} | ||
} | ||
); | ||
} | ||
}, [changelog]); | ||
|
||
if (!initLoaded) { | ||
return <Loading /> | ||
} | ||
|
||
return ( | ||
<div> | ||
<h1>Welcome!</h1> | ||
|
||
<div> | ||
<h2>Here's what's new in v{changelog!.version}</h2> | ||
<div> | ||
{<ReactMarkdown source={changelog!.content} />} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Welcome; |
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,14 @@ | ||
import React from 'react'; | ||
import { render } from 'react-dom'; | ||
import Upgrade from './components/Upgrade'; | ||
|
||
// @ts-ignore | ||
const vscode = acquireVsCodeApi() as any; | ||
const rootElement = document.getElementById('root')!; | ||
|
||
render( | ||
<React.StrictMode> | ||
<Upgrade {...{ vscode }} /> | ||
</React.StrictMode>, | ||
rootElement | ||
); |
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 React from 'react'; | ||
import { render } from 'react-dom'; | ||
import Welcome from './components/Welcome'; | ||
|
||
// @ts-ignore | ||
const vscode = acquireVsCodeApi() as any; | ||
const rootElement = document.getElementById('root')!; | ||
|
||
render( | ||
<React.StrictMode> | ||
<Welcome {...{ vscode }} /> | ||
</React.StrictMode>, | ||
rootElement | ||
); |
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,2 @@ | ||
<div id="root" data-root-path="#{root}"></div> | ||
<script src="#{root}/webviews/assets/upgrade.js"></script> |
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,2 @@ | ||
<div id="root" data-root-path="#{root}"></div> | ||
<script src="#{root}/webviews/assets/welcome.js"></script> |
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.