mirror of https://github.com/msgbyte/tailchat
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
4 years ago
|
import { FullModal } from '@/components/FullModal';
|
||
|
import { SidebarView, SidebarViewMenuType } from '@/components/SidebarView';
|
||
|
import React, { useCallback, useMemo } from 'react';
|
||
|
import { t } from 'tailchat-shared';
|
||
|
import { SettingsAbout } from './About';
|
||
|
|
||
|
interface SettingsViewProps {
|
||
|
onClose: () => void;
|
||
|
}
|
||
|
export const SettingsView: React.FC<SettingsViewProps> = React.memo((props) => {
|
||
|
const handleChangeVisible = useCallback(
|
||
|
(visible) => {
|
||
|
if (visible === false && typeof props.onClose === 'function') {
|
||
|
props.onClose();
|
||
|
}
|
||
|
},
|
||
|
[props.onClose]
|
||
|
);
|
||
|
|
||
|
const menu: SidebarViewMenuType[] = useMemo(
|
||
|
() => [
|
||
|
{
|
||
|
type: 'group',
|
||
|
title: t('通用'),
|
||
|
children: [
|
||
|
{
|
||
|
type: 'item',
|
||
|
title: t('关于'),
|
||
|
content: <SettingsAbout />,
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
],
|
||
|
[]
|
||
|
);
|
||
|
|
||
|
return (
|
||
|
<FullModal onChangeVisible={handleChangeVisible}>
|
||
|
<SidebarView menu={menu} defaultContentPath="0.children.0.content" />
|
||
|
</FullModal>
|
||
|
);
|
||
|
});
|
||
|
SettingsView.displayName = 'SettingsView';
|