mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 10:20:15 +01:00
💬 style: Chat UI, Greeting, and Message adjustments (#6612)
* style: reduce gap in Message and Content Render components * style: adjust padding and font size in Chat components for improved layout * feat: personalize greeting message with user name in Landing component
This commit is contained in:
parent
a10bc87979
commit
e2ff0f986d
5 changed files with 19 additions and 16 deletions
|
|
@ -217,7 +217,7 @@ const ChatForm = memo(({ index = 0 }: { index?: number }) => {
|
||||||
<div
|
<div
|
||||||
onClick={handleContainerClick}
|
onClick={handleContainerClick}
|
||||||
className={cn(
|
className={cn(
|
||||||
'relative flex w-full flex-grow flex-col overflow-hidden rounded-t-3xl border border-border-light bg-surface-chat text-text-primary transition-all duration-200 sm:rounded-3xl',
|
'relative flex w-full flex-grow flex-col overflow-hidden rounded-t-3xl border border-border-light bg-surface-chat pb-4 text-text-primary transition-all duration-200 sm:rounded-3xl sm:pb-0',
|
||||||
isTextAreaFocused ? 'shadow-lg' : 'shadow-md',
|
isTextAreaFocused ? 'shadow-lg' : 'shadow-md',
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,12 @@ export default function Landing({ centerFormOnLanding }: { centerFormOnLanding:
|
||||||
|
|
||||||
const getGreeting = useCallback(() => {
|
const getGreeting = useCallback(() => {
|
||||||
if (typeof startupConfig?.interface?.customWelcome === 'string') {
|
if (typeof startupConfig?.interface?.customWelcome === 'string') {
|
||||||
return startupConfig.interface.customWelcome;
|
const customWelcome = startupConfig.interface.customWelcome;
|
||||||
|
// Replace {{user.name}} with actual user name if available
|
||||||
|
if (user?.name && customWelcome.includes('{{user.name}}')) {
|
||||||
|
return customWelcome.replace(/{{user.name}}/g, user.name);
|
||||||
|
}
|
||||||
|
return customWelcome;
|
||||||
}
|
}
|
||||||
|
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
|
|
@ -84,7 +89,7 @@ export default function Landing({ centerFormOnLanding }: { centerFormOnLanding:
|
||||||
else {
|
else {
|
||||||
return localize('com_ui_good_evening');
|
return localize('com_ui_good_evening');
|
||||||
}
|
}
|
||||||
}, [localize, startupConfig?.interface?.customWelcome]);
|
}, [localize, startupConfig?.interface?.customWelcome, user?.name]);
|
||||||
|
|
||||||
const handleLineCountChange = useCallback((count: number) => {
|
const handleLineCountChange = useCallback((count: number) => {
|
||||||
setTextHasMultipleLines(count > 1);
|
setTextHasMultipleLines(count > 1);
|
||||||
|
|
@ -163,9 +168,13 @@ export default function Landing({ centerFormOnLanding }: { centerFormOnLanding:
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<SplitText
|
<SplitText
|
||||||
key={`split-text-${getGreeting()}${user?.name || ''}`}
|
key={`split-text-${getGreeting()}${user?.name ? '-user' : ''}`}
|
||||||
text={getGreeting() + (user?.name ? ', ' + user.name : '')}
|
text={
|
||||||
className="text-4xl font-medium text-text-primary"
|
typeof startupConfig?.interface?.customWelcome === 'string'
|
||||||
|
? getGreeting()
|
||||||
|
: getGreeting() + (user?.name ? ', ' + user.name : '')
|
||||||
|
}
|
||||||
|
className="text-2xl font-medium text-text-primary sm:text-4xl"
|
||||||
delay={50}
|
delay={50}
|
||||||
textAlign="center"
|
textAlign="center"
|
||||||
animationFrom={{ opacity: 0, transform: 'translate3d(0,50px,0)' }}
|
animationFrom={{ opacity: 0, transform: 'translate3d(0,50px,0)' }}
|
||||||
|
|
@ -177,16 +186,10 @@ export default function Landing({ centerFormOnLanding }: { centerFormOnLanding:
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{(isAgent || isAssistant) && description ? (
|
{(isAgent || isAssistant) && description && (
|
||||||
<div className="animate-fadeIn mt-2 max-w-md text-center text-sm font-normal text-text-primary">
|
<div className="animate-fadeIn mt-2 max-w-md text-center text-sm font-normal text-text-primary">
|
||||||
{description}
|
{description}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
|
||||||
typeof startupConfig?.interface?.customWelcome === 'string' && (
|
|
||||||
<div className="animate-fadeIn mt-2 max-w-md text-center text-sm font-normal text-text-primary">
|
|
||||||
{startupConfig?.interface?.customWelcome}
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ export default function Message(props: TMessageProps) {
|
||||||
<h2 className={cn('select-none font-semibold text-text-primary', fontSize)}>
|
<h2 className={cn('select-none font-semibold text-text-primary', fontSize)}>
|
||||||
{name}
|
{name}
|
||||||
</h2>
|
</h2>
|
||||||
<div className="flex flex-col gap-1 md:gap-3">
|
<div className="flex flex-col gap-1">
|
||||||
<div className="flex max-w-full flex-grow flex-col gap-0">
|
<div className="flex max-w-full flex-grow flex-col gap-0">
|
||||||
<ContentParts
|
<ContentParts
|
||||||
edit={edit}
|
edit={edit}
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ const MessageRender = memo(
|
||||||
>
|
>
|
||||||
<h2 className={cn('select-none font-semibold', fontSize)}>{messageLabel}</h2>
|
<h2 className={cn('select-none font-semibold', fontSize)}>{messageLabel}</h2>
|
||||||
|
|
||||||
<div className="flex flex-col gap-1 md:gap-3">
|
<div className="flex flex-col gap-1">
|
||||||
<div className="flex max-w-full flex-grow flex-col gap-0">
|
<div className="flex max-w-full flex-grow flex-col gap-0">
|
||||||
<MessageContext.Provider
|
<MessageContext.Provider
|
||||||
value={{
|
value={{
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ const ContentRender = memo(
|
||||||
>
|
>
|
||||||
<h2 className={cn('select-none font-semibold', fontSize)}>{messageLabel}</h2>
|
<h2 className={cn('select-none font-semibold', fontSize)}>{messageLabel}</h2>
|
||||||
|
|
||||||
<div className="flex flex-col gap-1 md:gap-3">
|
<div className="flex flex-col gap-1">
|
||||||
<div className="flex max-w-full flex-grow flex-col gap-0">
|
<div className="flex max-w-full flex-grow flex-col gap-0">
|
||||||
<ContentParts
|
<ContentParts
|
||||||
edit={edit}
|
edit={edit}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue