index.tsx 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. import Divider from '@mui/material/Divider';
  2. import Paper from '@mui/material/Paper';
  3. import MenuList from '@mui/material/MenuList';
  4. import MenuItem from '@mui/material/MenuItem';
  5. import ListItemText from '@mui/material/ListItemText';
  6. import ListItemIcon from '@mui/material/ListItemIcon';
  7. import BookmarkBorderIcon from '@mui/icons-material/BookmarkBorder';
  8. import ArchiveIcon from '@mui/icons-material/Archive';
  9. import PermContactCalendarIcon from '@mui/icons-material/PermContactCalendar';
  10. import SettingsIcon from '@mui/icons-material/Settings';
  11. import Brightness3Icon from '@mui/icons-material/Brightness3';
  12. import AnimationIcon from '@mui/icons-material/Animation';
  13. import HelpOutlineIcon from '@mui/icons-material/HelpOutline';
  14. import BugReportIcon from '@mui/icons-material/BugReport';
  15. import Switch from '@mui/material/Switch';
  16. import { makeStyles } from '@material-ui/core'
  17. import Modal from '../../../reusableComponents/Modal'
  18. import { ChangeEvent } from 'react';
  19. const useStyles = makeStyles({
  20. container: {
  21. position: 'absolute',
  22. width: 270,
  23. maxWidth: '100%',
  24. top: 60,
  25. left: 15,
  26. zIndex: 10,
  27. visibility: 'visible',
  28. },
  29. list: {
  30. background:'#fdfdfd'
  31. },
  32. listItemLast: {
  33. textAlign: 'center',
  34. },
  35. listIcon: {
  36. marginRight: 15,
  37. },
  38. listIconText: {
  39. marginRight: 15,
  40. paddingLeft:6
  41. }
  42. })
  43. const label = { inputProps: { 'aria-label': 'Switch demo' } };
  44. interface IContactsList {
  45. handleSelectedMenu: (i:number) => void
  46. }
  47. const MenuBar = ({handleSelectedMenu}:IContactsList) => {
  48. const classes = useStyles()
  49. const handleSwitch = (e: React.MouseEvent<HTMLElement>) => {
  50. e.stopPropagation()
  51. console.log('clicked switch input')
  52. }
  53. return (
  54. <Modal>
  55. <Paper className={classes.container}>
  56. <MenuList className={classes.list}>
  57. <MenuItem onClick={() => handleSelectedMenu(0)}>
  58. <ListItemIcon className={classes.listIcon}>
  59. <BookmarkBorderIcon fontSize="medium" />
  60. </ListItemIcon>
  61. <ListItemText>Saved Messages</ListItemText>
  62. </MenuItem>
  63. <MenuItem onClick={() => handleSelectedMenu(1)}>
  64. <ListItemIcon className={classes.listIcon}>
  65. <ArchiveIcon fontSize="medium" />
  66. </ListItemIcon>
  67. <ListItemText>Archived Chats</ListItemText>
  68. </MenuItem>
  69. <MenuItem onClick={() => handleSelectedMenu(2)}>
  70. <ListItemIcon className={classes.listIcon}>
  71. <PermContactCalendarIcon fontSize="medium" />
  72. </ListItemIcon>
  73. <ListItemText>Contacts</ListItemText>
  74. </MenuItem>
  75. <MenuItem onClick={() => handleSelectedMenu(3)}>
  76. <ListItemIcon className={classes.listIcon}>
  77. <SettingsIcon fontSize="medium" />
  78. </ListItemIcon>
  79. <ListItemText>Settings</ListItemText>
  80. </MenuItem>
  81. <MenuItem onClick={() => handleSelectedMenu(4)}>
  82. <ListItemIcon className={classes.listIcon}>
  83. <Brightness3Icon fontSize="medium" />
  84. </ListItemIcon>
  85. <ListItemText>Night Mode</ListItemText>
  86. <Switch onClick={handleSwitch} {...label} />
  87. </MenuItem>
  88. <MenuItem onClick={() => handleSelectedMenu(5)}>
  89. <ListItemIcon className={classes.listIcon}>
  90. <AnimationIcon fontSize="medium" />
  91. </ListItemIcon>
  92. <ListItemText>Animations</ListItemText>
  93. <Switch onClick={handleSwitch} {...label} defaultChecked />
  94. </MenuItem>
  95. <MenuItem onClick={() => handleSelectedMenu(6)}>
  96. <ListItemIcon className={classes.listIcon}>
  97. <HelpOutlineIcon fontSize="medium" />
  98. </ListItemIcon>
  99. <ListItemText>Telegram Features</ListItemText>
  100. </MenuItem>
  101. <MenuItem onClick={() => handleSelectedMenu(7)}>
  102. <ListItemIcon className={classes.listIcon}>
  103. <BugReportIcon fontSize="medium" />
  104. </ListItemIcon>
  105. <ListItemText>Report bug</ListItemText>
  106. </MenuItem>
  107. <MenuItem onClick={() => handleSelectedMenu(8)}>
  108. <ListItemIcon className={classes.listIconText}>
  109. K
  110. </ListItemIcon>
  111. <ListItemText>Switch to K Version</ListItemText>
  112. </MenuItem>
  113. <MenuItem onClick={() => handleSelectedMenu(9)}>
  114. <ListItemIcon className={classes.listIconText}>
  115. W
  116. </ListItemIcon>
  117. <ListItemText>Switch to Old Version</ListItemText>
  118. </MenuItem >
  119. <Divider />
  120. <MenuItem onClick={() => handleSelectedMenu(10)}>
  121. <ListItemText secondary='Telegram WebZ 1.32.3' className={classes.listItemLast}/>
  122. </MenuItem>
  123. </MenuList>
  124. </Paper>
  125. </Modal>
  126. );
  127. }
  128. export default MenuBar