Perf: remove user profile loading (#22710)
This commit is contained in:
@@ -12,16 +12,16 @@ import { noop } from 'lodash-es'
|
||||
import { useGlobalPublicStore } from '@/context/global-public-context'
|
||||
|
||||
type IAccountSettingProps = {
|
||||
langeniusVersionInfo: LangGeniusVersionResponse
|
||||
langGeniusVersionInfo: LangGeniusVersionResponse
|
||||
onCancel: () => void
|
||||
}
|
||||
|
||||
export default function AccountAbout({
|
||||
langeniusVersionInfo,
|
||||
langGeniusVersionInfo,
|
||||
onCancel,
|
||||
}: IAccountSettingProps) {
|
||||
const { t } = useTranslation()
|
||||
const isLatest = langeniusVersionInfo.current_version === langeniusVersionInfo.latest_version
|
||||
const isLatest = langGeniusVersionInfo.current_version === langGeniusVersionInfo.latest_version
|
||||
const systemFeatures = useGlobalPublicStore(s => s.systemFeatures)
|
||||
|
||||
return (
|
||||
@@ -43,7 +43,7 @@ export default function AccountAbout({
|
||||
/>
|
||||
: <DifyLogo size='large' className='mx-auto' />}
|
||||
|
||||
<div className='text-center text-xs font-normal text-text-tertiary'>Version {langeniusVersionInfo?.current_version}</div>
|
||||
<div className='text-center text-xs font-normal text-text-tertiary'>Version {langGeniusVersionInfo?.current_version}</div>
|
||||
<div className='flex flex-col items-center gap-2 text-center text-xs font-normal text-text-secondary'>
|
||||
<div>© {dayjs().year()} LangGenius, Inc., Contributors.</div>
|
||||
<div className='text-text-accent'>
|
||||
@@ -63,8 +63,8 @@ export default function AccountAbout({
|
||||
<div className='text-xs font-medium text-text-tertiary'>
|
||||
{
|
||||
isLatest
|
||||
? t('common.about.latestAvailable', { version: langeniusVersionInfo.latest_version })
|
||||
: t('common.about.nowAvailable', { version: langeniusVersionInfo.latest_version })
|
||||
? t('common.about.latestAvailable', { version: langGeniusVersionInfo.latest_version })
|
||||
: t('common.about.nowAvailable', { version: langGeniusVersionInfo.latest_version })
|
||||
}
|
||||
</div>
|
||||
<div className='flex items-center'>
|
||||
@@ -80,7 +80,7 @@ export default function AccountAbout({
|
||||
!isLatest && !IS_CE_EDITION && (
|
||||
<Button variant='primary' size='small'>
|
||||
<Link
|
||||
href={langeniusVersionInfo.release_notes}
|
||||
href={langGeniusVersionInfo.release_notes}
|
||||
target='_blank' rel='noopener noreferrer'
|
||||
>
|
||||
{t('common.about.updateNow')}
|
||||
|
||||
@@ -45,7 +45,7 @@ export default function AppSelector() {
|
||||
|
||||
const { t } = useTranslation()
|
||||
const docLink = useDocLink()
|
||||
const { userProfile, langeniusVersionInfo, isCurrentWorkspaceOwner } = useAppContext()
|
||||
const { userProfile, langGeniusVersionInfo, isCurrentWorkspaceOwner } = useAppContext()
|
||||
const { isEducationAccount } = useProviderContext()
|
||||
const { setShowAccountSettingModal } = useModalContext()
|
||||
|
||||
@@ -180,8 +180,8 @@ export default function AppSelector() {
|
||||
<RiInformation2Line className='size-4 shrink-0 text-text-tertiary' />
|
||||
<div className='system-md-regular grow px-1 text-text-secondary'>{t('common.userProfile.about')}</div>
|
||||
<div className='flex shrink-0 items-center'>
|
||||
<div className='system-xs-regular mr-2 text-text-tertiary'>{langeniusVersionInfo.current_version}</div>
|
||||
<Indicator color={langeniusVersionInfo.current_version === langeniusVersionInfo.latest_version ? 'green' : 'orange'} />
|
||||
<div className='system-xs-regular mr-2 text-text-tertiary'>{langGeniusVersionInfo.current_version}</div>
|
||||
<Indicator color={langGeniusVersionInfo.current_version === langGeniusVersionInfo.latest_version ? 'green' : 'orange'} />
|
||||
</div>
|
||||
</div>
|
||||
</MenuItem>
|
||||
@@ -217,7 +217,7 @@ export default function AppSelector() {
|
||||
}
|
||||
</Menu>
|
||||
{
|
||||
aboutVisible && <AccountAbout onCancel={() => setAboutVisible(false)} langeniusVersionInfo={langeniusVersionInfo} />
|
||||
aboutVisible && <AccountAbout onCancel={() => setAboutVisible(false)} langGeniusVersionInfo={langGeniusVersionInfo} />
|
||||
}
|
||||
</div >
|
||||
)
|
||||
|
||||
@@ -16,7 +16,7 @@ export default function Support() {
|
||||
`
|
||||
const { t } = useTranslation()
|
||||
const { plan } = useProviderContext()
|
||||
const { userProfile, langeniusVersionInfo } = useAppContext()
|
||||
const { userProfile, langGeniusVersionInfo } = useAppContext()
|
||||
const canEmailSupport = plan.type === Plan.professional || plan.type === Plan.team || plan.type === Plan.enterprise
|
||||
|
||||
return <Menu as="div" className="relative h-full w-full">
|
||||
@@ -53,7 +53,7 @@ export default function Support() {
|
||||
className={cn(itemClassName, 'group justify-between',
|
||||
'data-[active]:bg-state-base-hover',
|
||||
)}
|
||||
href={mailToSupport(userProfile.email, plan.type, langeniusVersionInfo.current_version)}
|
||||
href={mailToSupport(userProfile.email, plan.type, langGeniusVersionInfo.current_version)}
|
||||
target='_blank' rel='noopener noreferrer'>
|
||||
<RiMailSendLine className='size-4 shrink-0 text-text-tertiary' />
|
||||
<div className='system-md-regular grow px-1 text-text-secondary'>{t('common.userProfile.emailSupport')}</div>
|
||||
|
||||
@@ -12,8 +12,8 @@ const headerEnvClassName: { [k: string]: string } = {
|
||||
|
||||
const EnvNav = () => {
|
||||
const { t } = useTranslation()
|
||||
const { langeniusVersionInfo } = useAppContext()
|
||||
const showEnvTag = langeniusVersionInfo.current_env === 'TESTING' || langeniusVersionInfo.current_env === 'DEVELOPMENT'
|
||||
const { langGeniusVersionInfo } = useAppContext()
|
||||
const showEnvTag = langGeniusVersionInfo.current_env === 'TESTING' || langGeniusVersionInfo.current_env === 'DEVELOPMENT'
|
||||
|
||||
if (!showEnvTag)
|
||||
return null
|
||||
@@ -21,10 +21,10 @@ const EnvNav = () => {
|
||||
return (
|
||||
<div className={`
|
||||
mr-1 flex h-[22px] items-center rounded-md border px-2 text-xs font-medium
|
||||
${headerEnvClassName[langeniusVersionInfo.current_env]}
|
||||
${headerEnvClassName[langGeniusVersionInfo.current_env]}
|
||||
`}>
|
||||
{
|
||||
langeniusVersionInfo.current_env === 'TESTING' && (
|
||||
langGeniusVersionInfo.current_env === 'TESTING' && (
|
||||
<>
|
||||
<Beaker02 className='h-3 w-3' />
|
||||
<div className='ml-1 max-[1280px]:hidden'>{t('common.environment.testing')}</div>
|
||||
@@ -32,7 +32,7 @@ const EnvNav = () => {
|
||||
)
|
||||
}
|
||||
{
|
||||
langeniusVersionInfo.current_env === 'DEVELOPMENT' && (
|
||||
langGeniusVersionInfo.current_env === 'DEVELOPMENT' && (
|
||||
<>
|
||||
<TerminalSquare className='h-3 w-3' />
|
||||
<div className='ml-1 max-[1280px]:hidden'>{t('common.environment.development')}</div>
|
||||
|
||||
Reference in New Issue
Block a user