Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
SantiMA10 committed May 10, 2020
2 parents 6c3df01 + f522261 commit c41c42d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/dev.santiagomartin.devops.sdPlugin/pi/ts/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ function connectElgatoStreamDeckSocket(
);
});

document.addEventListener("openUrl", (e) => {
const { detail } = e as CustomEvent;

openUrl(detail.url);
});

document.addEventListener("removeAccount", (e) => {
const { detail } = e as CustomEvent;

Expand Down Expand Up @@ -96,6 +102,7 @@ function connectElgatoStreamDeckSocket(

websocket.send(JSON.stringify(json));
};

const openUrl = (url: string) => {
websocket.send(
JSON.stringify({
Expand Down
18 changes: 15 additions & 3 deletions src/dev.santiagomartin.devops.sdPlugin/setup/ts/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ const SetupForm: React.FC = () => {
window.close();
};

const openUrl = (url: String) => {
window.opener.document.dispatchEvent(
new CustomEvent("openUrl", { detail: { url } })
);
};

return (
<div
style={{ display: "flex", flexDirection: "column", alignItems: "center" }}
Expand All @@ -26,6 +32,12 @@ const SetupForm: React.FC = () => {
<a
target="_blank"
href="https://github.com/SantiMA10/devops-streamdeck#how-it-works"
onClick={(e) => {
e.preventDefault();
openUrl(
"https://github.com/SantiMA10/devops-streamdeck#how-it-works"
);
}}
>
instructions here
</a>
Expand All @@ -38,7 +50,7 @@ const SetupForm: React.FC = () => {
type="text"
placeholder="Account name"
value={name}
onChange={event => setName(event.target.value)}
onChange={(event) => setName(event.target.value)}
required
/>
</div>
Expand All @@ -49,7 +61,7 @@ const SetupForm: React.FC = () => {
type="password"
placeholder="Paste here your personal token"
value={token}
onChange={event => setToken(event.target.value)}
onChange={(event) => setToken(event.target.value)}
required
/>
</div>
Expand All @@ -60,7 +72,7 @@ const SetupForm: React.FC = () => {
type="text"
placeholder="Add here your self-hosted domain"
value={domain}
onChange={event => setDomain(event.target.value)}
onChange={(event) => setDomain(event.target.value)}
/>
</div>
<button style={{ marginTop: 10 }} onClick={onSave}>
Expand Down

0 comments on commit c41c42d

Please sign in to comment.