import React from 'react'; import { SessionIconButton, SessionIconSize, SessionIconType } from './icon'; import { Avatar } from '../Avatar'; export enum SectionType { Profile, Message, Contact, Globe, Settings, Moon, } interface State { avatarPath: string; } interface Props { onSectionSelected: any; selectedSection: SectionType; } const Section = ({ isSelected, onSelect, type, avatarPath, notificationCount, }: { isSelected: boolean; onSelect?: (event: SectionType) => void; type: SectionType; avatarPath?: string; avatarColor?: string; notificationCount?: number; }) => { const handleClick = onSelect ? () => { onSelect(type); } : undefined; if (type === SectionType.Profile) { if (!isSelected) { return ( ); } else { return ( ); } } let iconType: SessionIconType; switch (type) { case SectionType.Message: iconType = SessionIconType.ChatBubble; break; case SectionType.Contact: iconType = SessionIconType.Users; break; case SectionType.Globe: iconType = SessionIconType.Globe; break; case SectionType.Settings: iconType = SessionIconType.Gear; break; case SectionType.Moon: iconType = SessionIconType.Moon; break; default: iconType = SessionIconType.Moon; } if (!isSelected) { return ( ); } else { return ( ); } }; export class ActionsPanel extends React.Component { constructor(props: Props) { super(props); this.state = { avatarPath: '', }; } public componentDidMount() { // tslint:disable-next-line: no-backbone-get-set-outside-model const ourNumber = window.storage.get('primaryDevicePubKey'); window.ConversationController.getOrCreateAndWait(ourNumber, 'private').then( (conversation: any) => { this.setState({ avatarPath: conversation.getAvatarPath(), }); } ); } public render(): JSX.Element { const { selectedSection } = this.props; return (
); } private readonly handleSectionSelect = (section: SectionType): void => { this.props.onSectionSelected(section); }; }