fix: frontend requested changes

This commit is contained in:
Daniel Hougaard
2025-03-05 22:47:39 +04:00
parent 90cfc44592
commit 7fd4249d00
7 changed files with 59 additions and 57 deletions
@@ -55,7 +55,6 @@ type Props = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "onChange" | "val
secretPath?: string;
environment?: string;
containerClassName?: string;
secretValueHidden?: boolean;
};
type ReferenceItem = {
@@ -72,7 +71,6 @@ export const InfisicalSecretInput = forwardRef<HTMLTextAreaElement, Props>(
containerClassName,
secretPath: propSecretPath,
environment: propEnvironment,
secretValueHidden,
...props
},
ref
@@ -278,7 +276,6 @@ export const InfisicalSecretInput = forwardRef<HTMLTextAreaElement, Props>(
ref={handleRef}
onKeyDown={handleKeyDown}
value={value}
valueHidden={secretValueHidden}
onFocus={() => setIsFocused.on()}
onBlur={(evt) => {
// should not on blur when its mouse down selecting a item from suggestion
@@ -1,13 +1,10 @@
/* eslint-disable react/no-danger */
import { forwardRef, TextareaHTMLAttributes } from "react";
import { faQuestionCircle } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { twMerge } from "tailwind-merge";
import { useToggle } from "@app/hooks";
import { Tooltip } from "../Tooltip";
const REGEX = /(\${([a-zA-Z0-9-_.]+)})/g;
const replaceContentWithDot = (str: string) => {
let finalStr = "";
@@ -18,26 +15,7 @@ const replaceContentWithDot = (str: string) => {
return finalStr;
};
const syntaxHighlight = (
content?: string | null,
isVisible?: boolean,
isImport?: boolean,
valueHidden?: boolean
) => {
if (valueHidden && !content)
return (
<div className="flex items-center gap-2">
<span className="opacity-60">VALUE HIDDEN</span>
<div className="relative z-50">
<Tooltip
className="!relative !z-50 !break-normal !font-inter"
content="You do not have permission to read the value of this secret."
>
<FontAwesomeIcon icon={faQuestionCircle} className="text-xs" />
</Tooltip>
</div>
</div>
);
const syntaxHighlight = (content?: string | null, isVisible?: boolean, isImport?: boolean) => {
if (isImport && !content) return "IMPORTED";
if (content === "") return "EMPTY";
if (!content) return "EMPTY";
@@ -106,7 +84,7 @@ export const SecretInput = forwardRef<HTMLTextAreaElement, Props>(
<pre aria-hidden className="m-0">
<code className={`inline-block w-full ${commonClassName}`}>
<span style={{ whiteSpace: "break-spaces" }}>
{syntaxHighlight(value, isVisible || isSecretFocused, isImport, valueHidden)}
{syntaxHighlight(value, isVisible || isSecretFocused, isImport)}
</span>
</code>
</pre>