Skip to content

Commit 179e833

Browse files
committed
Remove "linux" text from networks, add option to install windows and mac after creating setup key
1 parent 451e922 commit 179e833

File tree

6 files changed

+84
-38
lines changed

6 files changed

+84
-38
lines changed

src/components/PeerSelector.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { DropdownInput } from "@components/DropdownInput";
33
import { Popover, PopoverContent, PopoverTrigger } from "@components/Popover";
44
import TextWithTooltip from "@components/ui/TextWithTooltip";
55
import { VirtualScrollAreaList } from "@components/VirtualScrollAreaList";
6+
import { getOperatingSystem } from "@hooks/useOperatingSystem";
67
import { useSearch } from "@hooks/useSearch";
78
import useFetchApi from "@utils/api";
89
import { cn } from "@utils/helpers";
@@ -11,7 +12,9 @@ import { ChevronsUpDown, MapPin } from "lucide-react";
1112
import * as React from "react";
1213
import { memo, useEffect, useState } from "react";
1314
import { useElementSize } from "@/hooks/useElementSize";
15+
import { OperatingSystem } from "@/interfaces/OperatingSystem";
1416
import { Peer } from "@/interfaces/Peer";
17+
import { OSLogo } from "@/modules/peers/PeerOSCell";
1518

