forked from lobehub/lobe-chat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ refactor: refactor to improve branding customization (lobehub#4061)
* ♻️ refactor: improve customize * ♻️ refactor: improve customize * ♻️ refactor: improve customize * ♻️ refactor: improve customize * 💄 style: fix size
- Loading branch information
Showing
17 changed files
with
127 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { LobeHub, type LobeHubProps } from '@lobehub/ui/brand'; | ||
import { memo } from 'react'; | ||
|
||
import { ORG_NAME } from '@/const/branding'; | ||
import { isCustomORG } from '@/const/version'; | ||
|
||
export const OrgBrand = memo<LobeHubProps>((props) => { | ||
if (isCustomORG) { | ||
return <span>{ORG_NAME}</span>; | ||
} | ||
|
||
return <LobeHub {...props} />; | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'use client'; | ||
|
||
import Image from 'next/image'; | ||
import { memo } from 'react'; | ||
import { Center } from 'react-layout-kit'; | ||
|
||
import { BRANDING_LOGO_URL, BRANDING_NAME } from '@/const/branding'; | ||
|
||
const WelcomeLogo = memo<{ mobile?: boolean }>(({ mobile }) => { | ||
return mobile ? ( | ||
<Center height={240} width={240}> | ||
<Image | ||
alt={BRANDING_NAME} | ||
height={240} | ||
src={BRANDING_LOGO_URL} | ||
unoptimized={true} | ||
width={240} | ||
/> | ||
</Center> | ||
) : ( | ||
<Center | ||
style={{ | ||
height: `min(482px, 40vw)`, | ||
marginBottom: '-10%', | ||
marginTop: '-20%', | ||
position: 'relative', | ||
width: `min(976px, 80vw)`, | ||
}} | ||
> | ||
<Image | ||
alt={BRANDING_NAME} | ||
height={240} | ||
src={BRANDING_LOGO_URL} | ||
unoptimized={true} | ||
width={240} | ||
/> | ||
</Center> | ||
); | ||
}); | ||
|
||
export default WelcomeLogo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use client'; | ||
|
||
import { memo } from 'react'; | ||
|
||
import { isCustomBranding } from '@/const/version'; | ||
|
||
import CustomLogo from './Custom'; | ||
import LobeChat from './LobeChat'; | ||
|
||
export const WelcomeLogo = memo<{ mobile?: boolean }>(({ mobile }) => { | ||
if (isCustomBranding) { | ||
return <CustomLogo mobile={mobile} />; | ||
} | ||
|
||
return <LobeChat mobile={mobile} />; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export { OrgBrand } from './OrgBrand'; | ||
export { ProductLogo } from './ProductLogo'; | ||
export { WelcomeLogo } from './WelcomeLogo'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
export const LOBE_CHAT_CLOUD = 'LobeChat Cloud'; | ||
|
||
// the code below can only be modified with commercial license | ||
// if you want to use it in the commercial usage | ||
// please contact us for more information: [email protected] | ||
|
||
export const LOBE_CHAT_CLOUD = 'LobeChat Cloud'; | ||
|
||
export const BRANDING_NAME = 'LobeChat'; | ||
export const BRANDING_LOGO_URL = ''; | ||
|
||
export const ORG_NAME = 'LobeHub'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import pkg from '@/../package.json'; | ||
import { getServerDBConfig } from '@/config/db'; | ||
|
||
import { BRANDING_NAME } from './branding'; | ||
import { BRANDING_NAME, ORG_NAME } from './branding'; | ||
|
||
export const CURRENT_VERSION = pkg.version; | ||
|
||
export const isServerMode = getServerDBConfig().NEXT_PUBLIC_ENABLED_SERVER_SERVICE; | ||
|
||
// @ts-ignore | ||
export const isCustomBranding = BRANDING_NAME !== 'LobeChat'; | ||
// @ts-ignore | ||
export const isCustomORG = ORG_NAME !== 'LobeHub'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters