Skip to content

Commit

Permalink
feat: open sidebar popup for new users (#1308)
Browse files Browse the repository at this point in the history
  • Loading branch information
berry-13 authored Dec 8, 2023
1 parent 10ace5f commit 20b93ad
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 47 deletions.
12 changes: 11 additions & 1 deletion client/src/components/Nav/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ import {
} from 'librechat-data-provider';
import { useRecoilValue, useSetRecoilState } from 'recoil';
import { useCallback, useEffect, useRef, useState } from 'react';
import { useAuthContext, useMediaQuery, useConversation, useConversations } from '~/hooks';
import {
useAuthContext,
useMediaQuery,
useConversation,
useConversations,
useLocalStorage,
} from '~/hooks';
import { TooltipProvider, Tooltip } from '~/components/ui';
import { Conversations, Pages } from '../Conversations';
import { Spinner } from '~/components';
Expand All @@ -25,6 +31,7 @@ export default function Nav({ navVisible, setNavVisible }) {
const containerRef = useRef<HTMLDivElement | null>(null);
const scrollPositionRef = useRef<number | null>(null);
const isSmallScreen = useMediaQuery('(max-width: 768px)');
const [newUser, setNewUser] = useLocalStorage('newUser', true);

useEffect(() => {
if (isSmallScreen) {
Expand Down Expand Up @@ -142,6 +149,9 @@ export default function Nav({ navVisible, setNavVisible }) {

const toggleNavVisible = () => {
setNavVisible((prev: boolean) => !prev);
if (newUser) {
setNewUser(false);
}
};

const itemToggleNav = () => {
Expand Down
8 changes: 5 additions & 3 deletions client/src/components/Nav/NavToggle.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { TooltipTrigger, TooltipContent } from '~/components/ui';
import { useLocalize } from '~/hooks';
import { useLocalize, useLocalStorage } from '~/hooks';
import { cn } from '~/utils';

export default function NavToggle({ onToggle, navVisible, isHovering, setIsHovering }) {
const localize = useLocalize();
const transition = {
transition: 'transform 0.3s ease, opacity 0.2s ease',
};
const [newUser, setNewUser] = useLocalStorage('newUser', true);

return (
<div
className={cn(
Expand Down Expand Up @@ -44,8 +46,8 @@ export default function NavToggle({ onToggle, navVisible, isHovering, setIsHover
/>
</div>
</div>
<TooltipContent side="right" sideOffset={4}>
{navVisible ? localize('com_nav_close_menu') : localize('com_nav_open_menu')}
<TooltipContent forceMount={newUser ? true : undefined} side="right" sideOffset={4}>
{navVisible ? localize('com_nav_close_sidebar') : localize('com_nav_open_sidebar')}
</TooltipContent>
</span>
</button>
Expand Down
2 changes: 0 additions & 2 deletions client/src/localization/languages/Ar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,6 @@ export default {
com_nav_plugin_search: 'ابحث عن الإضافات',
com_nav_plugin_auth_error:
'حدث خطأ أثناء محاولة المصادقة على هذا البرنامج المساعد. يرجى المحاولة مرة أخرى.',
com_nav_close_menu: 'إغلاق القائمة الجانبية',
com_nav_open_menu: 'افتح القائمة الجانبية',
com_nav_export_filename: 'اسم الملف',
com_nav_export_filename_placeholder: 'قم بتعيين اسم الملف',
com_nav_export_type: 'النوع',
Expand Down
23 changes: 12 additions & 11 deletions client/src/localization/languages/Br.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ export default {
com_ui_examples: 'Exemplos',
com_ui_new_chat: 'Novo Chat',
com_ui_example_quantum_computing: 'Explique a computação quântica em termos simples',
com_ui_example_10_year_old_b_day: 'Tem alguma ideia criativa para o aniversário de uma criança de 10 anos?',
com_ui_example_10_year_old_b_day:
'Tem alguma ideia criativa para o aniversário de uma criança de 10 anos?',
com_ui_example_http_in_js: 'Como fazer uma requisição HTTP em Javascript?',
com_ui_capabilities: 'Capacidades',
com_ui_capability_remember: 'Lembra do que o usuário disse anteriormente na conversa',
Expand Down Expand Up @@ -54,8 +55,7 @@ export default {
'Não foi possível fazer login com as informações fornecidas. Por favor, verifique suas credenciais e tente novamente.',
com_auth_error_login_rl:
'Muitas tentativas de login em um curto espaço de tempo. Por favor, tente novamente mais tarde.',
com_auth_error_login_ban:
'Sua conta foi temporariamente banida por violações do nosso serviço.',
com_auth_error_login_ban: 'Sua conta foi temporariamente banida por violações do nosso serviço.',
com_auth_error_login_server:
'Houve um erro interno do servidor. Por favor, espere alguns momentos e tente novamente.',
com_auth_no_account: 'Não tem uma conta?',
Expand All @@ -80,8 +80,7 @@ export default {
com_auth_password_not_match: 'Senhas não coincidem',
com_auth_continue: 'Continuar',
com_auth_create_account: 'Crie sua conta',
com_auth_error_create:
'Houve um erro ao tentar registrar sua conta. Por favor, tente novamente.',
com_auth_error_create: 'Houve um erro ao tentar registrar sua conta. Por favor, tente novamente.',
com_auth_full_name: 'Nome completo',
com_auth_name_required: 'Nome é obrigatório',
com_auth_name_min_length: 'Nome deve ter pelo menos 3 caracteres',
Expand Down Expand Up @@ -135,7 +134,8 @@ export default {
com_endpoint_google_maxoutputtokens:
'Número máximo de tokens que podem ser gerados na resposta. Especifique um valor menor para respostas mais curtas e um valor maior para respostas mais longas.',
com_endpoint_google_custom_name_placeholder: 'Defina um nome personalizado para o PaLM2',
com_endpoint_prompt_prefix_placeholder: 'Defina instruções ou contexto personalizados. Ignorado se vazio.',
com_endpoint_prompt_prefix_placeholder:
'Defina instruções ou contexto personalizados. Ignorado se vazio.',
com_endpoint_custom_name: 'Nome Personalizado',
com_endpoint_prompt_prefix: 'Prefixo do Prompt',
com_endpoint_temperature: 'Temperatura',
Expand Down Expand Up @@ -174,7 +174,8 @@ export default {
com_endpoint_plug_set_custom_instructions_for_gpt_placeholder:
'Defina instruções personalizadas para incluir na Mensagem do Sistema. Padrão: nenhum',
com_endpoint_import: 'Importar',
com_endpoint_set_custom_name: 'Defina um nome personalizado, caso você possa encontrar este preset',
com_endpoint_set_custom_name:
'Defina um nome personalizado, caso você possa encontrar este preset',
com_endpoint_preset: 'preset',
com_endpoint_presets: 'presets',
com_endpoint_preset_name: 'Nome do Preset',
Expand Down Expand Up @@ -210,15 +211,17 @@ export default {
com_endpoint_config_key_encryption: 'Sua chave será criptografada e excluída em',
com_endpoint_config_key_expiry: 'o tempo de expiração',
com_endpoint_config_key_import_json_key: 'Importar Chave JSON da Conta de Serviço.',
com_endpoint_config_key_import_json_key_success: 'Chave JSON da Conta de Serviço Importada com Sucesso',
com_endpoint_config_key_import_json_key_success:
'Chave JSON da Conta de Serviço Importada com Sucesso',
com_endpoint_config_key_import_json_key_invalid:
'Chave JSON da Conta de Serviço Inválida, Você importou o arquivo correto?',
com_endpoint_config_key_get_edge_key: 'Para obter seu token de acesso para o Bing, faça login em',
com_endpoint_config_key_get_edge_key_dev_tool:
'Use as ferramentas de desenvolvimento ou uma extensão enquanto estiver logado no site para copiar o conteúdo do cookie _U. Se isso falhar, siga estas',
com_endpoint_config_key_edge_instructions: 'instruções',
com_endpoint_config_key_edge_full_key_string: 'para fornecer as strings completas dos cookies.',
com_endpoint_config_key_chatgpt: 'Para obter seu token de acesso para o ChatGPT "Versão Gratuita", faça login em',
com_endpoint_config_key_chatgpt:
'Para obter seu token de acesso para o ChatGPT "Versão Gratuita", faça login em',
com_endpoint_config_key_chatgpt_then_visit: 'depois visite',
com_endpoint_config_key_chatgpt_copy_token: 'Copie o token de acesso.',
com_endpoint_config_key_google_need_to: 'Você precisa',
Expand All @@ -232,8 +235,6 @@ export default {
com_nav_plugin_search: 'Pesquisar plugins',
com_nav_plugin_auth_error:
'Houve um erro ao tentar autenticar este plugin. Por favor, tente novamente.',
com_nav_close_menu: 'Fechar barra lateral',
com_nav_open_menu: 'Abrir barra lateral',
com_nav_export_filename: 'Nome do arquivo',
com_nav_export_filename_placeholder: 'Defina o nome do arquivo',
com_nav_export_type: 'Tipo',
Expand Down
2 changes: 0 additions & 2 deletions client/src/localization/languages/Eng.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,6 @@ export default {
com_nav_plugin_search: 'Search plugins',
com_nav_plugin_auth_error:
'There was an error attempting to authenticate this plugin. Please try again.',
com_nav_close_menu: 'Close sidebar',
com_nav_open_menu: 'Open sidebar',
com_nav_export_filename: 'Filename',
com_nav_export_filename_placeholder: 'Set the filename',
com_nav_export_type: 'Type',
Expand Down
2 changes: 0 additions & 2 deletions client/src/localization/languages/Es.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,6 @@ export default {
com_nav_plugin_search: 'Buscar plugins',
com_nav_plugin_auth_error:
'Hubo un error al intentar autenticar este plugin. Por favor, inténtalo de nuevo.',
com_nav_close_menu: 'Cerrar barra lateral',
com_nav_open_menu: 'Abrir barra lateral',
com_nav_export_filename: 'Nombre de archivo',
com_nav_export_filename_placeholder: 'Establece el nombre de archivo',
com_nav_export_type: 'Tipo',
Expand Down
2 changes: 0 additions & 2 deletions client/src/localization/languages/Fr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,6 @@ export default {
com_nav_plugin_search: 'Rechercher des plugins',
com_nav_plugin_auth_error:
'Une erreur s\'est produite lors de la tentative d\'authentification de ce plugin. Veuillez réessayer.',
com_nav_close_menu: 'Fermer la barre latérale',
com_nav_open_menu: 'Ouvrir la barre latérale',
com_nav_export_filename: 'Nom du fichier',
com_nav_export_filename_placeholder: 'Définir le nom du fichier',
com_nav_export_type: 'Type',
Expand Down
2 changes: 0 additions & 2 deletions client/src/localization/languages/It.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,6 @@ export default {
com_nav_plugin_search: 'Cerca plugin',
com_nav_plugin_auth_error:
'Si è verificato un errore durante il tentativo di autenticare questo plugin. Per favore, riprova.',
com_nav_close_menu: 'Apri la barra laterale',
com_nav_open_menu: 'Chiudi la barra laterale',
com_nav_export_filename: 'Nome del file',
com_nav_export_filename_placeholder: 'Imposta il nome del file',
com_nav_export_type: 'Tipo',
Expand Down
21 changes: 11 additions & 10 deletions client/src/localization/languages/Jp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@ export default {
'入力された情報ではログインできませんでした。認証情報を確認した上で再度お試しください。',
com_auth_error_login_rl:
'お使いのIPアドレスから短時間に多数のログイン試行がありました。しばらくしてから再度お試しください。',
com_auth_error_login_ban:
'本サービスの利用規約違反のため、一時的にアカウントを停止しました。',
com_auth_error_login_ban: '本サービスの利用規約違反のため、一時的にアカウントを停止しました。',
com_auth_error_login_server:
'サーバーエラーが発生しています。。しばらくしてから再度お試しください。',
'サーバーエラーが発生しています。。しばらくしてから再度お試しください。',
com_auth_no_account: 'アカウントをお持ちでない場合はこちら',
com_auth_sign_up: '新規登録',
com_auth_sign_in: 'ログイン',
Expand Down Expand Up @@ -135,7 +134,8 @@ export default {
com_endpoint_google_maxoutputtokens:
' 生成されるレスポンスの最大トークン数。短いレスポンスには低い値を、長いレスポンスには高い値を指定します。',
com_endpoint_google_custom_name_placeholder: 'PaLM2のカスタム名を設定する',
com_endpoint_prompt_prefix_placeholder: 'custom instructions か context を設定する。空の場合は無視されます。',
com_endpoint_prompt_prefix_placeholder:
'custom instructions か context を設定する。空の場合は無視されます。',
com_endpoint_custom_name: 'プリセット名',
com_endpoint_prompt_prefix: 'プロンプトの先頭',
com_endpoint_temperature: 'Temperature',
Expand All @@ -144,7 +144,7 @@ export default {
com_endpoint_top_k: 'Top K',
com_endpoint_max_output_tokens: '最大出力トークン数',
com_endpoint_openai_temp:
'大きい値 = ランダム性が増します。低い値 = より決定論的になります。この値を変更するか、Top P の変更をおすすめしますが、両方を変更はおすすめしません。',
'大きい値 = ランダム性が増します。低い値 = より決定論的になります。この値を変更するか、Top P の変更をおすすめしますが、両方を変更はおすすめしません。',
com_endpoint_openai_max:
'生成されるトークンの最大値。入力トークンと出力トークンの長さの合計は、モデルのコンテキスト長によって制限されます。',
com_endpoint_openai_topp:
Expand Down Expand Up @@ -225,15 +225,18 @@ export default {
com_endpoint_config_key_encryption: '鍵は暗号化されます。削除予定日:',
com_endpoint_config_key_expiry: 'すでに有効期限切れです',
com_endpoint_config_key_import_json_key: 'Service Account JSON Key をインポートする。',
com_endpoint_config_key_import_json_key_success: 'Service Account JSON Keyのインポートに成功しました。',
com_endpoint_config_key_import_json_key_success:
'Service Account JSON Keyのインポートに成功しました。',
com_endpoint_config_key_import_json_key_invalid:
'無効なService Account JSON Keyです。正しいファイルかどうか確認してください。',
com_endpoint_config_key_get_edge_key: 'Bing用のアクセストークンを取得するためにログインをしてください: ',
com_endpoint_config_key_get_edge_key:
'Bing用のアクセストークンを取得するためにログインをしてください: ',
com_endpoint_config_key_get_edge_key_dev_tool:
'サイトにログインした状態で、開発ツールまたは拡張機能を使用して、_U クッキーの内容をコピーします。もし失敗する場合は次の手順に従ってください。',
com_endpoint_config_key_edge_instructions: '手順',
com_endpoint_config_key_edge_full_key_string: 'to provide the full cookie strings.',
com_endpoint_config_key_chatgpt: 'ChatGPTの「無料版」のアクセストークンを入手するためにへログインをしてください:',
com_endpoint_config_key_chatgpt:
'ChatGPTの「無料版」のアクセストークンを入手するためにへログインをしてください:',
com_endpoint_config_key_chatgpt_then_visit: 'つぎに、ここへアクセスしてください:',
com_endpoint_config_key_chatgpt_copy_token: 'トークンをコピーしてください。',
com_endpoint_config_key_google_need_to: 'こちらを有効化する必要があります:',
Expand All @@ -248,8 +251,6 @@ export default {
com_nav_plugin_search: 'プラグイン検索',
com_nav_plugin_auth_error:
'このプラグインの認証中にエラーが発生しました。もう一度お試しください。',
com_nav_close_menu: 'サイドバーを閉じる',
com_nav_open_menu: 'サイドバーを開く',
com_nav_export_filename: 'ファイル名',
com_nav_export_filename_placeholder: 'ファイル名を入力してください',
com_nav_export_type: '形式',
Expand Down
2 changes: 0 additions & 2 deletions client/src/localization/languages/Nl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,6 @@ export default {
com_nav_plugin_search: 'Plugins zoeken',
com_nav_plugin_auth_error:
'Er trad een fout op bij het authenticeren van deze plugin. Probeer het opnieuw.',
com_nav_close_menu: 'Zijbalk sluiten',
com_nav_open_menu: 'Zijbalk openen',
com_nav_export_filename: 'Bestandsnaam',
com_nav_export_filename_placeholder: 'Stel de bestandsnaam in',
com_nav_export_type: 'Type',
Expand Down
5 changes: 1 addition & 4 deletions client/src/localization/languages/Tr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ export default {
com_ui_showing: 'Gösteriliyor',
com_ui_of: 'of',
com_ui_entries: 'Girişler',
com_ui_pay_per_call:
'Tüm yapay zekalar bir yerde. Ayda bir değil, çağrı başına ödeme yapın',
com_ui_pay_per_call: 'Tüm yapay zekalar bir yerde. Ayda bir değil, çağrı başına ödeme yapın',
com_ui_enter: 'Gir',
com_ui_submit: 'Gönder',
com_ui_upload_success: 'Dosya başarıyla yüklendi',
Expand Down Expand Up @@ -237,8 +236,6 @@ export default {
com_nav_plugin_search: 'Eklentileri Ara',
com_nav_plugin_auth_error:
'Bu eklentiyi kimlik doğrulama girişiminde bir hata oluştu. Lütfen tekrar deneyin.',
com_nav_close_menu: 'Kenar çubuğunu kapat',
com_nav_open_menu: 'Kenar çubuğunu aç',
com_nav_export_filename: 'Dosya adı',
com_nav_export_filename_placeholder: 'Dosya adını belirleyin',
com_nav_export_type: 'Tür',
Expand Down
2 changes: 0 additions & 2 deletions client/src/localization/languages/Vi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,6 @@ export default {
com_nav_plugin_store: 'Cửa hàng Plugin',
com_nav_plugin_search: 'Tìm kiếm plugin',
com_nav_plugin_auth_error: 'Đã xảy ra lỗi khi xác thực plugin này. Vui lòng thử lại.',
com_nav_close_menu: 'Đóng thanh bên',
com_nav_open_menu: 'Mở thanh bên',
com_nav_export_filename: 'Tên tệp',
com_nav_export_filename_placeholder: 'Đặt tên cho tệp',
com_nav_export_type: 'Loại',
Expand Down
2 changes: 0 additions & 2 deletions client/src/localization/languages/Zh.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,6 @@ export default {
com_nav_plugin_store: '插件商店',
com_nav_plugin_search: '搜索插件',
com_nav_plugin_auth_error: '尝试验证此插件时出错。请重试。',
com_nav_close_menu: '关闭菜单',
com_nav_open_menu: '打开菜单',
com_nav_export_filename: '文件名',
com_nav_export_filename_placeholder: '设置文件名',
com_nav_export_type: '类型',
Expand Down
2 changes: 0 additions & 2 deletions client/src/localization/languages/ZhTraditional.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,6 @@ export default {
com_nav_plugin_store: '外掛商店',
com_nav_plugin_search: '搜尋外掛',
com_nav_plugin_auth_error: '嘗試驗證此外掛時發生錯誤。請重試。',
com_nav_close_menu: '關閉側邊選單',
com_nav_open_menu: '開啟側邊選單',
com_nav_export_filename: '檔名',
com_nav_export_filename_placeholder: '設定檔案名稱',
com_nav_export_type: '類型',
Expand Down

0 comments on commit 20b93ad

Please sign in to comment.