mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
🔧 fix: Ensure ShareView document title is configured (#3336)
* 🔧 fix: ensure ShareView document title is configured
* chore: import order
---------
Co-authored-by: Danny Avila <danacordially@gmail.com>
This commit is contained in:
parent
18fd8f1416
commit
14eff23b57
2 changed files with 14 additions and 2 deletions
|
|
@ -1,20 +1,31 @@
|
||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
import { useGetSharedMessages } from 'librechat-data-provider/react-query';
|
import { useGetSharedMessages, useGetStartupConfig } from 'librechat-data-provider/react-query';
|
||||||
|
import { useLocalize, useDocumentTitle } from '~/hooks';
|
||||||
import { ShareContext } from '~/Providers';
|
import { ShareContext } from '~/Providers';
|
||||||
import { Spinner } from '~/components/svg';
|
import { Spinner } from '~/components/svg';
|
||||||
import MessagesView from './MessagesView';
|
import MessagesView from './MessagesView';
|
||||||
import { useLocalize } from '~/hooks';
|
|
||||||
import { buildTree } from '~/utils';
|
import { buildTree } from '~/utils';
|
||||||
import Footer from '../Chat/Footer';
|
import Footer from '../Chat/Footer';
|
||||||
|
|
||||||
function SharedView() {
|
function SharedView() {
|
||||||
const localize = useLocalize();
|
const localize = useLocalize();
|
||||||
|
const { data: config } = useGetStartupConfig();
|
||||||
const { shareId } = useParams();
|
const { shareId } = useParams();
|
||||||
const { data, isLoading } = useGetSharedMessages(shareId ?? '');
|
const { data, isLoading } = useGetSharedMessages(shareId ?? '');
|
||||||
const dataTree = data && buildTree({ messages: data.messages });
|
const dataTree = data && buildTree({ messages: data.messages });
|
||||||
const messagesTree = dataTree?.length === 0 ? null : dataTree ?? null;
|
const messagesTree = dataTree?.length === 0 ? null : dataTree ?? null;
|
||||||
|
|
||||||
|
// configure document title
|
||||||
|
let docTitle = '';
|
||||||
|
if (config?.appTitle && data?.title) {
|
||||||
|
docTitle = `${data?.title} | ${config.appTitle}`;
|
||||||
|
} else {
|
||||||
|
docTitle = data?.title || config?.appTitle || document.title;
|
||||||
|
}
|
||||||
|
|
||||||
|
useDocumentTitle(docTitle);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ShareContext.Provider value={{ isSharedConvo: true }}>
|
<ShareContext.Provider value={{ isSharedConvo: true }}>
|
||||||
<div
|
<div
|
||||||
|
|
|
||||||
|
|
@ -27,3 +27,4 @@ export { default as useOnClickOutside } from './useOnClickOutside';
|
||||||
export { default as useSpeechToText } from './Input/useSpeechToText';
|
export { default as useSpeechToText } from './Input/useSpeechToText';
|
||||||
export { default as useTextToSpeech } from './Input/useTextToSpeech';
|
export { default as useTextToSpeech } from './Input/useTextToSpeech';
|
||||||
export { default as useGenerationsByLatest } from './useGenerationsByLatest';
|
export { default as useGenerationsByLatest } from './useGenerationsByLatest';
|
||||||
|
export { default as useDocumentTitle } from './useDocumentTitle';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue