+ {/* Item Type Selector (create mode only) */}
+ {!isEditMode && (
+
+
setShowTypeDropdown(!showTypeDropdown)}
+ className="w-full px-4 py-2 bg-primary-50 dark:bg-primary-900/20 border border-primary-200 dark:border-primary-800 rounded-lg text-left flex items-center justify-between hover:bg-primary-100 dark:hover:bg-primary-900/30 transition-colors"
+ >
+
+
+ {selectedTypeOption?.iconSvg}
+
+
+ {t('itemTypes.creating')} {selectedTypeOption ? t(selectedTypeOption.titleKey) : ''}
+
+
+
+
+
+
- {/* Folder Selection */}
-
-
- {t('items.folder')}
-
- setItem({ ...item, FolderId: e.target.value || null })}
- className="w-full p-2 border dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-blue-500 focus:border-blue-500"
- >
- {t('items.noFolder')}
- {folders.map(folder => (
-
- {folder.Name}
-
- ))}
-
-
+ {/* Type Dropdown Menu */}
+ {showTypeDropdown && (
+ <>
+
setShowTypeDropdown(false)}
+ />
+
+ {ITEM_TYPE_OPTIONS.map((option) => (
+
handleTypeChange(option.type)}
+ className={`w-full px-4 py-3 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 border-b border-gray-100 dark:border-gray-700 last:border-b-0 ${
+ item.ItemType === option.type
+ ? 'bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-300'
+ : 'text-gray-900 dark:text-white'
+ }`}
+ >
+
+ {option.iconSvg}
+
+
+ {t(option.titleKey)}
+
+ {item.ItemType === option.type && (
+
+
+
+ )}
+
+ ))}
+
+ >
+ )}
+
+ )}
- {/* Render fields grouped by category */}
- {Object.keys(groupedSystemFields).map(category => (
-
-
- {category === 'Login' && t('credentials.loginCredentials')}
- {category === 'Alias' && t('credentials.alias')}
- {category === 'Card' && t('credentials.cardInformation')}
- {category === 'Identity' && t('credentials.identityInformation')}
- {category !== 'Login' && category !== 'Alias' && category !== 'Card' && category !== 'Identity' && category}
-
-
- {groupedSystemFields[category].map(field => (
+ {/* Service Section - Name and URL */}
+
+
{t('credentials.service')}
+
+
setItem({ ...item, Name: value })}
+ type="text"
+ placeholder={t('credentials.serviceName')}
+ required
+ />
+ {/* Service inline fields (login.url) - shown without header */}
+ {serviceInlineFields.map(field => (
{renderFieldInput(
field.FieldKey,
@@ -522,48 +834,219 @@ const ItemAddEdit: React.FC = () => {
))}
- ))}
+
+
+ {/* Render fields grouped by category */}
+ {Object.keys(groupedSystemFields).map(category => {
+ // Special handling for Alias category in Login type (create mode only)
+ const isAliasInLoginCreate = category === 'Alias' && item.ItemType === 'Login' && !isEditMode;
+
+ // If alias in login create mode and not shown, skip rendering (will be available via + menu)
+ if (isAliasInLoginCreate && !showAliasFields) {
+ return null;
+ }
+
+ return (
+
+
+
+ {category === 'Login' && t('credentials.loginCredentials')}
+ {category === 'Alias' && t('credentials.alias')}
+ {category === 'Card' && t('credentials.cardInformation')}
+ {category === 'Identity' && t('credentials.identityInformation')}
+ {category !== 'Login' && category !== 'Alias' && category !== 'Card' && category !== 'Identity' && category}
+
+
+ {/* Show action buttons for Alias section in Login create mode */}
+ {isAliasInLoginCreate && showAliasFields && (
+
+ {/* Regenerate button */}
+
+
+
+
+
+
+ {/* Remove button */}
+
+
+
+
+
+
+
+ )}
+
+
+ {groupedSystemFields[category].map(field => (
+
+ {renderFieldInput(
+ field.FieldKey,
+ field.Label,
+ field.FieldType,
+ field.IsHidden,
+ field.IsMultiValue
+ )}
+
+ ))}
+
+
+ );
+ })}
{/* Custom Fields Section */}
{customFields.length > 0 && (
-
-
+
+
{t('common.customFields')}
+
+ {customFields.map(field => (
+
+
handleUpdateCustomFieldLabel(field.tempId, newLabel)}
+ onDelete={() => handleDeleteCustomField(field.tempId)}
+ />
- {customFields.map(field => (
-
- handleUpdateCustomFieldLabel(field.tempId, newLabel)}
- onDelete={() => handleDeleteCustomField(field.tempId)}
- />
-
- {/* Field input */}
- {renderFieldInput(
- field.tempId,
- '',
- field.fieldType,
- field.isHidden,
- false
- )}
-
- ))}
+ {/* Field input */}
+ {renderFieldInput(
+ field.tempId,
+ '',
+ field.fieldType,
+ field.isHidden,
+ false
+ )}
+
+ ))}
+
)}
- {/* Add Custom Field Button */}
- setShowAddCustomFieldModal(true)}
- className="w-full px-4 py-3 border-2 border-dashed border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-400 rounded-md hover:border-primary-500 hover:text-primary-600 dark:hover:text-primary-400 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 transition-colors"
- >
- + Add Custom Field
-
+ {/* Notes Section - Hidden by default in create mode, with remove button */}
+ {notesField && (showNotes || isEditMode || fieldValues['login.notes']) && (
+
+
+ {t('credentials.notes')}
+ {/* Remove button for notes in create mode */}
+ {!isEditMode && (
+
+
+
+
+
+
+ )}
+
+
+ {renderFieldInput(
+ notesField.FieldKey,
+ notesField.Label,
+ notesField.FieldType,
+ notesField.IsHidden,
+ notesField.IsMultiValue
+ )}
+
+
+ )}
+
+ {/* Dedicated "Add Alias" button - highlighted as core feature */}
+ {showAddAliasButton && (
+
+
+
+
+
+
+
+
+
+ {t('itemTypes.addAlias')}
+
+ )}
+
+ {/* Generic + button with dropdown menu for Notes and Custom Fields */}
+
+
setShowAddMenu(!showAddMenu)}
+ className="w-full px-4 py-3 border-2 border-dashed border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-400 rounded-md hover:border-primary-500 hover:text-primary-600 dark:hover:text-primary-400 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 transition-colors flex items-center justify-center gap-2"
+ >
+
+
+
+
+
+ {/* Add Menu Dropdown */}
+ {showAddMenu && (
+ <>
+
setShowAddMenu(false)}
+ />
+
+ {addMenuOptions.map((option) => (
+
+
+ {option.icon}
+
+ {option.label}
+
+ ))}
+
+ >
+ )}
+
+
+ {/* Folder Selection - Compact at bottom */}
+ {folders.length > 0 && (
+
+
+
+
+
setItem({ ...item, FolderId: e.target.value || null })}
+ className="flex-1 py-1 px-2 text-sm border dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-primary-500 focus:border-primary-500"
+ >
+ {t('items.noFolder')}
+ {folders.map(folder => (
+
+ {folder.Name}
+
+ ))}
+
+
+ )}
{/* Action Buttons */}
-