Skip to content

Commit 2a68eeb

Browse files
committed
Review fixes
1 parent 449e079 commit 2a68eeb

File tree

11 files changed

+43
-75
lines changed

11 files changed

+43
-75
lines changed

cli/testdata/TestProvisioners_Golden/list.golden

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ID CREATED AT LAST SEEN AT NAME VERSION TAGS KEY NAME STATUS CURRENT JOB ID CURRENT JOB STATUS PREVIOUS JOB ID PREVIOUS JOB STATUS ORGANIZATION
1+
ID CREATED AT LAST SEEN AT NAME VERSION TAGS KEY NAME STATUS CURRENT JOB ID CURRENT JOB STATUS PREVIOUS JOB ID PREVIOUS JOB STATUS ORGANIZATION
22
00000000-0000-0000-aaaa-000000000000 ====[timestamp]===== ====[timestamp]===== default-provisioner v0.0.0-devel map[owner: scope:organization] built-in idle <nil> <nil> 00000000-0000-0000-bbbb-000000000001 succeeded Coder
33
00000000-0000-0000-aaaa-000000000001 ====[timestamp]===== ====[timestamp]===== provisioner-1 v0.0.0 map[foo:bar owner: scope:organization] built-in busy 00000000-0000-0000-bbbb-000000000002 running <nil> <nil> Coder
44
00000000-0000-0000-aaaa-000000000002 ====[timestamp]===== ====[timestamp]===== provisioner-2 v0.0.0 map[owner: scope:organization] built-in offline <nil> <nil> 00000000-0000-0000-bbbb-000000000003 succeeded Coder
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
CREATED AT LAST SEEN AT KEY NAME NAME VERSION STATUS TAGS
1+
CREATED AT LAST SEEN AT KEY NAME NAME VERSION STATUS TAGS
22
====[timestamp]===== ====[timestamp]===== built-in test v0.0.0-devel idle map[owner: scope:organization]

coderd/apidoc/docs.go

+3-19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

+3-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/users.go

+2-6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"errors"
77
"fmt"
88
"net/http"
9+
"slices"
910

1011
"github.com/go-chi/chi/v5"
1112
"github.com/go-chi/render"
@@ -1067,12 +1068,7 @@ func (api *API) putUserAppearanceSettings(rw http.ResponseWriter, r *http.Reques
10671068
}
10681069

10691070
func isValidFontName(font codersdk.TerminalFontName) bool {
1070-
switch font {
1071-
case codersdk.TerminalFontIbmPlexMono, codersdk.TerminalFontFiraCode, "":
1072-
return true
1073-
default:
1074-
return false
1075-
}
1071+
return slices.Contains(codersdk.TerminalFontNames, font)
10761072
}
10771073

10781074
// @Summary Update user password

codersdk/users.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -192,20 +192,22 @@ type ValidateUserPasswordResponse struct {
192192
// TerminalFontName is the name of supported terminal font
193193
type TerminalFontName string
194194

195+
var TerminalFontNames = []TerminalFontName{TerminalFontUnknown, TerminalFontIBMPlexMono, TerminalFontFiraCode}
196+
195197
const (
196198
TerminalFontUnknown TerminalFontName = ""
197-
TerminalFontIbmPlexMono TerminalFontName = "ibm-plex-mono"
199+
TerminalFontIBMPlexMono TerminalFontName = "ibm-plex-mono"
198200
TerminalFontFiraCode TerminalFontName = "fira-code"
199201
)
200202

201203
type UserAppearanceSettings struct {
202204
ThemePreference string `json:"theme_preference"`
203-
TerminalFont TerminalFontName `json:"terminal_font" enums:"ibm-plex-mono,fira-code"`
205+
TerminalFont TerminalFontName `json:"terminal_font"`
204206
}
205207

206208
type UpdateUserAppearanceSettingsRequest struct {
207209
ThemePreference string `json:"theme_preference" validate:"required"`
208-
TerminalFont TerminalFontName `json:"terminal_font" validate:"required" enums:"ibm-plex-mono,fira-code"`
210+
TerminalFont TerminalFontName `json:"terminal_font" validate:"required"`
209211
}
210212

211213
type UpdateUserPasswordRequest struct {

docs/reference/api/schemas.md

+2-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/api/users.md

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.11.2
1+
1.11.1

site/src/pages/UserSettingsPage/AppearancePage/AppearanceForm.tsx

+13-12
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import type { FC } from "react";
1818
import themes, {
1919
DEFAULT_TERMINAL_FONT,
2020
DEFAULT_THEME,
21+
fontLabels,
2122
type Theme,
2223
} from "theme";
2324
import { Section } from "../Section";
@@ -112,18 +113,18 @@ export const AppearanceForm: FC<AppearanceFormProps> = ({
112113
onChangeTerminalFont(toTerminalFontName(value))
113114
}
114115
>
115-
<FormControlLabel
116-
value="ibm-plex-mono"
117-
control={<Radio />}
118-
label={
119-
<div css={{ fontFamily: "IBM Plex Mono" }}>IBM Plex Mono</div>
120-
}
121-
/>
122-
<FormControlLabel
123-
value="fira-code"
124-
control={<Radio />}
125-
label={<div css={{ fontFamily: "Fira Code" }}>Fira Code</div>}
126-
/>
116+
{TerminalFontNames.filter((name) => name !== "").map((name) => (
117+
<FormControlLabel
118+
key={name}
119+
value={name}
120+
control={<Radio />}
121+
label={
122+
<div css={{ fontFamily: fontLabels[name] }}>
123+
IBM Plex Mono
124+
</div>
125+
}
126+
/>
127+
))}
127128
</RadioGroup>
128129
</FormControl>
129130
</Section>

site/src/theme/index.ts

+9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
// biome-ignore lint/nursery/noRestrictedImports: We still use `Theme` as a basis for our actual theme, for now.
22
import type { Theme as MuiTheme } from "@mui/material/styles";
3+
import type { TerminalFontName } from "api/typesGenerated";
34
import type * as monaco from "monaco-editor";
5+
import { of } from "rxjs";
46
import type { Branding } from "./branding";
7+
import { terminalFonts } from "./constants";
58
import dark from "./dark";
69
import type { NewTheme } from "./experimental";
710
import type { ExternalImageModeStyles } from "./externalImages";
@@ -37,4 +40,10 @@ const theme = {
3740

3841
export default theme;
3942

43+
export const fontLabels: Record<TerminalFontName, string> = {
44+
"fira-code": "Fira Code",
45+
"ibm-plex-mono": "IBM Plex Mono",
46+
"": "", // needed for enum completeness, otherwise fails the build
47+
};
48+
4049
export const DEFAULT_TERMINAL_FONT = "ibm-plex-mono";

0 commit comments

Comments
 (0)