1619
const MapPinIcon = memo(() => <MapPin size={12} />);
1720
MapPinIcon.displayName = "MapPinIcon";
@@ -169,6 +172,7 @@ export function PeerSelector({
169172
items={filteredItems}
170173
onSelect={togglePeer}
171174
renderItem={(option) => {
175+
const os = getOperatingSystem(option.os);
172176
return (
173177
<>
174178
<div
@@ -179,6 +183,17 @@ export function PeerSelector({
179183
: "text-nb-gray-300",
180184
)}
181185
>
186+
<div
187+
className={cn(
188+
"flex items-center justify-center grayscale brightness-[100%] contrast-[40%]",
189+
"w-4 h-4 shrink-0",
190+
os === OperatingSystem.WINDOWS && "p-[2.5px]",
191+
os === OperatingSystem.APPLE && "p-[2.5px]",
192+
os === OperatingSystem.FREEBSD && "p-[1.5px]",
193+
)}
194+
>
195+
<OSLogo os={option.os} />
196+
</div>
182197
<TextWithTooltip text={option.name} maxChars={20} />
183198
</div>
184199

@@ -202,4 +217,4 @@ export function PeerSelector({
202217
</PopoverContent>
203218
</Popover>
204219
);
205-
}
220+
}

src/modules/networks/routing-peers/NetworkRoutingPeerModal.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ function RoutingPeerModalContent({
122122
const [enabled, setEnabled] = useState<boolean>(
123123
router ? router.enabled : true,
124124
);
125+
125126
const [metric, setMetric] = useState(
126127
router?.metric ? router.metric.toString() : "9999",
127128
);
@@ -244,8 +245,8 @@ function RoutingPeerModalContent({
244245
<SegmentedTabs.Content value={"peer"}>
245246
<div>
246247
<HelpText>
247-
Assign a single or multiple Linux peers as routing peers
248-
for the network.
248+
Assign a single or multiple peers as routing peers for the
249+
network.
249250
</HelpText>
250251
<PeerSelector
251252
onChange={setRoutingPeer}
@@ -256,8 +257,8 @@ function RoutingPeerModalContent({
256257
<SegmentedTabs.Content value={"group"}>
257258
<div>
258259
<HelpText>
259-
Assign a peer group with Linux machines to be used as
260-
routing peers.
260+
Assign a peer group with machines to be used as routing
261+
peers.
261262
</HelpText>
262263
<PeerGroupSelector
263264
max={1}
@@ -273,7 +274,7 @@ function RoutingPeerModalContent({
273274
<div>
274275
<Label>{"Don't have a routing peer?"}</Label>
275276
<HelpText className={""}>
276-
You can install NetBird with a setup key on one or more Linux
277+
You can install NetBird with a setup key on one or more
277278
machines to act as routing peers.
278279
</HelpText>
279280
</div>
@@ -419,7 +420,7 @@ const InstallNetBirdWithSetupKeyButton = ({
419420
const choice = await confirm({
420421
title: `Create a Setup Key?`,
421422
description:
422-
"If you continue, a one-off setup key will be automatically created and you will be able to install NetBird on a Linux machine.",
423+
"If you continue, a one-off setup key will be automatically created and you will be able to install NetBird.",
423424
confirmText: "Continue",
424425
cancelText: "Cancel",
425426
type: "default",

src/modules/routes/RouteUpdateModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ function RouteUpdateModalContent({ onSuccess, route, cell }: ModalProps) {
380380
<div>
381381
<Label>Peer Group</Label>
382382
<HelpText>
383-
Assign a peer group with Linux machines to be used as
383+
Assign a peer group with machines to be used as
384384
{isExitNode ? " exit nodes." : " routing peers."}
385385
</HelpText>
386386
<PeerGroupSelector

src/modules/setup-netbird-modal/MacOSTab.tsx

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,19 @@ import {
2323
import Link from "next/link";
2424
import React from "react";
2525
import { OperatingSystem } from "@/interfaces/OperatingSystem";
26-
import { SetupKeyParameter } from "@/modules/setup-netbird-modal/SetupModal";
26+
import {
27+
RoutingPeerSetupKeyInfo,
28+
SetupKeyParameter,
29+
} from "@/modules/setup-netbird-modal/SetupModal";
2730

2831
type Props = {
2932
setupKey?: string;
33+
showSetupKeyInfo?: boolean;
3034
};
31-
export default function MacOSTab({ setupKey }: Readonly<Props>) {
35+
export default function MacOSTab({
36+
setupKey,
37+
showSetupKeyInfo,
38+
}: Readonly<Props>) {
3239
return (
3340
<TabsContent value={String(OperatingSystem.APPLE)}>
3441
<TabsContentPadding>
@@ -104,7 +111,11 @@ export default function MacOSTab({ setupKey }: Readonly<Props>) {
104111

105112
{setupKey ? (
106113
<Steps.Step step={GRPC_API_ORIGIN ? 3 : 2} line={false}>
107-
<p>Open Terminal and run NetBird</p>
114+
<p>
115+
Open Terminal and run NetBird{" "}
116+
{showSetupKeyInfo && <RoutingPeerSetupKeyInfo />}
117+
</p>
118+
108119
<Code>
109120
<Code.Line>
110121
{getNetBirdUpCommand()}
@@ -143,7 +154,10 @@ export default function MacOSTab({ setupKey }: Readonly<Props>) {
143154
</Code>
144155
</Steps.Step>
145156
<Steps.Step step={2} line={false}>
146-
<p>Run NetBird {!setupKey && "and log in the browser"}</p>
157+
<p>
158+
Run NetBird {!setupKey && "and log in the browser"}
159+
{showSetupKeyInfo && <RoutingPeerSetupKeyInfo />}
160+
</p>
147161
<Code>
148162
<Code.Line>
149163
{getNetBirdUpCommand()}
@@ -200,7 +214,10 @@ export default function MacOSTab({ setupKey }: Readonly<Props>) {
200214
</Code>
201215
</Steps.Step>
202216
<Steps.Step step={4} line={false}>
203-
<p>Run NetBird {!setupKey && "and log in the browser"}</p>
217+
<p>
218+
Run NetBird {!setupKey && "and log in the browser"}
219+
{showSetupKeyInfo && <RoutingPeerSetupKeyInfo />}
220+
</p>
204221
<Code>
205222
<Code.Line>
206223
{getNetBirdUpCommand()}

src/modules/setup-netbird-modal/SetupModal.tsx

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -115,26 +115,22 @@ export function SetupModalContent({
115115
Linux
116116
</TabsTrigger>
117117

118-
{!showOnlyRoutingPeerOS && (
119-
<>
120-
<TabsTrigger value={String(OperatingSystem.WINDOWS)}>
121-
<WindowsIcon
122-
className={
123-
"fill-nb-gray-500 group-data-[state=active]/trigger:fill-netbird transition-all"
124-
}
125-
/>
126-
Windows
127-
</TabsTrigger>
128-
<TabsTrigger value={String(OperatingSystem.APPLE)}>
129-
<AppleIcon
130-
className={
131-
"fill-nb-gray-500 group-data-[state=active]/trigger:fill-netbird transition-all"
132-
}
133-
/>
134-
macOS
135-
</TabsTrigger>
136-
</>
137-
)}
118+
<TabsTrigger value={String(OperatingSystem.WINDOWS)}>
119+
<WindowsIcon
120+
className={
121+
"fill-nb-gray-500 group-data-[state=active]/trigger:fill-netbird transition-all"
122+
}
123+
/>
124+
Windows
125+
</TabsTrigger>
126+
<TabsTrigger value={String(OperatingSystem.APPLE)}>
127+
<AppleIcon
128+
className={
129+
"fill-nb-gray-500 group-data-[state=active]/trigger:fill-netbird transition-all"
130+
}
131+
/>
132+
macOS
133+
</TabsTrigger>
138134

139135
{!setupKey && (
140136
<>
@@ -171,8 +167,14 @@ export function SetupModalContent({
171167
setupKey={setupKey}
172168
showSetupKeyInfo={showOnlyRoutingPeerOS}
173169
/>
174-
<WindowsTab setupKey={setupKey} />
175-
<MacOSTab setupKey={setupKey} />
170+
<WindowsTab
171+
setupKey={setupKey}
172+
showSetupKeyInfo={showOnlyRoutingPeerOS}
173+
/>
174+
<MacOSTab
175+
setupKey={setupKey}
176+
showSetupKeyInfo={showOnlyRoutingPeerOS}
177+
/>
176178

177179
{!setupKey && (
178180
<>

src/modules/setup-netbird-modal/WindowsTab.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,20 @@ import { DownloadIcon, PackageOpenIcon } from "lucide-react";
77
import Link from "next/link";
88
import React from "react";
99
import { OperatingSystem } from "@/interfaces/OperatingSystem";
10-
import { SetupKeyParameter } from "@/modules/setup-netbird-modal/SetupModal";
10+
import {
11+
RoutingPeerSetupKeyInfo,
12+
SetupKeyParameter,
13+
} from "@/modules/setup-netbird-modal/SetupModal";
1114

1215
type Props = {
1316
setupKey?: string;
17+
showSetupKeyInfo?: boolean;
1418
};
1519

16-
export default function WindowsTab({ setupKey }: Readonly<Props>) {
20+
export default function WindowsTab({
21+
setupKey,
22+
showSetupKeyInfo,
23+
}: Readonly<Props>) {
1724
return (
1825
<TabsContent value={String(OperatingSystem.WINDOWS)}>
1926
<TabsContentPadding>
@@ -51,7 +58,11 @@ export default function WindowsTab({ setupKey }: Readonly<Props>) {
5158

5259
{setupKey ? (
5360
<Steps.Step step={GRPC_API_ORIGIN ? 3 : 2} line={false}>
54-
<p>Open Command-line and run NetBird</p>
61+
<p>
62+
Open Command-line and run NetBird{" "}
63+
{showSetupKeyInfo && <RoutingPeerSetupKeyInfo />}
64+
</p>
65+
5566
<Code>
5667
<Code.Line>
5768
{getNetBirdUpCommand()}

0 commit comments

Comments
 (0)