Skip to content

refactor: remove theme "color palettes" #11314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion site/src/AppRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import WorkspacesPage from "./pages/WorkspacesPage/WorkspacesPage";
import UserSettingsLayout from "./pages/UserSettingsPage/Layout";
import { TemplateSettingsLayout } from "./pages/TemplateSettingsPage/TemplateSettingsLayout";
import { WorkspaceSettingsLayout } from "./pages/WorkspaceSettingsPage/WorkspaceSettingsLayout";
import { ThemeOverride } from "contexts/ThemeProvider";
import themes from "theme";

// Lazy load pages
// - Pages that are secondary, not in the main navigation or not usually accessed
Expand Down Expand Up @@ -384,7 +386,11 @@ export const AppRouter: FC = () => {
/>
<Route
path="/:username/:workspace/terminal"
element={<TerminalPage />}
element={
<ThemeOverride theme={themes.dark}>
<TerminalPage />
</ThemeOverride>
}
/>
<Route path="/cli-auth" element={<CliAuthenticationPage />} />
<Route path="/icons" element={<IconsPage />} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { TerminalIcon } from "components/Icons/TerminalIcon";
import { RocketIcon } from "components/Icons/RocketIcon";
import ErrorIcon from "@mui/icons-material/ErrorOutline";
import { MONOSPACE_FONT_FAMILY } from "theme/constants";
import colors from "theme/tailwindColors";
import { getDisplayWorkspaceStatus } from "utils/workspace";
import { HelpTooltipTitle } from "components/HelpTooltip/HelpTooltip";
import { Stack } from "components/Stack/Stack";
Expand Down Expand Up @@ -439,9 +440,9 @@ const styles = {
height: 16px;
}
`,
unhealthy: (theme) => css`
background-color: ${theme.colors.red[10]};
`,
unhealthy: {
backgroundColor: colors.red[700],
},
group: css`
display: flex;
align-items: center;
Expand Down
4 changes: 2 additions & 2 deletions site/src/components/IconField/IconField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ const IconField: FC<IconFieldProps> = ({ onPickEmoji, ...textFieldProps }) => {
styles={css`
em-emoji-picker {
--rgb-background: ${theme.palette.background.paper};
--rgb-input: ${theme.colors.gray[17]};
--rgb-color: ${theme.colors.gray[4]};
--rgb-input: ${theme.palette.primary.main};
--rgb-color: ${theme.palette.text.primary};

// Hack to prevent the right side from being cut off
width: 350px;
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/Markdown/Markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { type FC, memo } from "react";
import ReactMarkdown, { type Options } from "react-markdown";
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
import gfm from "remark-gfm";
import colors from "theme/tailwind";
import colors from "theme/tailwindColors";
import { dracula } from "react-syntax-highlighter/dist/cjs/styles/prism";

interface MarkdownProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type Interpolation, type Theme } from "@emotion/react";
import { type FC } from "react";
import type { AuditLog } from "api/typesGenerated";
import colors from "theme/tailwind";
import colors from "theme/tailwindColors";
import { MONOSPACE_FONT_FAMILY } from "theme/constants";

const getDiffValue = (value: unknown): string => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
import { Fieldset } from "components/DeploySettingsLayout/Fieldset";
import { Stack } from "components/Stack/Stack";
import { getFormHelpers } from "utils/formUtils";
import colors from "theme/tailwind";
import colors from "theme/tailwindColors";

export type AppearanceSettingsPageViewProps = {
appearance: UpdateAppearanceConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,10 @@ const TemplateUsagePanel: FC<TemplateUsagePanelProps> = ({
const totalInSeconds =
validUsage?.reduce((total, usage) => total + usage.seconds, 0) ?? 1;
const usageColors = chroma
.scale([theme.colors.green[8], theme.colors.blue[8]])
.scale([
theme.experimental.roles.success.fill,
theme.experimental.roles.notice.fill,
])
.mode("lch")
.colors(validUsage?.length ?? 0);
// The API returns a row for each app, even if the user didn't use it.
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/TerminalPage/TerminalPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const TerminalPage: FC = () => {
fontFamily: MONOSPACE_FONT_FAMILY,
fontSize: 16,
theme: {
background: theme.colors.gray[16],
background: theme.palette.background.default,
},
});
if (renderer === "webgl") {
Expand Down
7 changes: 3 additions & 4 deletions site/src/pages/WorkspacesPage/LastUsed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const LastUsed: FC<LastUsedProps> = ({ lastUsedAt }) => {
);

if (t.isAfter(now.subtract(1, "hour"))) {
circle = <Circle color={theme.colors.green[9]} />;
circle = <Circle color={theme.experimental.roles.success.fill} />;
// Since the agent reports on a 10m interval,
// the last_used_at can be inaccurate when recent.
message = "Now";
Expand All @@ -49,15 +49,14 @@ export const LastUsed: FC<LastUsedProps> = ({ lastUsedAt }) => {
} else if (t.isAfter(now.subtract(1, "month"))) {
circle = <Circle color={theme.palette.warning.light} />;
} else if (t.isAfter(now.subtract(100, "year"))) {
circle = <Circle color={theme.colors.red[10]} />;
circle = <Circle color={theme.experimental.roles.error.fill} />;
} else {
// color = theme.palette.error.light
message = "Never";
}

return (
<Stack
css={{ color: theme.palette.text.secondary }}
style={{ color: theme.palette.text.secondary }}
direction="row"
spacing={1}
alignItems="center"
Expand Down
60 changes: 0 additions & 60 deletions site/src/theme/colors.ts

This file was deleted.

62 changes: 0 additions & 62 deletions site/src/theme/dark/colors.ts

This file was deleted.

2 changes: 1 addition & 1 deletion site/src/theme/dark/experimental.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type NewTheme } from "../experimental";
import colors from "../tailwind";
import colors from "../tailwindColors";

export default {
l1: {
Expand Down
2 changes: 0 additions & 2 deletions site/src/theme/dark/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import colors from "./colors";
import experimental from "./experimental";
import monaco from "./monaco";
import muiTheme from "./mui";

export default {
...muiTheme,
colors,
experimental,
monaco,
};
Loading