import { useMemo } from 'react'
import { List, ListItem, Divider, Box } from '@mui/material'
import P3xrAccordion from '../../components/P3xrAccordion'
import { useI18nStore } from '../../stores/i18n.store'
import { useRedisStateStore } from '../../stores/redis-state.store'
import { isShortcutsEnabled, getShortcutsWithDescriptions } from '../../stores/shortcuts'
const pairRowSx = { display: 'flex', width: '100%', gap: 2, alignItems: 'center' }
const labelSx = { flex: '1 1 auto', minWidth: 0, fontWeight: 700 }
const valueSx = { flex: '0 1 60%', minWidth: 0, textAlign: 'right' }
const Row = ({ label, value }: { label: React.ReactNode, value: React.ReactNode }) => (
<>
{label}
{value}
>
)
export default function InfoPage() {
const strings = useI18nStore(s => s.strings)
const version = useRedisStateStore(s => s.version)
const connection = useRedisStateStore(s => s.connection)
const info = useRedisStateStore(s => s.info)
const modules = useRedisStateStore(s => s.modules)
const isElectron = isShortcutsEnabled()
const shortcutsList = useMemo(() => getShortcutsWithDescriptions(), [strings])
const isConnected = !!connection
const redisVersion = info?.server?.redis_version || '-'
const moduleNames = (modules || []).map((m: any) => m.name)
const languageList = useMemo(() => {
const langObj = strings?.language || {}
return Object.keys(langObj).sort().map(code => ({ code, name: langObj[code] }))
}, [strings])
return (
{/* Keyboard Shortcuts (Electron only) */}
{isElectron && (
<>
{shortcutsList.map(s => (
{s.key}
{s.description}
))}
>
)}
{/* About */}
{isConnected &&
}
{isConnected && moduleNames.length > 0 && (
)}
patrikx3/redis-ui} />
PayPal} />
change-log.md} />
{/* Supported Languages */}
{languageList.map(lang => (
{lang.code}
{lang.name}
))}
)
}