diff --git a/apps/admin/app/dashboard/user/user-form.tsx b/apps/admin/app/dashboard/user/user-form.tsx index cf52917..5e817cf 100644 --- a/apps/admin/app/dashboard/user/user-form.tsx +++ b/apps/admin/app/dashboard/user/user-form.tsx @@ -21,7 +21,6 @@ import { SheetTrigger, } from '@workspace/ui/components/sheet'; import { Switch } from '@workspace/ui/components/switch'; -import { AreaCodeSelect } from '@workspace/ui/custom-components/area-code-select'; import { EnhancedInput } from '@workspace/ui/custom-components/enhanced-input'; import { Icon } from '@workspace/ui/custom-components/icon'; import { unitConversion } from '@workspace/ui/utils'; @@ -52,9 +51,9 @@ export default function UserForm>({ const [open, setOpen] = useState(false); const formSchema = z.object({ - email: z.string().email(t('form.invalidEmailFormat')), - telephone_area_code: z.string().optional(), - telephone: z.string().optional(), + // email: z.string().email(t('form.invalidEmailFormat')), + // telephone_area_code: z.string().optional(), + // telephone: z.string().optional(), password: z.string().optional(), referer_id: z.number().optional(), refer_code: z.string().optional(), @@ -99,7 +98,7 @@ export default function UserForm>({
- ( @@ -159,7 +158,7 @@ export default function UserForm>({ )} - /> + /> */} )} /> - ( - - - - - - - )} - /> {auth?.email?.email_enable_verify && ( )} + ( + + + + + + + )} + /> {verify.enable_reset_password_verify && ( ( - +
+ + +
+
+ +
+ )} + /> + ( + + + )} /> - - {auth?.email?.email_enable_verify && ( - ( - - -
- - -
-
- -
- )} - /> - )} {verify.enable_reset_password_verify && ( "$hook_file" && chmod +x "$hook_file" - if [ $? -eq 0 ]; then - echo "$hook_name hook has been successfully set up." + if [ ! -f ".husky/$hook_name" ]; then + echo "Setting up $hook_name hook..." + echo "$hook_content" > ".husky/$hook_name" || echo "Failed to set up $hook_name hook. Skipping." + chmod +x ".husky/$hook_name" || echo "Failed to make $hook_name hook executable. Skipping." else - echo "Failed to set up $hook_name hook. Skipping." + echo "$hook_name hook is already set up." fi } +# Ensure Husky is installed and initialized +if [ ! -d ".husky" ]; then + echo "Setting up Husky..." + npx husky || echo "Failed to set up Husky. Skipping." +else + echo "Husky is already set up." +fi + # Set up pre-commit hook setup_husky_hook "pre-commit" "#!/bin/sh . \"\$(dirname \"\$0\")/_/husky.sh\" @@ -61,16 +50,11 @@ npx --no-install commitlint --edit \"\$1\"" install_global_package() { local package_name=$1 - if npm list -g --depth=0 "$package_name" > /dev/null 2>&1; then - echo "$package_name is already installed. Skipping installation." - return - fi - - echo "Installing $package_name globally..." - if npm install -g "$package_name"; then - echo "$package_name has been successfully installed." + if ! npm list -g --depth=0 "$package_name" > /dev/null 2>&1; then + echo "Installing $package_name globally..." + npm install -g "$package_name" || echo "Failed to install $package_name globally. Skipping." else - echo "Failed to install $package_name globally. Skipping." + echo "$package_name is already installed." fi } @@ -78,24 +62,6 @@ install_global_package() { install_global_package "@lobehub/i18n-cli" install_global_package "@lobehub/commit-cli" -# Check if .husky/_/prepare-commit-msg contains lobe-commit --hook -if grep -q "lobe-commit --hook" ".husky/_/prepare-commit-msg"; then - echo "prepare-commit-msg hook already contains lobe-commit --hook. Skipping lobe-commit -i." -else - # If the hook does not contain lobe-commit --hook, set it up and run lobe-commit -i - echo "Setting up prepare-commit-msg hook..." - if npx husky add .husky/prepare-commit-msg "exec < /dev/tty && npx lobe-commit -i"; then - echo "prepare-commit-msg hook has been successfully set up." - - # Run lobe-commit interactively - echo "Running lobe-commit -i..." - if lobe-commit -i; then - echo "lobe-commit executed successfully." - else - echo "lobe-commit failed. Skipping." - fi - else - echo "Failed to set up prepare-commit-msg hook. Skipping lobe-commit." - exit 1 - fi -fi +# Run lobe-commit interactively +echo "Running lobe-commit -i..." +lobe-commit -i || echo "lobe-commit failed. Skipping."