修改1.4.0版本的UI
This commit is contained in:
@@ -145,23 +145,7 @@ const Sidebar = ({ isPanel, panelVisible }: Props) => {
|
||||
data={appData?.site}
|
||||
forceClose={isPanel && !panelVisible}
|
||||
/>
|
||||
{/* powered by */}
|
||||
<div className='shrink-0'>
|
||||
{!appData?.custom_config?.remove_webapp_brand && (
|
||||
<div className={cn(
|
||||
'flex shrink-0 items-center gap-1.5 px-1',
|
||||
)}>
|
||||
<div className='system-2xs-medium-uppercase text-text-tertiary'>{t('share.chat.poweredBy')}</div>
|
||||
{
|
||||
systemFeatures.branding.enabled && systemFeatures.branding.workspace_logo
|
||||
? <img src={systemFeatures.branding.workspace_logo} alt='logo' className='block h-5 w-auto' />
|
||||
: appData?.custom_config?.replace_webapp_logo
|
||||
? <img src={`${appData?.custom_config?.replace_webapp_logo}`} alt='logo' className='block h-5 w-auto' />
|
||||
: <DifyLogo size='small' />
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{/* 移除左下角 Powered by 区域 */}
|
||||
{!!showConfirm && (
|
||||
<Confirm
|
||||
title={t('share.chat.deleteConversation.title')}
|
||||
|
||||
@@ -71,25 +71,7 @@ const Chatbot = () => {
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{/* powered by */}
|
||||
{isMobile && (
|
||||
<div className='flex h-[60px] shrink-0 items-center pl-2'>
|
||||
{!appData?.custom_config?.remove_webapp_brand && (
|
||||
<div className={cn(
|
||||
'flex shrink-0 items-center gap-1.5 px-2',
|
||||
)}>
|
||||
<div className='system-2xs-medium-uppercase text-text-tertiary'>{t('share.chat.poweredBy')}</div>
|
||||
{
|
||||
systemFeatures.branding.enabled && systemFeatures.branding.workspace_logo
|
||||
? <img src={systemFeatures.branding.workspace_logo} alt='logo' className='block h-5 w-auto' />
|
||||
: appData?.custom_config?.replace_webapp_logo
|
||||
? <img src={`${appData?.custom_config?.replace_webapp_logo}`} alt='logo' className='block h-5 w-auto' />
|
||||
: <DifyLogo size='small' />
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{/* 移除移动端左下角 Powered by 区域 */}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
80
dify_1.9.0/web/app/components/base/iframe-postmessage.tsx
Normal file
80
dify_1.9.0/web/app/components/base/iframe-postmessage.tsx
Normal file
@@ -0,0 +1,80 @@
|
||||
'use client'
|
||||
import { useEffect, useRef } from 'react'
|
||||
|
||||
/**
|
||||
* IframePostMessage
|
||||
* 页面加载完成后向父页面发送一次消息,并每 5 秒发送一次。
|
||||
* 仅当当前窗口运行在 iframe 中时才发送。
|
||||
*/
|
||||
const IframePostMessage = () => {
|
||||
const initializedRef = useRef(false)
|
||||
|
||||
/**
|
||||
* sendMessage
|
||||
* 向父页面发送消息的函数:收集当前页面的 localStorage 全量键值并发送。
|
||||
* 如果不在 iframe 环境中则不发送。
|
||||
*/
|
||||
const sendMessage = () => {
|
||||
try {
|
||||
if (typeof window === 'undefined') return
|
||||
// 只在 iframe 环境下发送
|
||||
if (window.parent === window) return
|
||||
// 收集 localStorage 全量数据
|
||||
const localStorageData: Record<string, string | null> = {}
|
||||
try {
|
||||
const { localStorage } = window
|
||||
for (let i = 0; i < localStorage.length; i++) {
|
||||
const key = localStorage.key(i)
|
||||
if (!key) continue
|
||||
localStorageData[key] = localStorage.getItem(key)
|
||||
}
|
||||
}
|
||||
catch {
|
||||
// 可能因浏览器隐私设置导致不可访问 localStorage
|
||||
}
|
||||
window.parent.postMessage(
|
||||
{
|
||||
type: 'dify-localstorage',
|
||||
status: 1,
|
||||
message: '将智能体本地缓存发送给父页面!',
|
||||
data: localStorageData,
|
||||
},
|
||||
'*',
|
||||
)
|
||||
}
|
||||
catch {
|
||||
// 忽略跨域或其他运行时错误
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (initializedRef.current) return
|
||||
initializedRef.current = true
|
||||
|
||||
let timer: number | undefined
|
||||
|
||||
const init = () => {
|
||||
sendMessage()
|
||||
timer = window.setInterval(sendMessage, 5000)
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
const onReady = () => {
|
||||
init()
|
||||
document.removeEventListener('DOMContentLoaded', onReady)
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', onReady)
|
||||
}
|
||||
else {
|
||||
init()
|
||||
}
|
||||
|
||||
return () => {
|
||||
if (timer) window.clearInterval(timer)
|
||||
}
|
||||
}, [])
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export default IframePostMessage
|
||||
@@ -5,22 +5,17 @@ import { useRouter } from 'next/navigation'
|
||||
import {
|
||||
RiAccountCircleLine,
|
||||
RiArrowRightUpLine,
|
||||
RiBookOpenLine,
|
||||
RiGithubLine,
|
||||
RiGraduationCapFill,
|
||||
RiInformation2Line,
|
||||
RiLogoutBoxRLine,
|
||||
RiMap2Line,
|
||||
RiSettings3Line,
|
||||
RiStarLine,
|
||||
RiTShirt2Line,
|
||||
} from '@remixicon/react'
|
||||
import Link from 'next/link'
|
||||
import { Menu, MenuButton, MenuItem, MenuItems, Transition } from '@headlessui/react'
|
||||
import Indicator from '../indicator'
|
||||
import AccountAbout from '../account-about'
|
||||
import GithubStar from '../github-star'
|
||||
import Support from './support'
|
||||
// Removed: GithubStar, Support
|
||||
import Compliance from './compliance'
|
||||
import PremiumBadge from '@/app/components/base/premium-badge'
|
||||
import Avatar from '@/app/components/base/avatar'
|
||||
@@ -133,49 +128,11 @@ export default function AppSelector() {
|
||||
</div>
|
||||
{!systemFeatures.branding.enabled && <>
|
||||
<div className='p-1'>
|
||||
<MenuItem>
|
||||
<Link
|
||||
className={cn(itemClassName, 'group justify-between',
|
||||
'data-[active]:bg-state-base-hover',
|
||||
)}
|
||||
href={docLink('/introduction')}
|
||||
target='_blank' rel='noopener noreferrer'>
|
||||
<RiBookOpenLine className='size-4 shrink-0 text-text-tertiary' />
|
||||
<div className='system-md-regular grow px-1 text-text-secondary'>{t('common.userProfile.helpCenter')}</div>
|
||||
<RiArrowRightUpLine className='size-[14px] shrink-0 text-text-tertiary' />
|
||||
</Link>
|
||||
</MenuItem>
|
||||
<Support />
|
||||
{/* 移除:帮助文档与支持按钮 */}
|
||||
{IS_CLOUD_EDITION && isCurrentWorkspaceOwner && <Compliance />}
|
||||
</div>
|
||||
<div className='p-1'>
|
||||
<MenuItem>
|
||||
<Link
|
||||
className={cn(itemClassName, 'group justify-between',
|
||||
'data-[active]:bg-state-base-hover',
|
||||
)}
|
||||
href='https://roadmap.dify.ai'
|
||||
target='_blank' rel='noopener noreferrer'>
|
||||
<RiMap2Line className='size-4 shrink-0 text-text-tertiary' />
|
||||
<div className='system-md-regular grow px-1 text-text-secondary'>{t('common.userProfile.roadmap')}</div>
|
||||
<RiArrowRightUpLine className='size-[14px] shrink-0 text-text-tertiary' />
|
||||
</Link>
|
||||
</MenuItem>
|
||||
<MenuItem>
|
||||
<Link
|
||||
className={cn(itemClassName, 'group justify-between',
|
||||
'data-[active]:bg-state-base-hover',
|
||||
)}
|
||||
href='https://github.com/langgenius/dify'
|
||||
target='_blank' rel='noopener noreferrer'>
|
||||
<RiGithubLine className='size-4 shrink-0 text-text-tertiary' />
|
||||
<div className='system-md-regular grow px-1 text-text-secondary'>{t('common.userProfile.github')}</div>
|
||||
<div className='flex items-center gap-0.5 rounded-[5px] border border-divider-deep bg-components-badge-bg-dimm px-[5px] py-[3px]'>
|
||||
<RiStarLine className='size-3 shrink-0 text-text-tertiary' />
|
||||
<GithubStar className='system-2xs-medium-uppercase text-text-tertiary' />
|
||||
</div>
|
||||
</Link>
|
||||
</MenuItem>
|
||||
{/* 移除:路线图与 GitHub 按钮 */}
|
||||
{
|
||||
document?.body?.getAttribute('data-public-site-about') !== 'hide' && (
|
||||
<MenuItem>
|
||||
|
||||
@@ -583,23 +583,7 @@ const TextGeneration: FC<IMainProps> = ({
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
{/* powered by */}
|
||||
{!customConfig?.remove_webapp_brand && (
|
||||
<div className={cn(
|
||||
'flex shrink-0 items-center gap-1.5 bg-components-panel-bg py-3',
|
||||
isPC ? 'px-8' : 'px-4',
|
||||
!isPC && resultExisted && 'rounded-b-2xl border-b-[0.5px] border-divider-regular',
|
||||
)}>
|
||||
<div className='system-2xs-medium-uppercase text-text-tertiary'>{t('share.chat.poweredBy')}</div>
|
||||
{
|
||||
systemFeatures.branding.enabled && systemFeatures.branding.workspace_logo
|
||||
? <img src={systemFeatures.branding.workspace_logo} alt='logo' className='block h-5 w-auto' />
|
||||
: customConfig?.replace_webapp_logo
|
||||
? <img src={`${customConfig?.replace_webapp_logo}`} alt='logo' className='block h-5 w-auto' />
|
||||
: <DifyLogo size='small' />
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
{/* 移除左下角 Powered by 区域 */}
|
||||
</div>
|
||||
{/* Result */}
|
||||
<div className={cn(
|
||||
|
||||
@@ -4,6 +4,7 @@ import I18nServer from './components/i18n-server'
|
||||
import BrowserInitializer from './components/browser-initializer'
|
||||
import SentryInitializer from './components/sentry-initializer'
|
||||
import Zendesk from './components/base/zendesk'
|
||||
import IframePostMessage from './components/base/iframe-postmessage'
|
||||
import { getLocaleOnServer } from '@/i18n-config/server'
|
||||
import { TanstackQueryInitializer } from '@/context/query-client'
|
||||
import { ThemeProvider } from 'next-themes'
|
||||
@@ -106,6 +107,7 @@ const LocaleLayout = async ({
|
||||
</ThemeProvider>
|
||||
<RoutePrefixHandle />
|
||||
<Zendesk />
|
||||
<IframePostMessage />
|
||||
</body>
|
||||
</html>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user