♻️ refactor: Login and Registration component Improvement (#2716)

* ♻️ refactor: Login form improvement

* display error message when API is down
* add loading animation to Login form while fetching data
* optimize startupConfig to fetch data only on initial render to prevent unnecessary API calls

* 🚑 fix: clear authentication error messages on successful login

* ♻️ refactor: componentize duplicate codes on registration and login screens

* chore: update types

* refactor: layout rendering order

* refactor: startup title fix

* refactor: reset/request-reset-password under new AuthLayout

* ci: fix Login.spec.ts

* ci: fix registration.spec.tsx

---------

Co-authored-by: Danny Avila <danny@librechat.ai>
This commit is contained in:
Yuichi Oneda 2024-05-28 05:25:07 -07:00 committed by GitHub
parent 2b7a973a33
commit 9f2538fcd9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 775 additions and 750 deletions

View file

@ -0,0 +1,45 @@
import { useLocalize } from '~/hooks';
import { TStartupConfig } from 'librechat-data-provider';
function Footer({ startupConfig }: { startupConfig: TStartupConfig | null | undefined }) {
const localize = useLocalize();
if (!startupConfig) {
return null;
}
const privacyPolicy = startupConfig.interface?.privacyPolicy;
const termsOfService = startupConfig.interface?.termsOfService;
const privacyPolicyRender = privacyPolicy?.externalUrl && (
<a
className="text-sm text-green-500"
href={privacyPolicy.externalUrl}
target={privacyPolicy.openNewTab ? '_blank' : undefined}
rel="noreferrer"
>
{localize('com_ui_privacy_policy')}
</a>
);
const termsOfServiceRender = termsOfService?.externalUrl && (
<a
className="text-sm text-green-500"
href={termsOfService.externalUrl}
target={termsOfService.openNewTab ? '_blank' : undefined}
rel="noreferrer"
>
{localize('com_ui_terms_of_service')}
</a>
);
return (
<div className="align-end m-4 flex justify-center gap-2">
{privacyPolicyRender}
{privacyPolicyRender && termsOfServiceRender && (
<div className="border-r-[1px] border-gray-300 dark:border-gray-600" />
)}
{termsOfServiceRender}
</div>
);
}
export default Footer;