diff --git a/src/app/page.tsx b/src/app/page.tsx index f715174..927e589 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,9 +1,41 @@ "use client"; import FullScreenLoading from "@components/ui/FullScreenLoading"; +import { useLocalStorage } from "@hooks/useLocalStorage"; import { useRedirect } from "@hooks/useRedirect"; +import { useEffect, useState } from "react"; + +type Props = { + url: string; + queryParams?: string; +}; export default function Home() { - useRedirect("/peers"); - return ; + const [mounted, setMounted] = useState(false); + const [tempQueryParams, setTempQueryParams] = useLocalStorage( + "netbird-query-params", + "", + ); + const [queryParams, setQueryParams] = useState(""); + + useEffect(() => { + setQueryParams(tempQueryParams); + setTempQueryParams(""); + setMounted(true); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + return mounted ? ( + + ) : ( + + ); } + +const Redirect = ({ url, queryParams }: Props) => { + useRedirect(url == "/" ? "/peers" : url + (queryParams && `?${queryParams}`)); + return ; +}; diff --git a/src/assets/countries/CountryDERounded.tsx b/src/assets/countries/CountryDERounded.tsx deleted file mode 100644 index 6c05511..0000000 --- a/src/assets/countries/CountryDERounded.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import Image from "next/image"; -import * as React from "react"; -import deIcon from "@/assets/countries/de.svg"; - -export const CountryDERounded = () => { - return ( -
- {"de"} -
- ); -}; diff --git a/src/assets/countries/CountryEURounded.tsx b/src/assets/countries/CountryEURounded.tsx deleted file mode 100644 index 3d65163..0000000 --- a/src/assets/countries/CountryEURounded.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import Image from "next/image"; -import * as React from "react"; -import euIcon from "@/assets/countries/eu.svg"; - -export const CountryEURounded = () => { - return ( -
- {"eu"} -
- ); -}; diff --git a/src/assets/countries/CountryJPRounded.tsx b/src/assets/countries/CountryJPRounded.tsx deleted file mode 100644 index 5a5337f..0000000 --- a/src/assets/countries/CountryJPRounded.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import Image from "next/image"; -import * as React from "react"; -import jpIcon from "@/assets/countries/jp.svg"; - -export const CountryJPRounded = () => { - return ( -
- {"eu"} -
- ); -}; diff --git a/src/assets/countries/CountryUSRounded.tsx b/src/assets/countries/CountryUSRounded.tsx deleted file mode 100644 index cbd4939..0000000 --- a/src/assets/countries/CountryUSRounded.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import Image from "next/image"; -import * as React from "react"; -import usIcon from "@/assets/countries/us.svg"; - -export const CountryUSRounded = () => { - return ( -
- {"us"} -
- ); -}; diff --git a/src/assets/countries/de.svg b/src/assets/countries/de.svg deleted file mode 100644 index 4420470..0000000 --- a/src/assets/countries/de.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - Flag of Germany - - - - diff --git a/src/assets/countries/eu.svg b/src/assets/countries/eu.svg deleted file mode 100644 index 7f04d8a..0000000 --- a/src/assets/countries/eu.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/assets/countries/jp.svg b/src/assets/countries/jp.svg deleted file mode 100644 index 6299e73..0000000 --- a/src/assets/countries/jp.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/assets/countries/us.svg b/src/assets/countries/us.svg deleted file mode 100644 index 9201215..0000000 --- a/src/assets/countries/us.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/auth/OIDCError.tsx b/src/auth/OIDCError.tsx index 21b1fcb..c857b50 100644 --- a/src/auth/OIDCError.tsx +++ b/src/auth/OIDCError.tsx @@ -2,7 +2,7 @@ import { useOidc, useOidcUser } from "@axa-fr/react-oidc"; import Button from "@components/Button"; import Paragraph from "@components/Paragraph"; import loadConfig from "@utils/config"; -import { ArrowRightIcon, LogOut } from "lucide-react"; +import { ArrowRightIcon } from "lucide-react"; import { useSearchParams } from "next/navigation"; import * as React from "react"; import { useEffect, useState } from "react"; @@ -55,7 +55,7 @@ export const OIDCError = () => { variant={"primary"} size={"sm"} className={"mt-5"} - onClick={() => login("/", { client_id: config.clientId })} + onClick={() => logout("/", { client_id: config.clientId })} > Continue @@ -83,7 +83,6 @@ export const OIDCError = () => { onClick={() => logout("/", { client_id: config.clientId })} > Logout - )} diff --git a/src/auth/OIDCProvider.tsx b/src/auth/OIDCProvider.tsx index 7d0ea1f..88a5fec 100644 --- a/src/auth/OIDCProvider.tsx +++ b/src/auth/OIDCProvider.tsx @@ -6,6 +6,7 @@ import { OidcConfiguration, } from "@axa-fr/react-oidc/dist/vanilla/oidc"; import FullScreenLoading from "@components/ui/FullScreenLoading"; +import { useLocalStorage } from "@hooks/useLocalStorage"; import { useRedirect } from "@hooks/useRedirect"; import loadConfig, { buildExtras } from "@utils/config"; import { usePathname, useRouter, useSearchParams } from "next/navigation"; @@ -43,6 +44,19 @@ export default function OIDCProvider({ children }: Props) { const [mounted, setMounted] = useState(false); const router = useRouter(); const path = usePathname(); + const params = useSearchParams()?.toString(); + const [, setQueryParams] = useLocalStorage("netbird-query-params", params); + + useEffect(() => { + if ( + params?.includes("tab") || + params?.includes("search") || + params?.includes("id") + ) { + setQueryParams(params); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); const withCustomHistory = () => { return { diff --git a/src/components/HelpText.tsx b/src/components/HelpText.tsx index 61a1d43..8755594 100644 --- a/src/components/HelpText.tsx +++ b/src/components/HelpText.tsx @@ -12,14 +12,14 @@ export default function HelpText({ className, }: Props) { return ( -

{children} -

+ ); } diff --git a/src/components/select/SelectDropdown.tsx b/src/components/select/SelectDropdown.tsx index 4458e9a..6b3bd58 100644 --- a/src/components/select/SelectDropdown.tsx +++ b/src/components/select/SelectDropdown.tsx @@ -1,5 +1,6 @@ import Button from "@components/Button"; import { CommandItem } from "@components/Command"; +import Paragraph from "@components/Paragraph"; import { Popover, PopoverContent, PopoverTrigger } from "@components/Popover"; import { ScrollArea } from "@components/ScrollArea"; import { SelectDropdownSearchInput } from "@components/select/SelectDropdownSearchInput"; @@ -31,6 +32,7 @@ interface SelectDropdownProps { popoverWidth?: "auto" | number; options: SelectOption[]; showSearch?: boolean; + showValues?: boolean; placeholder?: string; searchPlaceholder?: string; isLoading?: boolean; @@ -43,6 +45,7 @@ export function SelectDropdown({ popoverWidth = "auto", options, showSearch = false, + showValues = false, placeholder = "Select...", searchPlaceholder = "Search...", isLoading = false, @@ -186,6 +189,7 @@ export function SelectDropdown({ option={option} toggle={toggle} key={option.value} + showValue={showValues} /> ))} @@ -201,9 +205,11 @@ export function SelectDropdown({ const SelectDropdownItem = ({ option, toggle, + showValue = false, }: { option: SelectOption; toggle: (value: string) => void; + showValue?: boolean; }) => { const value = option.value || "" + option.label || ""; const elementRef = useRef(null); @@ -233,6 +239,13 @@ const SelectDropdownItem = ({ {option.label} + {showValue && ( +
+ + {option.value} + +
+ )} ) : (
diff --git a/src/modules/activity/ActivityDescription.tsx b/src/modules/activity/ActivityDescription.tsx index 137ab98..78b8902 100644 --- a/src/modules/activity/ActivityDescription.tsx +++ b/src/modules/activity/ActivityDescription.tsx @@ -477,15 +477,46 @@ export default function ActivityDescription({ event }: Props) { ); - // TODO add activity texts - // rule.add - // rule.update - // rule.delete - // setupkey.update - // setupkey.overuse - // group.update - // group.delete - // user.peer.login + if (event.activity_code == "transferred.owner.role") + return
Owner role was transferred
; + + /** + * EDR + */ + if (event.activity_code == "integrated-validator.api.created") + return ( +
+ {m?.platform} integration created +
+ ); + + if (event.activity_code == "integrated-validator.api.updated") + return ( +
+ {m?.platform} integration updated +
+ ); + + if (event.activity_code == "integrated-validator.api.deleted") + return ( +
+ {m?.platform} integration deleted +
+ ); + + if (event.activity_code == "integrated-validator.host-check.approved") + return ( +
+ Peer approved by {m?.platform} integration +
+ ); + + if (event.activity_code == "integrated-validator.host-check.denied") + return ( +
+ Peer rejected by {m?.platform} integration +
+ ); return (
diff --git a/src/modules/activity/ActivityTypeIcon.tsx b/src/modules/activity/ActivityTypeIcon.tsx index e42667d..a26fa2f 100644 --- a/src/modules/activity/ActivityTypeIcon.tsx +++ b/src/modules/activity/ActivityTypeIcon.tsx @@ -3,6 +3,7 @@ import { ArrowLeftRight, Blocks, Cog, + CreditCardIcon, FolderGit2, Globe, HelpCircleIcon, @@ -10,6 +11,7 @@ import { LogIn, MonitorSmartphoneIcon, NetworkIcon, + RefreshCcw, Server, Shield, ShieldCheck, @@ -71,10 +73,22 @@ export default function ActivityTypeIcon({ return ; } else if (code.startsWith("service")) { return ; + } else if (code.startsWith("billing")) { + return ( + + ); + } else if (code.startsWith("integrated")) { + return ( + + ); } else if (code.startsWith("posture")) { return ( ); + } else if (code.startsWith("transferred")) { + return ( + + ); } else { return ( diff --git a/src/modules/exit-node/ExitNodeHelpTooltip.tsx b/src/modules/exit-node/ExitNodeHelpTooltip.tsx index 96a3d13..3bbbd74 100644 --- a/src/modules/exit-node/ExitNodeHelpTooltip.tsx +++ b/src/modules/exit-node/ExitNodeHelpTooltip.tsx @@ -12,30 +12,36 @@ export const ExitNodeHelpTooltip = ({ hoverButton = false, }: Props) => { return ( - - An exit node is a network route that routes all your internet traffic - through one of your peers. -
- Learn more about{" "} - - Exit Nodes - - - in our documentation. -
-
- } +
{ + e.stopPropagation(); + }} > - {children} - + + An exit node is a network route that routes all your internet + traffic through one of your peers. +
+ Learn more about{" "} + + Exit Nodes + + + in our documentation. +
+
+ } + > + {children} + + ); }; diff --git a/src/modules/exit-node/ExitNodePeerIndicator.tsx b/src/modules/exit-node/ExitNodePeerIndicator.tsx index 213c121..931195d 100644 --- a/src/modules/exit-node/ExitNodePeerIndicator.tsx +++ b/src/modules/exit-node/ExitNodePeerIndicator.tsx @@ -14,7 +14,7 @@ export const ExitNodePeerIndicator = ({ peer }: Props) => { - This peer has an exit node. Traffic from the configured distribution + This peer is an exit node. Traffic from the configured distribution groups will be routed through this peer. } diff --git a/src/modules/posture-checks/ui/PostureCheckIcons.tsx b/src/modules/posture-checks/ui/PostureCheckIcons.tsx index a2f8f9e..0521024 100644 --- a/src/modules/posture-checks/ui/PostureCheckIcons.tsx +++ b/src/modules/posture-checks/ui/PostureCheckIcons.tsx @@ -2,8 +2,7 @@ import { cn } from "@utils/helpers"; import Image from "next/image"; import * as React from "react"; import { FaWindows } from "react-icons/fa6"; -import { CountryDERounded } from "@/assets/countries/CountryDERounded"; -import { CountryUSRounded } from "@/assets/countries/CountryUSRounded"; +import RoundedFlag from "@/assets/countries/RoundedFlag"; import NetBirdIcon from "@/assets/icons/NetBirdIcon"; import AppleLogo from "@/assets/os-icons/apple.svg"; @@ -24,7 +23,7 @@ export const PostureCheckIcons = () => { "h-6 w-6 overflow-hidden rounded-full flex items-center justify-center" } > - + @@ -36,7 +35,7 @@ export const PostureCheckIcons = () => { "h-6 w-6 overflow-hidden rounded-full flex items-center justify-center" } > - + diff --git a/src/modules/routes/RouteModal.tsx b/src/modules/routes/RouteModal.tsx index 6ba4306..1765313 100644 --- a/src/modules/routes/RouteModal.tsx +++ b/src/modules/routes/RouteModal.tsx @@ -317,7 +317,7 @@ export function RouteModalContent({
Assign a single peer as a routing peer for the - {exitNode ? " Exit Node" : " Network CIDR"} + {exitNode ? " exit node." : " Network CIDR."}
- Assign peer group with Linux machines to be used as - routing peers. + Assign a peer group with Linux machines to be used as + {exitNode ? " exit nodes." : "routing peers."}