⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.
TypeScript agenticagileai-agentsbug-reportingbug-trackerganttissue-trackerjirajira-alternativekanbanlinearlinear-alternativeopen-sourceproduct-managementproject-managementroadmapself-hostedsprint-planningteam-collaborationtrello-alternative
import { useState } from 'react';
import { Eye, EyeOff } from 'lucide-react';
import { Input } from '@/components/ui/input';
import { useTranslations } from 'next-intl';
// A masked input for a secret (SMTP password, API key, bot token). The stored value
// is never sent to the client, so the field starts empty: when a value is already
// saved, the placeholder shows dots and leaving the field blank keeps the stored
// secret. An eye toggle reveals what the user is typing.
export default function SecretInput({
id,
value,
onChange,
hasStored,
placeholder,
}: {
id: string;
value: string;
onChange: (value: string) => void;
hasStored: boolean;
placeholder?: string;
}) {
const t = useTranslations('common');
const [reveal, setReveal] = useState(false);
return (
<div className="relative">
<Input
id={id}
type={reveal ? 'text' : 'password'}
value={value}
onChange={(e) => onChange(e.target.value)}
placeholder={hasStored ? '••••••••••••' : placeholder}
className="pr-9"
// Browsers ignore "off" on a password field and fill the account's own login
// into it; "new-password" is the value they respect.
autoComplete="new-password"
/>
<button
type="button"
onClick={() => setReveal((r) => !r)}
className="absolute inset-y-0 right-0 flex items-center px-3 text-muted-foreground hover:text-foreground"
aria-label={reveal ? t('hide') : t('show')}
tabIndex={-1}
>
{reveal ? <EyeOff className="size-4" /> : <Eye className="size-4" />}
</button>
</div>
);
}