Skip to content

Commit 1637783

Browse files
authored
Merge branch 'main' into atif/bye-bye-prettier
2 parents 4cea376 + c9eb06e commit 1637783

24 files changed

+693
-332
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://coder.com/docs/CONTRIBUTING

docs/admin/users/idp-sync.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ There are two ways you can configure group sync:
6464
On login, users will automatically be assigned to groups that have matching
6565
names in Coder and removed from groups that the user no longer belongs to.
6666

67-
For cases when an OIDC provider only returns group IDs ([Azure AD][azure-gids])
68-
or you want to have different group names in Coder than in your OIDC provider,
69-
you can configure mapping between the two with the
67+
For cases when an OIDC provider only returns group IDs or you want to have
68+
different group names in Coder than in your OIDC provider, you can configure
69+
mapping between the two with the
7070
[OIDC group mapping](../../reference/cli/server.md#--oidc-group-mapping) server
7171
flag:
7272

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ require (
9595
github.com/chromedp/chromedp v0.11.0
9696
github.com/cli/safeexec v1.0.1
9797
github.com/coder/flog v1.1.0
98-
github.com/coder/guts v0.0.0-20241217141209-abb2d09b4aa5
98+
github.com/coder/guts v1.0.0
9999
github.com/coder/pretty v0.0.0-20230908205945-e89ba86370e0
100100
github.com/coder/quartz v0.1.2
101101
github.com/coder/retry v1.5.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ github.com/coder/go-httpstat v0.0.0-20230801153223-321c88088322 h1:m0lPZjlQ7vdVp
209209
github.com/coder/go-httpstat v0.0.0-20230801153223-321c88088322/go.mod h1:rOLFDDVKVFiDqZFXoteXc97YXx7kFi9kYqR+2ETPkLQ=
210210
github.com/coder/go-scim/pkg/v2 v2.0.0-20230221055123-1d63c1222136 h1:0RgB61LcNs24WOxc3PBvygSNTQurm0PYPujJjLLOzs0=
211211
github.com/coder/go-scim/pkg/v2 v2.0.0-20230221055123-1d63c1222136/go.mod h1:VkD1P761nykiq75dz+4iFqIQIZka189tx1BQLOp0Skc=
212-
github.com/coder/guts v0.0.0-20241217141209-abb2d09b4aa5 h1:IFKvGmAZ0ziutzyhtkQ7kK+y7CEKobq5hNPacC9aHJs=
213-
github.com/coder/guts v0.0.0-20241217141209-abb2d09b4aa5/go.mod h1:SfmxjDaSfPjzKJ9mGU4sA/1OHU+u66uRfhFF+y4BARQ=
212+
github.com/coder/guts v1.0.0 h1:Ba6TBOeED+96Dv8IdISjbGhCzHKicqSc4SEYVV+4zeE=
213+
github.com/coder/guts v1.0.0/go.mod h1:SfmxjDaSfPjzKJ9mGU4sA/1OHU+u66uRfhFF+y4BARQ=
214214
github.com/coder/pq v1.10.5-0.20240813183442-0c420cb5a048 h1:3jzYUlGH7ZELIH4XggXhnTnP05FCYiAFeQpoN+gNR5I=
215215
github.com/coder/pq v1.10.5-0.20240813183442-0c420cb5a048/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
216216
github.com/coder/pretty v0.0.0-20230908205945-e89ba86370e0 h1:3A0ES21Ke+FxEM8CXx9n47SZOKOpgSE1bbJzlE4qPVs=

site/.storybook/preview.jsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ export const parameters = {
6464
},
6565
type: "tablet",
6666
},
67+
iphone12: {
68+
name: "iPhone 12",
69+
styles: {
70+
height: "844px",
71+
width: "390px",
72+
},
73+
type: "mobile",
74+
},
6775
terminal: {
6876
name: "Terminal",
6977
styles: {

site/src/components/Breadcrumb/Breadcrumb.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const BreadcrumbList = forwardRef<
2828
<ol
2929
ref={ref}
3030
className={cn(
31-
"flex flex-wrap items-center text-sm pl-12 my-4 gap-1.5 break-words font-medium list-none sm:gap-2.5",
31+
"flex flex-wrap items-center text-sm pl-6 my-4 gap-1.5 break-words font-medium list-none sm:gap-2.5",
3232
className,
3333
)}
3434
{...props}

site/src/components/Button/Button.tsx

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55
import { Slot } from "@radix-ui/react-slot";
66
import { type VariantProps, cva } from "class-variance-authority";
7-
import { type FC, forwardRef } from "react";
7+
import { forwardRef } from "react";
88
import { cn } from "utils/cn";
99

1010
export const buttonVariants = cva(
@@ -13,7 +13,8 @@ export const buttonVariants = cva(
1313
text-sm font-semibold font-medium cursor-pointer
1414
focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-content-link
1515
disabled:pointer-events-none disabled:text-content-disabled
16-
[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,
16+
[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0
17+
px-3 py-2`,
1718
{
1819
variants: {
1920
variant: {
@@ -25,10 +26,15 @@ export const buttonVariants = cva(
2526
"border-none bg-transparent text-content-secondary hover:text-content-primary",
2627
warning:
2728
"border border-border-error text-content-primary bg-surface-error hover:bg-transparent",
29+
ghost:
30+
"text-content-primary bg-transparent border-0 hover:bg-surface-secondary",
2831
},
32+
2933
size: {
30-
default: "h-9 px-3 py-2",
31-
sm: "h-8 px-2 text-xs",
34+
lg: "h-10",
35+
default: "h-9",
36+
sm: "h-8 px-2 py-1.5 text-xs",
37+
icon: "h-10 w-10",
3238
},
3339
},
3440
defaultVariants: {
@@ -44,16 +50,15 @@ export interface ButtonProps
4450
asChild?: boolean;
4551
}
4652

47-
export const Button: FC<ButtonProps> = forwardRef<
48-
HTMLButtonElement,
49-
ButtonProps
50-
>(({ className, variant, size, asChild = false, ...props }, ref) => {
51-
const Comp = asChild ? Slot : "button";
52-
return (
53-
<Comp
54-
className={cn(buttonVariants({ variant, size, className }))}
55-
ref={ref}
56-
{...props}
57-
/>
58-
);
59-
});
53+
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
54+
({ className, variant, size, asChild = false, ...props }, ref) => {
55+
const Comp = asChild ? Slot : "button";
56+
return (
57+
<Comp
58+
className={cn(buttonVariants({ variant, size, className }))}
59+
ref={ref}
60+
{...props}
61+
/>
62+
);
63+
},
64+
);

site/src/components/DropdownMenu/DropdownMenu.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
*/
88

99
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
10-
import { Check, ChevronRight, Circle } from "lucide-react";
10+
import { Button } from "components/Button/Button";
11+
import { Check, ChevronDownIcon, ChevronRight, Circle } from "lucide-react";
1112
import {
1213
type ComponentPropsWithoutRef,
1314
type ElementRef,
15+
type FC,
1416
type HTMLAttributes,
1517
forwardRef,
1618
} from "react";
@@ -196,7 +198,7 @@ export const DropdownMenuSeparator = forwardRef<
196198
>(({ className, ...props }, ref) => (
197199
<DropdownMenuPrimitive.Separator
198200
ref={ref}
199-
className={cn(["-mx-1 my-1 h-px bg-border"], className)}
201+
className={cn(["-mx-1 my-3 h-px bg-border"], className)}
200202
{...props}
201203
/>
202204
));

site/src/contexts/ProxyContext.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import {
1515
import { useQuery } from "react-query";
1616
import { type ProxyLatencyReport, useProxyLatency } from "./useProxyLatency";
1717

18+
export type Proxies = readonly Region[] | readonly WorkspaceProxy[];
19+
export type ProxyLatencies = Record<string, ProxyLatencyReport>;
1820
export interface ProxyContextValue {
1921
// proxy is **always** the workspace proxy that should be used.
2022
// The 'proxy.selectedProxy' field is the proxy being used and comes from either:
@@ -43,15 +45,15 @@ export interface ProxyContextValue {
4345
// WorkspaceProxy[] is returned if the user is an admin. WorkspaceProxy extends Region with
4446
// more information about the proxy and the status. More information includes the error message if
4547
// the proxy is unhealthy.
46-
proxies?: readonly Region[] | readonly WorkspaceProxy[];
48+
proxies?: Proxies;
4749
// isFetched is true when the 'proxies' api call is complete.
4850
isFetched: boolean;
4951
isLoading: boolean;
5052
error?: unknown;
5153
// proxyLatencies is a map of proxy id to latency report. If the proxyLatencies[proxy.id] is undefined
5254
// then the latency has not been fetched yet. Calculations happen async for each proxy in the list.
5355
// Refer to the returned report for a given proxy for more information.
54-
proxyLatencies: Record<string, ProxyLatencyReport>;
56+
proxyLatencies: ProxyLatencies;
5557
// refetchProxyLatencies will trigger refreshing of the proxy latencies. By default the latencies
5658
// are loaded once.
5759
refetchProxyLatencies: () => Date;

site/src/index.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,17 @@
7070
* {
7171
@apply border-border;
7272
}
73+
74+
/*
75+
By default, Radix adds a margin to the `body` element when a dropdown is displayed,
76+
causing some shifting when the dropdown has a full-width size, as is the case with the mobile menu.
77+
To prevent this, we need to apply the styles below.
78+
79+
There’s a related issue on GitHub: Radix UI Primitives Issue #3251
80+
https://github.com/radix-ui/primitives/issues/3251
81+
*/
82+
html body[data-scroll-locked] {
83+
--removed-body-scroll-bar-size: 0 !important;
84+
margin-right: 0 !important;
85+
}
7386
}

site/src/modules/dashboard/Navbar/DeploymentDropdown.tsx

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
11
import { type Interpolation, type Theme, css, useTheme } from "@emotion/react";
2-
import Button from "@mui/material/Button";
32
import MenuItem from "@mui/material/MenuItem";
4-
import { DropdownArrow } from "components/DropdownArrow/DropdownArrow";
3+
import { Button } from "components/Button/Button";
54
import { FeatureStageBadge } from "components/FeatureStageBadge/FeatureStageBadge";
65
import {
76
Popover,
87
PopoverContent,
98
PopoverTrigger,
109
usePopover,
1110
} from "components/deprecated/Popover/Popover";
11+
import { ChevronDownIcon } from "lucide-react";
1212
import { linkToAuditing } from "modules/navigation";
1313
import type { FC } from "react";
1414
import { NavLink } from "react-router-dom";
1515

1616
interface DeploymentDropdownProps {
1717
canViewDeployment: boolean;
1818
canViewOrganizations: boolean;
19-
canViewAllUsers: boolean;
2019
canViewAuditLog: boolean;
2120
canViewHealth: boolean;
2221
}
2322

2423
export const DeploymentDropdown: FC<DeploymentDropdownProps> = ({
2524
canViewDeployment,
2625
canViewOrganizations,
27-
canViewAllUsers,
2826
canViewAuditLog,
2927
canViewHealth,
3028
}) => {
@@ -34,7 +32,6 @@ export const DeploymentDropdown: FC<DeploymentDropdownProps> = ({
3432
!canViewAuditLog &&
3533
!canViewOrganizations &&
3634
!canViewDeployment &&
37-
!canViewAllUsers &&
3835
!canViewHealth
3936
) {
4037
return null;
@@ -43,17 +40,9 @@ export const DeploymentDropdown: FC<DeploymentDropdownProps> = ({
4340
return (
4441
<Popover>
4542
<PopoverTrigger>
46-
<Button
47-
size="small"
48-
endIcon={
49-
<DropdownArrow
50-
color={theme.experimental.l2.fill.solid}
51-
close={false}
52-
margin={false}
53-
/>
54-
}
55-
>
43+
<Button variant="outline" size="lg">
5644
Admin settings
45+
<ChevronDownIcon className="text-content-primary !size-icon-xs" />
5746
</Button>
5847
</PopoverTrigger>
5948

@@ -70,7 +59,6 @@ export const DeploymentDropdown: FC<DeploymentDropdownProps> = ({
7059
<DeploymentDropdownContent
7160
canViewDeployment={canViewDeployment}
7261
canViewOrganizations={canViewOrganizations}
73-
canViewAllUsers={canViewAllUsers}
7462
canViewAuditLog={canViewAuditLog}
7563
canViewHealth={canViewHealth}
7664
/>

0 commit comments

Comments
 (0)