diff --git a/ui/dev-dist/sw.js b/ui/dev-dist/sw.js index d40df335..4fd36725 100644 --- a/ui/dev-dist/sw.js +++ b/ui/dev-dist/sw.js @@ -82,7 +82,7 @@ define(['./workbox-54d0af47'], (function (workbox) { 'use strict'; "revision": "3ca0b8505b4bec776b69afdba2768812" }, { "url": "index.html", - "revision": "0.6ektjtehls8" + "revision": "0.gf7mb80njbo" }], {}); workbox.cleanupOutdatedCaches(); workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), { diff --git a/ui/src/components/layouts/AuthLayout/Simple.tsx b/ui/src/components/layouts/AuthLayout/Simple.tsx index 1ef2fbd1..27205ea8 100644 --- a/ui/src/components/layouts/AuthLayout/Simple.tsx +++ b/ui/src/components/layouts/AuthLayout/Simple.tsx @@ -1,31 +1,135 @@ -import { cloneElement } from 'react' +import { cloneElement, useMemo } from 'react' import Container from '@/components/shared/Container' import Card from '@/components/ui/Card' import Logo from '@/components/template/Logo' import type { ReactNode, ReactElement } from 'react' import type { CommonProps } from '@/@types/common' -import { HiArrowLeft } from 'react-icons/hi' +import { HiArrowLeft, HiCheck } from 'react-icons/hi' +import { Avatar, Select } from '@/components/ui' +import i18n, { dateLocales } from '@/locales' +import { useStoreActions, useStoreState } from '@/store' +import appConfig from '@/configs/app.config' +import dayjs from 'dayjs' +import { components } from 'react-select' interface SimpleProps extends CommonProps { content?: ReactNode } const Simple = ({ children, content, ...rest }: SimpleProps) => { + const { config } = useStoreState((state) => state.abpConfig) + const { setLang } = useStoreActions((actions) => actions.locale) + const currentCulture = config?.localization?.currentCulture?.cultureName + + const languageList = config?.localization.languages + + const languageOptions = useMemo(() => { + return ( + languageList?.map((lang) => ({ + label: lang.displayName, + value: lang.cultureName, + cultureName: lang.cultureName, + imgPath: `/img/countries/${lang.cultureName}.png`, + })) || [] + ) + }, [languageList]) + + const onLanguageSelect = (cultureName = appConfig.locale) => { + const dispatchLang = () => { + i18n.changeLanguage(cultureName) + setLang(cultureName) + } + + if (dateLocales[cultureName]) { + dateLocales[cultureName]() + .then(() => { + dayjs.locale(cultureName) + dispatchLang() + }) + .catch(() => { + dispatchLang() + }) + } else { + dispatchLang() + } + } + + const CustomSelectOption = ({ innerProps, label, data, isSelected }: any) => { + return ( +
{translate('::Abp.Account.WelcomeBack.Message')}