/** * Status bar: cursor position, language, encoding, indent style, git branch. */ import React from 'react'; import { useAppTranslation } from '@features/localization/renderer'; import { Tooltip, TooltipContent, TooltipTrigger } from '@renderer/components/ui/tooltip'; import { useStore } from '@renderer/store'; import { GitBranch } from 'lucide-react'; import { useShallow } from 'zustand/react/shallow'; interface EditorStatusBarProps { line: number; col: number; language: string; } export const EditorStatusBar = React.memo(function EditorStatusBar({ line, col, language, }: EditorStatusBarProps): React.ReactElement { const { t } = useAppTranslation('team'); const { gitBranch, isGitRepo, watcherEnabled } = useStore( useShallow((s) => ({ gitBranch: s.editorGitBranch, isGitRepo: s.editorIsGitRepo, watcherEnabled: s.editorWatcherEnabled, })) ); const toggleWatcher = useStore((s) => s.toggleWatcher); return (
{t('editor.statusBar.position', { line, col })} {isGitRepo && gitBranch && ( {gitBranch} )}
{watcherEnabled ? t('editor.statusBar.disableExternalWatcher') : t('editor.statusBar.watchExternalChanges')} {language} {t('editor.statusBar.encodingUtf8')} {t('editor.statusBar.spaces', { count: 2 })}
); });