About.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import { Component } from "inferno";
  2. import ListView from "./ListView";
  3. import IconListItem from "./ui/IconListItem";
  4. import TextListItem from "./ui/TextListItem";
  5. import Separator from "./ui/Separator";
  6. import { startDM } from "./utils";
  7. import farooqlogo from "./farooqlogo.png";
  8. import adrianavatar from "./adrianavatar.png";
  9. const FarID = "@farooqkz:synod.im";
  10. class About extends Component {
  11. handleKeyDown = (evt) => {
  12. if (evt.key === "Call" || evt.key === "c") {
  13. const room = window.mClient
  14. .getVisibleRooms()
  15. .filter((room) => room.guessDMUserId() === FarID);
  16. if (room.length === 0) {
  17. console.log("Starting DM with Farooq...");
  18. startDM(window.mClient, FarID);
  19. } else {
  20. this.openRoom(room[0].roomId);
  21. }
  22. }
  23. };
  24. constructor(props) {
  25. super(props);
  26. this.softKeyRef = props.softKeyRef;
  27. this.openRoom = props.openRoom;
  28. }
  29. componentWillUnmount() {
  30. document.removeEventListener("keydown", this.handleKeyDown);
  31. }
  32. componentDidMount() {
  33. this.softKeyRef.current.setState({
  34. centerText: "Repo.",
  35. leftText: "Quit",
  36. rightText: "Donate",
  37. });
  38. this.softKeyRef.current.centerCb = () => {
  39. window.open("https://notabug.org/bananaphone/marooq", "_self");
  40. };
  41. this.softKeyRef.current.leftCb = () => {
  42. window.close();
  43. };
  44. this.softKeyRef.current.rightCb = () => {
  45. window.open("https://far.chickenkiller.com/pages/donate", "_self");
  46. };
  47. document.addEventListener("keydown", this.handleKeyDown);
  48. }
  49. render() {
  50. return (
  51. <ListView cursor={0} $HasNonKeyedChildren>
  52. <IconListItem
  53. primary="Code"
  54. secondary="Farooq Karimi Zadeh"
  55. iconSrc={farooqlogo}
  56. />
  57. <Separator text="Press call to contact via Matrix" />
  58. <IconListItem
  59. primary="KaiUI"
  60. secondary="Adrian Machado"
  61. iconSrc={adrianavatar}
  62. />
  63. <TextListItem primary="Matrix JS SDK" secondary="Matrix Foundation?" />
  64. </ListView>
  65. );
  66. }
  67. }
  68. export default About;