mirror of
https://github.com/netbirdio/dashboard.git
synced 2026-09-23 00:30:43 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f943bb7d4 | ||
|
|
96b939e6cc | ||
|
|
5e13548b81 | ||
|
|
2272a1d2a4 | ||
|
|
fc3da50346 |
No files matched your search
@@ -57,6 +57,8 @@ import { getOperatingSystem } from "@/hooks/useOperatingSystem";
|
|||||||
import { OperatingSystem } from "@/interfaces/OperatingSystem";
|
import { OperatingSystem } from "@/interfaces/OperatingSystem";
|
||||||
import type { Peer } from "@/interfaces/Peer";
|
import type { Peer } from "@/interfaces/Peer";
|
||||||
import PageContainer from "@/layouts/PageContainer";
|
import PageContainer from "@/layouts/PageContainer";
|
||||||
|
import { AddExitNodeButton } from "@/modules/exit-node/AddExitNodeButton";
|
||||||
|
import { useHasExitNodes } from "@/modules/exit-node/useHasExitNodes";
|
||||||
import useGroupHelper from "@/modules/groups/useGroupHelper";
|
import useGroupHelper from "@/modules/groups/useGroupHelper";
|
||||||
import AddRouteDropdownButton from "@/modules/peer/AddRouteDropdownButton";
|
import AddRouteDropdownButton from "@/modules/peer/AddRouteDropdownButton";
|
||||||
import PeerRoutesTable from "@/modules/peer/PeerRoutesTable";
|
import PeerRoutesTable from "@/modules/peer/PeerRoutesTable";
|
||||||
@@ -127,6 +129,7 @@ function PeerOverview() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const { isUser } = useLoggedInUser();
|
const { isUser } = useLoggedInUser();
|
||||||
|
const hasExitNodes = useHasExitNodes(peer);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageContainer>
|
<PageContainer>
|
||||||
@@ -342,7 +345,8 @@ function PeerOverview() {
|
|||||||
</Paragraph>
|
</Paragraph>
|
||||||
</div>
|
</div>
|
||||||
<div className={"inline-flex gap-4 justify-end"}>
|
<div className={"inline-flex gap-4 justify-end"}>
|
||||||
<div>
|
<div className={"gap-4 flex"}>
|
||||||
|
<AddExitNodeButton peer={peer} firstTime={!hasExitNodes} />
|
||||||
<AddRouteDropdownButton />
|
<AddRouteDropdownButton />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import SkeletonTable from "@components/skeletons/SkeletonTable";
|
|||||||
import { RestrictedAccess } from "@components/ui/RestrictedAccess";
|
import { RestrictedAccess } from "@components/ui/RestrictedAccess";
|
||||||
import useFetchApi from "@utils/api";
|
import useFetchApi from "@utils/api";
|
||||||
import { ExternalLinkIcon } from "lucide-react";
|
import { ExternalLinkIcon } from "lucide-react";
|
||||||
import React, { lazy, Suspense } from "react";
|
import React, { lazy, Suspense, useMemo } from "react";
|
||||||
import SetupKeysIcon from "@/assets/icons/SetupKeysIcon";
|
import SetupKeysIcon from "@/assets/icons/SetupKeysIcon";
|
||||||
import { useGroups } from "@/contexts/GroupsProvider";
|
import { useGroups } from "@/contexts/GroupsProvider";
|
||||||
import { Group } from "@/interfaces/Group";
|
import { Group } from "@/interfaces/Group";
|
||||||
@@ -22,16 +22,21 @@ export default function SetupKeys() {
|
|||||||
const { data: setupKeys, isLoading } = useFetchApi<SetupKey[]>("/setup-keys");
|
const { data: setupKeys, isLoading } = useFetchApi<SetupKey[]>("/setup-keys");
|
||||||
const { groups } = useGroups();
|
const { groups } = useGroups();
|
||||||
|
|
||||||
const setupKeysWithGroups = setupKeys?.map((setupKey) => {
|
const setupKeysWithGroups = useMemo(() => {
|
||||||
if (!setupKey.auto_groups) return setupKey;
|
if (!setupKeys) return [];
|
||||||
if (!groups) return setupKey;
|
return setupKeys?.map((setupKey) => {
|
||||||
return {
|
if (!setupKey.auto_groups) return setupKey;
|
||||||
...setupKey,
|
if (!groups) return setupKey;
|
||||||
groups: setupKey.auto_groups.map((group) => {
|
return {
|
||||||
return groups.find((g) => g.id === group) || undefined;
|
...setupKey,
|
||||||
}) as Group[] | undefined,
|
groups: setupKey.auto_groups
|
||||||
};
|
?.map((group) => {
|
||||||
});
|
return groups.find((g) => g.id === group) || undefined;
|
||||||
|
})
|
||||||
|
.filter((group) => group !== undefined) as Group[],
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}, [setupKeys, groups]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageContainer>
|
<PageContainer>
|
||||||
|
|||||||
+34
-2
@@ -1,9 +1,41 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import FullScreenLoading from "@components/ui/FullScreenLoading";
|
import FullScreenLoading from "@components/ui/FullScreenLoading";
|
||||||
|
import { useLocalStorage } from "@hooks/useLocalStorage";
|
||||||
import { useRedirect } from "@hooks/useRedirect";
|
import { useRedirect } from "@hooks/useRedirect";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
url: string;
|
||||||
|
queryParams?: string;
|
||||||
|
};
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
useRedirect("/peers");
|
const [mounted, setMounted] = useState(false);
|
||||||
return <FullScreenLoading />;
|
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 ? (
|
||||||
|
<Redirect
|
||||||
|
url={window?.location?.pathname || "/"}
|
||||||
|
queryParams={queryParams}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<FullScreenLoading />
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Redirect = ({ url, queryParams }: Props) => {
|
||||||
|
useRedirect(url == "/" ? "/peers" : url + (queryParams && `?${queryParams}`));
|
||||||
|
return <FullScreenLoading />;
|
||||||
|
};
|
||||||
@@ -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 (
|
|
||||||
<div
|
|
||||||
className={
|
|
||||||
"w-5 h-5 overflow-hidden rounded-full relative shadow-2xl border border-nb-gray-600 flex items-center justify-center"
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Image
|
|
||||||
src={deIcon}
|
|
||||||
alt={"de"}
|
|
||||||
fill={true}
|
|
||||||
className={"object-cover object-center"}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -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 (
|
|
||||||
<div
|
|
||||||
className={
|
|
||||||
"w-5 h-5 overflow-hidden rounded-full relative shadow-2xl border border-nb-gray-600 flex items-center justify-center"
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Image
|
|
||||||
src={euIcon}
|
|
||||||
alt={"eu"}
|
|
||||||
fill={true}
|
|
||||||
className={"object-cover object-center shrink-0"}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -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 (
|
|
||||||
<div
|
|
||||||
className={
|
|
||||||
"w-5 h-5 overflow-hidden rounded-full relative shadow-2xl border border-nb-gray-600 flex items-center justify-center"
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Image
|
|
||||||
src={jpIcon}
|
|
||||||
alt={"eu"}
|
|
||||||
fill={true}
|
|
||||||
className={"object-cover object-center"}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -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 (
|
|
||||||
<div
|
|
||||||
className={
|
|
||||||
"w-5 h-5 overflow-hidden rounded-full relative shadow-2xl border border-nb-gray-600 flex items-center justify-center"
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Image
|
|
||||||
src={usIcon}
|
|
||||||
alt={"us"}
|
|
||||||
fill={true}
|
|
||||||
className={"object-cover object-center"}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
|
||||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="1000" height="600" viewBox="0 0 5 3">
|
|
||||||
<desc>Flag of Germany</desc>
|
|
||||||
<rect id="black_stripe" width="5" height="3" y="0" x="0" fill="#000"/>
|
|
||||||
<rect id="red_stripe" width="5" height="2" y="1" x="0" fill="#D00"/>
|
|
||||||
<rect id="gold_stripe" width="5" height="1" y="2" x="0" fill="#FFCE00"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 493 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 810 540"><defs><g id="d"><g id="b"><path id="a" d="M0 0v1h.5z" transform="rotate(18 3.157 -.5)"/><use xlink:href="#a" transform="scale(-1 1)"/></g><g id="c"><use xlink:href="#b" transform="rotate(72)"/><use xlink:href="#b" transform="rotate(144)"/></g><use xlink:href="#c" transform="scale(-1 1)"/></g></defs><path fill="#039" d="M0 0h810v540H0z"/><g fill="#fc0" transform="matrix(30 0 0 30 405 270)"><use xlink:href="#d" y="-6"/><use xlink:href="#d" y="6"/><g id="e"><use xlink:href="#d" x="-6"/><use xlink:href="#d" transform="rotate(-144 -2.344 -2.11)"/><use xlink:href="#d" transform="rotate(144 -2.11 -2.344)"/><use xlink:href="#d" transform="rotate(72 -4.663 -2.076)"/><use xlink:href="#d" transform="rotate(72 -5.076 .534)"/></g><use xlink:href="#e" transform="scale(-1 1)"/></g></svg>
|
|
||||||
|
Before Width: | Height: | Size: 888 B |
@@ -1,4 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 600">
|
|
||||||
<rect fill="#fff" height="600" width="900"/>
|
|
||||||
<circle fill="#bc002d" cx="450" cy="300" r="180"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 166 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 7410 3900"><path fill="#b22234" d="M0 0h7410v3900H0z"/><path d="M0 450h7410m0 600H0m0 600h7410m0 600H0m0 600h7410m0 600H0" stroke="#fff" stroke-width="300"/><path fill="#3c3b6e" d="M0 0h2964v2100H0z"/><g fill="#fff"><g id="d"><g id="c"><g id="e"><g id="b"><path id="a" d="M247 90l70.534 217.082-184.66-134.164h228.253L176.466 307.082z"/><use xlink:href="#a" y="420"/><use xlink:href="#a" y="840"/><use xlink:href="#a" y="1260"/></g><use xlink:href="#a" y="1680"/></g><use xlink:href="#b" x="247" y="210"/></g><use xlink:href="#c" x="494"/></g><use xlink:href="#d" x="988"/><use xlink:href="#c" x="1976"/><use xlink:href="#e" x="2470"/></g></svg>
|
|
||||||
|
Before Width: | Height: | Size: 741 B |
Binary file not shown.
@@ -2,7 +2,7 @@ import { useOidc, useOidcUser } from "@axa-fr/react-oidc";
|
|||||||
import Button from "@components/Button";
|
import Button from "@components/Button";
|
||||||
import Paragraph from "@components/Paragraph";
|
import Paragraph from "@components/Paragraph";
|
||||||
import loadConfig from "@utils/config";
|
import loadConfig from "@utils/config";
|
||||||
import { ArrowRightIcon, LogOut } from "lucide-react";
|
import { ArrowRightIcon } from "lucide-react";
|
||||||
import { useSearchParams } from "next/navigation";
|
import { useSearchParams } from "next/navigation";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
@@ -55,7 +55,7 @@ export const OIDCError = () => {
|
|||||||
variant={"primary"}
|
variant={"primary"}
|
||||||
size={"sm"}
|
size={"sm"}
|
||||||
className={"mt-5"}
|
className={"mt-5"}
|
||||||
onClick={() => login("/", { client_id: config.clientId })}
|
onClick={() => logout("/", { client_id: config.clientId })}
|
||||||
>
|
>
|
||||||
Continue
|
Continue
|
||||||
<ArrowRightIcon size={16} />
|
<ArrowRightIcon size={16} />
|
||||||
@@ -83,7 +83,6 @@ export const OIDCError = () => {
|
|||||||
onClick={() => logout("/", { client_id: config.clientId })}
|
onClick={() => logout("/", { client_id: config.clientId })}
|
||||||
>
|
>
|
||||||
Logout
|
Logout
|
||||||
<LogOut size={16} />
|
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
OidcConfiguration,
|
OidcConfiguration,
|
||||||
} from "@axa-fr/react-oidc/dist/vanilla/oidc";
|
} from "@axa-fr/react-oidc/dist/vanilla/oidc";
|
||||||
import FullScreenLoading from "@components/ui/FullScreenLoading";
|
import FullScreenLoading from "@components/ui/FullScreenLoading";
|
||||||
|
import { useLocalStorage } from "@hooks/useLocalStorage";
|
||||||
import { useRedirect } from "@hooks/useRedirect";
|
import { useRedirect } from "@hooks/useRedirect";
|
||||||
import loadConfig, { buildExtras } from "@utils/config";
|
import loadConfig, { buildExtras } from "@utils/config";
|
||||||
import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
||||||
@@ -43,6 +44,19 @@ export default function OIDCProvider({ children }: Props) {
|
|||||||
const [mounted, setMounted] = useState(false);
|
const [mounted, setMounted] = useState(false);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const path = usePathname();
|
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 = () => {
|
const withCustomHistory = () => {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -12,14 +12,14 @@ export default function HelpText({
|
|||||||
className,
|
className,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
return (
|
return (
|
||||||
<p
|
<span
|
||||||
className={cn(
|
className={cn(
|
||||||
"text-[.8rem] dark:text-nb-gray-300",
|
"text-[.8rem] dark:text-nb-gray-300 block font-light tracking-wide",
|
||||||
margin && "mb-2",
|
margin && "mb-2",
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</p>
|
</span>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { IconCircleX } from "@tabler/icons-react";
|
||||||
import type { ErrorResponse } from "@utils/api";
|
import type { ErrorResponse } from "@utils/api";
|
||||||
import { cn } from "@utils/helpers";
|
import { cn } from "@utils/helpers";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
@@ -88,7 +89,7 @@ export default function Notification<T>({
|
|||||||
{loading ? (
|
{loading ? (
|
||||||
<Loader2 size={14} className={"animate-spin"} />
|
<Loader2 size={14} className={"animate-spin"} />
|
||||||
) : error ? (
|
) : error ? (
|
||||||
<XIcon size={14} />
|
<IconCircleX size={24} />
|
||||||
) : (
|
) : (
|
||||||
icon || <CheckIcon size={14} />
|
icon || <CheckIcon size={14} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ export function PeerSelector({
|
|||||||
<PopoverTrigger asChild>
|
<PopoverTrigger asChild>
|
||||||
<button
|
<button
|
||||||
className={cn(
|
className={cn(
|
||||||
"min-h-[42px] w-full relative items-center group",
|
"min-h-[46px] w-full relative items-center group",
|
||||||
"border border-neutral-200 dark:border-nb-gray-700 justify-between py-2 px-3",
|
"border border-neutral-200 dark:border-nb-gray-700 justify-between py-2 px-3",
|
||||||
"rounded-md bg-white text-sm dark:bg-nb-gray-900/40 flex dark:text-neutral-400/70 text-neutral-500 cursor-pointer enabled:hover:dark:bg-nb-gray-900/50",
|
"rounded-md bg-white text-sm dark:bg-nb-gray-900/40 flex dark:text-neutral-400/70 text-neutral-500 cursor-pointer enabled:hover:dark:bg-nb-gray-900/50",
|
||||||
"disabled:opacity-40 disabled:cursor-default",
|
"disabled:opacity-40 disabled:cursor-default",
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ const iconVariant = cva(
|
|||||||
green: "bg-green-950 border-green-500 text-green-500",
|
green: "bg-green-950 border-green-500 text-green-500",
|
||||||
purple: "bg-purple-950 border-purple-500 text-purple-500",
|
purple: "bg-purple-950 border-purple-500 text-purple-500",
|
||||||
indigo: "bg-indigo-950 border-indigo-500 text-indigo-500",
|
indigo: "bg-indigo-950 border-indigo-500 text-indigo-500",
|
||||||
|
yellow: "bg-yellow-950 border-yellow-400 text-yellow-400",
|
||||||
},
|
},
|
||||||
size: {
|
size: {
|
||||||
small: "w-8 h-8",
|
small: "w-8 h-8",
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ interface Props extends IconVariant {
|
|||||||
description: string | React.ReactNode;
|
description: string | React.ReactNode;
|
||||||
className?: string;
|
className?: string;
|
||||||
margin?: string;
|
margin?: string;
|
||||||
|
truncate?: boolean;
|
||||||
}
|
}
|
||||||
export default function ModalHeader({
|
export default function ModalHeader({
|
||||||
icon,
|
icon,
|
||||||
@@ -17,14 +18,19 @@ export default function ModalHeader({
|
|||||||
color = "netbird",
|
color = "netbird",
|
||||||
className = "pb-6 px-8",
|
className = "pb-6 px-8",
|
||||||
margin = "mt-0",
|
margin = "mt-0",
|
||||||
|
truncate = false,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
return (
|
return (
|
||||||
<div className={className}>
|
<div className={cn(className, "min-w-0")}>
|
||||||
<div className={"flex items-start gap-5 pr-10"}>
|
<div className={"flex items-start gap-5 pr-10 min-w-0"}>
|
||||||
{icon && <SquareIcon color={color} icon={icon} />}
|
{icon && <SquareIcon color={color} icon={icon} />}
|
||||||
<div>
|
<div className={"min-w-0"}>
|
||||||
<h2 className={"text-lg my-0 leading-[1.5]"}>{title}</h2>
|
<h2 className={"text-lg my-0 leading-[1.5]"}>{title}</h2>
|
||||||
<Paragraph className={cn("text-sm", margin)}>{description}</Paragraph>
|
<Paragraph
|
||||||
|
className={cn("text-sm", margin, truncate && "!block truncate")}
|
||||||
|
>
|
||||||
|
{description}
|
||||||
|
</Paragraph>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import Button from "@components/Button";
|
import Button from "@components/Button";
|
||||||
import { CommandItem } from "@components/Command";
|
import { CommandItem } from "@components/Command";
|
||||||
|
import Paragraph from "@components/Paragraph";
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from "@components/Popover";
|
import { Popover, PopoverContent, PopoverTrigger } from "@components/Popover";
|
||||||
import { ScrollArea } from "@components/ScrollArea";
|
import { ScrollArea } from "@components/ScrollArea";
|
||||||
import { SelectDropdownSearchInput } from "@components/select/SelectDropdownSearchInput";
|
import { SelectDropdownSearchInput } from "@components/select/SelectDropdownSearchInput";
|
||||||
@@ -31,6 +32,7 @@ interface SelectDropdownProps {
|
|||||||
popoverWidth?: "auto" | number;
|
popoverWidth?: "auto" | number;
|
||||||
options: SelectOption[];
|
options: SelectOption[];
|
||||||
showSearch?: boolean;
|
showSearch?: boolean;
|
||||||
|
showValues?: boolean;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
searchPlaceholder?: string;
|
searchPlaceholder?: string;
|
||||||
isLoading?: boolean;
|
isLoading?: boolean;
|
||||||
@@ -43,6 +45,7 @@ export function SelectDropdown({
|
|||||||
popoverWidth = "auto",
|
popoverWidth = "auto",
|
||||||
options,
|
options,
|
||||||
showSearch = false,
|
showSearch = false,
|
||||||
|
showValues = false,
|
||||||
placeholder = "Select...",
|
placeholder = "Select...",
|
||||||
searchPlaceholder = "Search...",
|
searchPlaceholder = "Search...",
|
||||||
isLoading = false,
|
isLoading = false,
|
||||||
@@ -186,6 +189,7 @@ export function SelectDropdown({
|
|||||||
option={option}
|
option={option}
|
||||||
toggle={toggle}
|
toggle={toggle}
|
||||||
key={option.value}
|
key={option.value}
|
||||||
|
showValue={showValues}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@@ -201,9 +205,11 @@ export function SelectDropdown({
|
|||||||
const SelectDropdownItem = ({
|
const SelectDropdownItem = ({
|
||||||
option,
|
option,
|
||||||
toggle,
|
toggle,
|
||||||
|
showValue = false,
|
||||||
}: {
|
}: {
|
||||||
option: SelectOption;
|
option: SelectOption;
|
||||||
toggle: (value: string) => void;
|
toggle: (value: string) => void;
|
||||||
|
showValue?: boolean;
|
||||||
}) => {
|
}) => {
|
||||||
const value = option.value || "" + option.label || "";
|
const value = option.value || "" + option.label || "";
|
||||||
const elementRef = useRef<HTMLDivElement>(null);
|
const elementRef = useRef<HTMLDivElement>(null);
|
||||||
@@ -233,6 +239,13 @@ const SelectDropdownItem = ({
|
|||||||
<span className={"text-nb-gray-200"}>{option.label}</span>
|
<span className={"text-nb-gray-200"}>{option.label}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{showValue && (
|
||||||
|
<div className={"flex items-center gap-2.5 p-1"}>
|
||||||
|
<Paragraph className={cn("text-sm text-right")}>
|
||||||
|
{option.value}
|
||||||
|
</Paragraph>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</CommandItem>
|
</CommandItem>
|
||||||
) : (
|
) : (
|
||||||
<div className={"h-[35px] py-1 px-2"}></div>
|
<div className={"h-[35px] py-1 px-2"}></div>
|
||||||
|
|||||||
Loaded 20 of 51 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user