From 0ccbeb683deb6468b861e41e4bdf3af572b69afa Mon Sep 17 00:00:00 2001 From: Leendert de Borst Date: Mon, 9 Jun 2025 18:29:58 +0200 Subject: [PATCH] Make credential edit flow work (#900) --- .../popup/components/FormInput.tsx | 82 +++++ .../popup/components/icons/HeaderIcons.tsx | 33 +- .../popup/pages/CredentialDetails.tsx | 38 +-- .../popup/pages/CredentialEdit.tsx | 306 +++++++++++++----- .../src/utils/SqliteClient.ts | 161 +++++++++ 5 files changed, 515 insertions(+), 105 deletions(-) create mode 100644 apps/browser-extension/src/entrypoints/popup/components/FormInput.tsx diff --git a/apps/browser-extension/src/entrypoints/popup/components/FormInput.tsx b/apps/browser-extension/src/entrypoints/popup/components/FormInput.tsx new file mode 100644 index 000000000..6e7d9b66e --- /dev/null +++ b/apps/browser-extension/src/entrypoints/popup/components/FormInput.tsx @@ -0,0 +1,82 @@ +import React from 'react'; + +/** + * Form input props. + */ +type FormInputProps = { + id: string; + label: string; + value: string; + onChange: (value: string) => void; + type?: 'text' | 'password'; + placeholder?: string; + required?: boolean; + multiline?: boolean; + rows?: number; + error?: string; +} + +/** + * Form input component. + */ +export const FormInput: React.FC = ({ + id, + label, + value, + onChange, + type = 'text', + placeholder, + required = false, + multiline = false, + rows = 1, + error +}) => { + const [showPassword, setShowPassword] = React.useState(false); + + const inputClasses = `mt-1 block w-full rounded-md ${ + error ? 'border-red-500' : 'border-gray-300 dark:border-gray-700' + } text-gray-900 sm:text-sm rounded-lg shadow-sm focus:ring-primary-500 focus:border-primary-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 p-3`; + + return ( +
+ +
+ {multiline ? ( +