Skip to content

Commit 661152a

Browse files
committed
make fmt
1 parent 7680ae1 commit 661152a

File tree

2 files changed

+53
-41
lines changed

2 files changed

+53
-41
lines changed

site/src/components/Icons/VSCodeInsidersIcon.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,22 @@ import SvgIcon, { SvgIconProps } from "@mui/material/SvgIcon"
22

33
export const VSCodeInsidersIcon = (props: SvgIconProps) => (
44
<SvgIcon {...props} viewBox="0 0 256 256">
5-
<svg width="256" height="256" viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg">
6-
<mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="256" height="256">
5+
<svg
6+
width="256"
7+
height="256"
8+
viewBox="0 0 256 256"
9+
fill="none"
10+
xmlns="http://www.w3.org/2000/svg"
11+
>
12+
<mask
13+
id="mask0"
14+
mask-type="alpha"
15+
maskUnits="userSpaceOnUse"
16+
x="0"
17+
y="0"
18+
width="256"
19+
height="256"
20+
>
721
<path
822
d="M176.049 250.669C180.838 255.459 188.13 256.7 194.234 253.764L246.94 228.419C252.478 225.755 256 220.154 256 214.008V42.1479C256 36.0025 252.478 30.4008 246.94 27.7374L194.234 2.39089C188.13 -0.544416 180.838 0.696607 176.049 5.48572C181.95 -0.41506 192.039 3.76413 192.039 12.1091V244.046C192.039 252.391 181.95 256.57 176.049 250.669Z"
923
fill="white"
Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import React, { FC, PropsWithChildren, useState, useEffect } from "react";
2-
import { getApiKey } from "api/api";
3-
import { VSCodeIcon } from "components/Icons/VSCodeIcon";
4-
import { VSCodeInsidersIcon } from "components/Icons/VSCodeInsidersIcon";
5-
import { PrimaryAgentButton } from "components/Resources/AgentButton";
6-
import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
1+
import React, { FC, PropsWithChildren, useState, useEffect } from "react"
2+
import { getApiKey } from "api/api"
3+
import { VSCodeIcon } from "components/Icons/VSCodeIcon"
4+
import { VSCodeInsidersIcon } from "components/Icons/VSCodeInsidersIcon"
5+
import { PrimaryAgentButton } from "components/Resources/AgentButton"
6+
import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown"
77

88
export interface VSCodeDesktopButtonProps {
9-
userName: string;
10-
workspaceName: string;
11-
agentName?: string;
12-
folderPath?: string;
9+
userName: string
10+
workspaceName: string
11+
agentName?: string
12+
folderPath?: string
1313
}
1414

1515
enum VSCodeVariant {
@@ -18,69 +18,69 @@ enum VSCodeVariant {
1818
}
1919

2020
const getSelectedVariantFromLocalStorage = (): VSCodeVariant | null => {
21-
const storedVariant = localStorage.getItem("selectedVariant");
21+
const storedVariant = localStorage.getItem("selectedVariant")
2222
if (
2323
storedVariant &&
2424
Object.values(VSCodeVariant).includes(storedVariant as VSCodeVariant)
2525
) {
26-
return storedVariant as VSCodeVariant;
26+
return storedVariant as VSCodeVariant
2727
}
28-
return null;
29-
};
28+
return null
29+
}
3030

3131
export const VSCodeDesktopButton: FC<
3232
PropsWithChildren<VSCodeDesktopButtonProps>
3333
> = ({ userName, workspaceName, agentName, folderPath }) => {
34-
const [loading, setLoading] = useState(false);
34+
const [loading, setLoading] = useState(false)
3535
const [selectedVariant, setSelectedVariant] = useState<VSCodeVariant | null>(
36-
getSelectedVariantFromLocalStorage()
37-
);
38-
const [dropdownOpen, setDropdownOpen] = useState(false);
36+
getSelectedVariantFromLocalStorage(),
37+
)
38+
const [dropdownOpen, setDropdownOpen] = useState(false)
3939

4040
useEffect(() => {
4141
if (selectedVariant) {
42-
localStorage.setItem("selectedVariant", selectedVariant);
42+
localStorage.setItem("selectedVariant", selectedVariant)
4343
} else {
44-
localStorage.removeItem("selectedVariant");
44+
localStorage.removeItem("selectedVariant")
4545
}
46-
}, [selectedVariant]);
46+
}, [selectedVariant])
4747

4848
const handleButtonClick = () => {
49-
setLoading(true);
49+
setLoading(true)
5050
getApiKey()
5151
.then(({ key }) => {
5252
const query = new URLSearchParams({
5353
owner: userName,
5454
workspace: workspaceName,
5555
url: location.origin,
5656
token: key,
57-
});
57+
})
5858
if (agentName) {
59-
query.set("agent", agentName);
59+
query.set("agent", agentName)
6060
}
6161
if (folderPath) {
62-
query.set("folder", folderPath);
62+
query.set("folder", folderPath)
6363
}
6464

6565
const vscodeCommand =
6666
selectedVariant === VSCodeVariant.VSCode
6767
? "vscode://"
68-
: "vscode-insiders://";
68+
: "vscode-insiders://"
6969

70-
location.href = `${vscodeCommand}coder.coder-remote/open?${query.toString()}`;
70+
location.href = `${vscodeCommand}coder.coder-remote/open?${query.toString()}`
7171
})
7272
.catch((ex) => {
73-
console.error(ex);
73+
console.error(ex)
7474
})
7575
.finally(() => {
76-
setLoading(false);
77-
});
78-
};
76+
setLoading(false)
77+
})
78+
}
7979

8080
const handleVariantChange = (variant: VSCodeVariant) => {
81-
setSelectedVariant(variant);
82-
setDropdownOpen(false);
83-
};
81+
setSelectedVariant(variant)
82+
setDropdownOpen(false)
83+
}
8484

8585
return (
8686
<div style={{ position: "relative", display: "inline-flex" }}>
@@ -99,9 +99,7 @@ export const VSCodeDesktopButton: FC<
9999
? "VS Code Desktop"
100100
: "VS Code Insiders"}
101101
</PrimaryAgentButton>
102-
<PrimaryAgentButton
103-
onClick={() => setDropdownOpen(!dropdownOpen)}
104-
>
102+
<PrimaryAgentButton onClick={() => setDropdownOpen(!dropdownOpen)}>
105103
<KeyboardArrowDownIcon
106104
style={{
107105
transition: "transform 0.3s ease-in-out",
@@ -134,5 +132,5 @@ export const VSCodeDesktopButton: FC<
134132
</div>
135133
)}
136134
</div>
137-
);
138-
};
135+
)
136+
}

0 commit comments

Comments
 (0)