From a430284aa21e3ae1f0d5654e55b2ad2852519cc2 Mon Sep 17 00:00:00 2001
From: wwf <yearningwang@iqtogether.com>
Date: 星期三, 04 六月 2025 15:17:49 +0800
Subject: [PATCH] 初始化

---
 app/install/installForm.tsx |   64 +++++++++++++-------------------
 1 files changed, 26 insertions(+), 38 deletions(-)

diff --git a/app/install/installForm.tsx b/app/install/installForm.tsx
index c01be72..abf377e 100644
--- a/app/install/installForm.tsx
+++ b/app/install/installForm.tsx
@@ -1,7 +1,6 @@
 'use client'
-import React, { useCallback, useEffect } from 'react'
+import React, { useEffect } from 'react'
 import { useTranslation } from 'react-i18next'
-import { useDebounceFn } from 'ahooks'
 
 import Link from 'next/link'
 import { useRouter } from 'next/navigation'
@@ -40,7 +39,7 @@
   const {
     register,
     handleSubmit,
-    formState: { errors, isSubmitting },
+    formState: { errors },
   } = useForm<AccountFormValues>({
     resolver: zodResolver(accountFormSchema),
     defaultValues: {
@@ -60,32 +59,19 @@
   }
 
   const handleSetting = async () => {
-    if (isSubmitting) return
     handleSubmit(onSubmit)()
   }
-
-  const { run: debouncedHandleKeyDown } = useDebounceFn(
-    (e: React.KeyboardEvent) => {
-      if (e.key === 'Enter') {
-        e.preventDefault()
-        handleSetting()
-      }
-    },
-    { wait: 200 },
-  )
-
-  const handleKeyDown = useCallback(debouncedHandleKeyDown, [debouncedHandleKeyDown])
 
   useEffect(() => {
     fetchSetupStatus().then((res: SetupStatusResponse) => {
       if (res.step === 'finished') {
         localStorage.setItem('setup_status', 'finished')
-        router.push('/signin')
+        window.location.href = '/signin'
       }
       else {
         fetchInitValidateStatus().then((res: InitValidateStatusResponse) => {
           if (res.status === 'not_started')
-            router.push('/init')
+            window.location.href = '/init'
         })
       }
       setLoading(false)
@@ -97,65 +83,67 @@
       ? <Loading />
       : <>
         <div className="sm:mx-auto sm:w-full sm:max-w-md">
-          <h2 className="text-[32px] font-bold text-text-primary">{t('login.setAdminAccount')}</h2>
-          <p className='mt-1 text-sm text-text-secondary'>{t('login.setAdminAccountDesc')}</p>
+          <h2 className="text-[32px] font-bold text-gray-900">{t('login.setAdminAccount')}</h2>
+          <p className='
+          mt-1 text-sm text-gray-600
+        '>{t('login.setAdminAccountDesc')}</p>
         </div>
-        <div className="mt-8 grow sm:mx-auto sm:w-full sm:max-w-md">
-          <div className="relative">
-            <form onSubmit={handleSubmit(onSubmit)} onKeyDown={handleKeyDown}>
+        <div className="grow mt-8 sm:mx-auto sm:w-full sm:max-w-md">
+          <div className="bg-white ">
+            <form onSubmit={handleSubmit(onSubmit)}>
               <div className='mb-5'>
-                <label htmlFor="email" className="my-2 flex items-center justify-between text-sm font-medium text-text-primary">
+                <label htmlFor="email" className="my-2 flex items-center justify-between text-sm font-medium text-gray-900">
                   {t('login.email')}
                 </label>
-                <div className="mt-1 rounded-md shadow-sm">
+                <div className="mt-1">
                   <input
                     {...register('email')}
                     placeholder={t('login.emailPlaceholder') || ''}
-                    className={'w-full appearance-none rounded-md border border-transparent bg-components-input-bg-normal py-[7px] pl-2 text-components-input-text-filled caret-primary-600 outline-none placeholder:text-components-input-text-placeholder hover:border-components-input-border-hover hover:bg-components-input-bg-hover focus:border-components-input-border-active focus:bg-components-input-bg-active focus:shadow-xs'}
+                    className={'appearance-none block w-full rounded-lg pl-[14px] px-3 py-2 border border-gray-200 hover:border-gray-300 hover:shadow-sm focus:outline-none focus:ring-primary-500 focus:border-primary-500 placeholder-gray-400 caret-primary-600 sm:text-sm'}
                   />
-                  {errors.email && <span className='text-sm text-red-400'>{t(`${errors.email?.message}`)}</span>}
+                  {errors.email && <span className='text-red-400 text-sm'>{t(`${errors.email?.message}`)}</span>}
                 </div>
 
               </div>
 
               <div className='mb-5'>
-                <label htmlFor="name" className="my-2 flex items-center justify-between text-sm font-medium text-text-primary">
+                <label htmlFor="name" className="my-2 flex items-center justify-between text-sm font-medium text-gray-900">
                   {t('login.name')}
                 </label>
-                <div className="relative mt-1 rounded-md shadow-sm">
+                <div className="mt-1 relative rounded-md shadow-sm">
                   <input
                     {...register('name')}
                     placeholder={t('login.namePlaceholder') || ''}
-                    className={'w-full appearance-none rounded-md border border-transparent bg-components-input-bg-normal py-[7px] pl-2 text-components-input-text-filled caret-primary-600 outline-none placeholder:text-components-input-text-placeholder hover:border-components-input-border-hover hover:bg-components-input-bg-hover focus:border-components-input-border-active focus:bg-components-input-bg-active focus:shadow-xs'}
+                    className={'appearance-none block w-full rounded-lg pl-[14px] px-3 py-2 border border-gray-200 hover:border-gray-300 hover:shadow-sm focus:outline-none focus:ring-primary-500 focus:border-primary-500 placeholder-gray-400 caret-primary-600 sm:text-sm pr-10'}
                   />
                 </div>
-                {errors.name && <span className='text-sm text-red-400'>{t(`${errors.name.message}`)}</span>}
+                {errors.name && <span className='text-red-400 text-sm'>{t(`${errors.name.message}`)}</span>}
               </div>
 
               <div className='mb-5'>
-                <label htmlFor="password" className="my-2 flex items-center justify-between text-sm font-medium text-text-primary">
+                <label htmlFor="password" className="my-2 flex items-center justify-between text-sm font-medium text-gray-900">
                   {t('login.password')}
                 </label>
-                <div className="relative mt-1 rounded-md shadow-sm">
+                <div className="mt-1 relative rounded-md shadow-sm">
                   <input
                     {...register('password')}
                     type={showPassword ? 'text' : 'password'}
                     placeholder={t('login.passwordPlaceholder') || ''}
-                    className={'w-full appearance-none rounded-md border border-transparent bg-components-input-bg-normal py-[7px] pl-2 text-components-input-text-filled caret-primary-600 outline-none placeholder:text-components-input-text-placeholder hover:border-components-input-border-hover hover:bg-components-input-bg-hover focus:border-components-input-border-active focus:bg-components-input-bg-active focus:shadow-xs'}
+                    className={'appearance-none block w-full rounded-lg pl-[14px] px-3 py-2 border border-gray-200 hover:border-gray-300 hover:shadow-sm focus:outline-none focus:ring-primary-500 focus:border-primary-500 placeholder-gray-400 caret-primary-600 sm:text-sm pr-10'}
                   />
 
                   <div className="absolute inset-y-0 right-0 flex items-center pr-3">
                     <button
                       type="button"
                       onClick={() => setShowPassword(!showPassword)}
-                      className="text-text-quaternary hover:text-text-tertiary focus:text-text-tertiary focus:outline-none"
+                      className="text-gray-400 hover:text-gray-500 focus:outline-none focus:text-gray-500"
                     >
                       {showPassword ? '馃憖' : '馃槤'}
                     </button>
                   </div>
                 </div>
 
-                <div className={classNames('mt-1 text-xs text-text-tertiary', {
+                <div className={classNames('mt-1 text-xs text-gray-500', {
                   'text-red-400 !text-sm': errors.password,
                 })}>{t('login.error.passwordInvalid')}</div>
               </div>
@@ -166,11 +154,11 @@
                 </Button>
               </div>
             </form>
-            <div className="mt-2 block w-full text-xs text-text-tertiary">
+            <div className="block w-full mt-2 text-xs text-gray-600">
               {t('login.license.tip')}
               &nbsp;
               <Link
-                className='text-text-accent'
+                className='text-primary-600'
                 target='_blank' rel='noopener noreferrer'
                 href={'https://docs.dify.ai/user-agreement/open-source'}
               >{t('login.license.link')}</Link>

--
Gitblit v1.8.0