diff --git a/frontend/src/components/v2/Button/Button.tsx b/frontend/src/components/v2/Button/Button.tsx
index b69545766..7c2a5fd6d 100644
--- a/frontend/src/components/v2/Button/Button.tsx
+++ b/frontend/src/components/v2/Button/Button.tsx
@@ -51,10 +51,10 @@ const buttonVariants = cva(
false: ""
},
size: {
- xs: ["text-xs", "py-1", "px-1"],
- sm: ["text-sm", "py-2", "px-2"],
- md: ["text-md", "py-2", "px-4"],
- lg: ["text-lg", "py-2", "px-8"]
+ xs: ["text-xs", "py-1", "px-2"],
+ sm: ["text-sm", "py-2", "px-4"],
+ md: ["text-md", "py-2", "px-5"],
+ lg: ["text-lg", "py-2", "px-6"]
}
},
compoundVariants: [
@@ -186,16 +186,17 @@ export const Button = forwardRef
(
className="absolute rounded-xl opacity-80"
/>
)}
-
- {leftIcon}
-
+ {leftIcon && (
+
+ {leftIcon}
+
+ )}
(
>
{children}
-
- {rightIcon}
-
+ {rightIcon && (
+
+ {rightIcon}
+
+ )}
);
}
diff --git a/frontend/src/components/v2/Input/Input.tsx b/frontend/src/components/v2/Input/Input.tsx
index 17573e527..7ec540232 100644
--- a/frontend/src/components/v2/Input/Input.tsx
+++ b/frontend/src/components/v2/Input/Input.tsx
@@ -87,7 +87,6 @@ export const Input = forwardRef(
ref
): JSX.Element => {
const handleInput = (event: ChangeEvent) => {
- console.log(123, props, autoCapitalization)
if (autoCapitalization) {
// eslint-disable-next-line no-param-reassign
event.target.value = event.target.value.toUpperCase();
diff --git a/frontend/src/hooks/api/secrets/queries.tsx b/frontend/src/hooks/api/secrets/queries.tsx
index 34ecd7ec4..6f65a8edd 100644
--- a/frontend/src/hooks/api/secrets/queries.tsx
+++ b/frontend/src/hooks/api/secrets/queries.tsx
@@ -54,13 +54,14 @@ export const useGetProjectSecrets = ({
env,
decryptFileKey,
isPaused,
- folderId
+ folderId,
+ secretPath
}: GetProjectSecretsDTO) =>
useQuery({
// wait for all values to be available
enabled: Boolean(decryptFileKey && workspaceId && env) && !isPaused,
- queryKey: secretKeys.getProjectSecret(workspaceId, env, folderId),
- queryFn: () => fetchProjectEncryptedSecrets(workspaceId, env, folderId),
+ queryKey: secretKeys.getProjectSecret(workspaceId, env, folderId || secretPath),
+ queryFn: () => fetchProjectEncryptedSecrets(workspaceId, env, folderId, secretPath),
select: useCallback(
(data: EncryptedSecret[]) => {
const PRIVATE_KEY = localStorage.getItem("PRIVATE_KEY") as string;
diff --git a/frontend/src/hooks/index.ts b/frontend/src/hooks/index.ts
index a3ded034c..98fbe2413 100644
--- a/frontend/src/hooks/index.ts
+++ b/frontend/src/hooks/index.ts
@@ -1,3 +1,4 @@
+export { useDebounce } from "./useDebounce";
export { useLeaveConfirm } from "./useLeaveConfirm";
export { usePersistentState } from "./usePersistentState";
export { usePopUp } from "./usePopUp";
diff --git a/frontend/src/hooks/useDebounce.tsx b/frontend/src/hooks/useDebounce.tsx
new file mode 100644
index 000000000..318763210
--- /dev/null
+++ b/frontend/src/hooks/useDebounce.tsx
@@ -0,0 +1,26 @@
+import { useEffect, useState } from "react";
+
+// Ref: https://usehooks.com/useDebounce/
+export const useDebounce = (value: T, delay = 500): T => {
+ // State and setters for debounced value
+ const [debouncedValue, setDebouncedValue] = useState(value);
+
+ useEffect(
+ () => {
+ // Update debounced value after delay
+ const handler = setTimeout(() => {
+ setDebouncedValue(value);
+ }, delay);
+
+ // Cancel the timeout if value changes (also on delay change or unmount)
+ // This is how we prevent debounced value from updating if value is changed ...
+ // .. within the delay period. Timeout gets cleared and restarted.
+ return () => {
+ clearTimeout(handler);
+ };
+ },
+ [value, delay] // Only re-call effect if value or delay changes
+ );
+
+ return debouncedValue;
+};
diff --git a/frontend/src/views/DashboardPage/DashboardPage.tsx b/frontend/src/views/DashboardPage/DashboardPage.tsx
index 5763128e4..32133445b 100644
--- a/frontend/src/views/DashboardPage/DashboardPage.tsx
+++ b/frontend/src/views/DashboardPage/DashboardPage.tsx
@@ -740,7 +740,7 @@ export const DashboardPage = () => {
return (