diff --git a/site/package-lock.json b/site/package-lock.json
new file mode 100644
index 0000000..7e44561
--- /dev/null
+++ b/site/package-lock.json
@@ -0,0 +1,6 @@
+{
+ "name": "site",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {}
+}
diff --git a/site/src/app/AppBlock.tsx b/site/src/app/AppBlock.tsx
index 5e069e3..51b0d87 100644
--- a/site/src/app/AppBlock.tsx
+++ b/site/src/app/AppBlock.tsx
@@ -98,17 +98,20 @@ function AppBlock({ app, setShowingAppDetails }: Props): JSX.Element {
{
+ onReleaseChosen={
+ (branch) => {
const newQueryParams = new VSCodeQueryParams(app);
- newQueryParams.branch = branch;
+ newQueryParams.branch = branch!;
setQueryParams(newQueryParams);
- }} />
+ }}
+ />
diff --git a/site/src/app/ReleasesDropDownList.tsx b/site/src/app/ReleasesDropDownList.tsx
index 3f2f1b4..1310208 100644
--- a/site/src/app/ReleasesDropDownList.tsx
+++ b/site/src/app/ReleasesDropDownList.tsx
@@ -4,26 +4,78 @@
*/
import { NormalisedApp } from '../schema';
-import Select from 'react-select';
+import Select, {components, ControlProps, CSSObjectWithLabel, DropdownIndicatorProps, MenuProps } from 'react-select';
+import { GitBranchIcon } from '@primer/octicons-react';
+import { useState } from 'react';
interface Props {
app: NormalisedApp;
- onReleaseChosen: (tag: string) => void;
+ onReleaseChosen: (tag: string | null | undefined) => void;
};
+type ReleaseOption = {
+ readonly label: string,
+ readonly value: string
+};
+
+const Control = ({children, ...props}: ControlProps) => {
+ return (
+ <>
+
+ {children}
+
+ >
+ )
+};
+
+const HiddenComponent = () => null;
+
function ReleasesDropDownList({ app, onReleaseChosen }: Props): JSX.Element {
- const releases = [{ label: app.defaultBranch, value: app.defaultBranch }, ...app.releases.map((release) => ({ label: release.tag, value: release.tag ?? '' })),];
+
+ const releases: ReleaseOption[] = [{ label: app.defaultBranch, value: app.defaultBranch },
+ ...app.releases.map((release) => ({ label: release.tag, value: release.tag ?? '' }))];
+ const selectStyles = {
+ control: (base: CSSObjectWithLabel, state: ControlProps) => ({
+ ...base,
+ cursor: 'pointer',
+ borderRadius: 0,
+ minHeight: '30px',
+ height: '33px',
+ paddingLeft: 8,
+ alignContent: 'center',
+ }),
+ dropdownIndicator: (base: CSSObjectWithLabel, state: DropdownIndicatorProps) => ({
+ ...base,
+ paddingTop: 0,
+ paddingBottom: 4,
+ display: !state.isFocused ? 'block' : 'none',
+ scale: '0.7'
+ }),
+ menu: (base: CSSObjectWithLabel, state: MenuProps) => ({
+ ...base,
+ marginTop: 2,
+ marginBottom: 2,
+ borderRadius: 0
+ })
+ };
+
+ const [selectedRelease, setSelectedRelease] = useState(releases[0]?.label);
return (
-
+
)
}