Skip to content

Commit

Permalink
Create CommunityDialog component
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandoporazzi committed May 6, 2022
1 parent 90939c4 commit 423c816
Show file tree
Hide file tree
Showing 3 changed files with 160 additions and 62 deletions.
70 changes: 8 additions & 62 deletions frontend/src/components/BottomBar.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React, { Component } from 'react'
import { withTranslation, Trans} from "react-i18next";
import { withTranslation } from "react-i18next";
import {FormControlLabel, Link, Switch, CircularProgress, Badge, Tooltip, TextField, ListItemAvatar, Button, Avatar,Paper, Grid, IconButton, Typography, Select, MenuItem, List, ListItemText, ListItem, ListItemIcon, ListItemButton, Divider, Dialog, DialogContent} from "@mui/material";
import MediaQuery from 'react-responsive'
import { Link as LinkRouter } from 'react-router-dom'
import Flags from 'country-flag-icons/react/3x2'

// Icons
import SettingsIcon from '@mui/icons-material/Settings';
Expand All @@ -16,7 +15,7 @@ import PriceChangeIcon from '@mui/icons-material/PriceChange';
import BoltIcon from '@mui/icons-material/Bolt';
import GitHubIcon from '@mui/icons-material/GitHub';
import EqualizerIcon from '@mui/icons-material/Equalizer';
import SendIcon from '@mui/icons-material/Send';

import PublicIcon from '@mui/icons-material/Public';
import NumbersIcon from '@mui/icons-material/Numbers';
import PasswordIcon from '@mui/icons-material/Password';
Expand All @@ -29,6 +28,8 @@ import EmojiEventsIcon from '@mui/icons-material/EmojiEvents';
import AmbossIcon from "./icons/AmbossIcon";
import FavoriteIcon from '@mui/icons-material/Favorite';

import CommunityDialog from './CommunityDialog';

import { getCookie } from "../utils/cookies";
import { pn } from "../utils/prettyNumbers";

Expand Down Expand Up @@ -65,7 +66,6 @@ class BottomBar extends Component {
}

componentDidMount() {
console.log("mount fernando");
this.getInfo();
}

Expand Down Expand Up @@ -181,62 +181,6 @@ class BottomBar extends Component {
this.setState({openCommuniy: false});
};

CommunityDialog =() =>{
const { t } = this.props;

return(
<Dialog
open={this.state.openCommuniy}
onClose={this.handleClickCloseCommunity}
aria-labelledby="community-dialog-title"
aria-describedby="community-description"
>
<DialogContent>
<Typography component="h5" variant="h5">{t("Community")}</Typography>
<Typography component="body2" variant="body2">
<p>{t("Support is only offered via public channels. Join our Telegram community if you have questions or want to hang out with other cool robots. Please, use our Github Issues if you find a bug or want to see new features!")}</p>
</Typography>
<List>
<Divider/>

<ListItemButton component="a" target="_blank" href="https://t.me/robosats">
<ListItemIcon><SendIcon/></ListItemIcon>
<ListItemText primary={t("Join the RoboSats group")}
secondary={t("Telegram (English / Main)")}/>
</ListItemButton>
<Divider/>

<ListItem>
<ListItemIcon><SendIcon/></ListItemIcon>
<ListItemText secondary={t("RoboSats Telegram Communities")}>
<Tooltip title={t("Join RoboSats Spanish speaking community!")}>
<IconButton component="a" target="_blank" href="https://t.me/robosats_es"><Flags.ES width={30} height={30} style={{filter: 'drop-shadow(2px 2px 2px #444444)'}}/></IconButton>
</Tooltip>
<Tooltip title={t("Join RoboSats Russian speaking community!")}>
<IconButton component="a" target="_blank" href="https://t.me/robosats_ru"><Flags.RU width={30} height={30} style={{filter: 'drop-shadow(2px 2px 2px #444444)'}}/></IconButton>
</Tooltip>
<Tooltip title={t("Join RoboSats Chinese speaking community!")}>
<IconButton component="a" target="_blank" href="https://t.me/robosats_cn"><Flags.CN width={30} height={30} style={{filter: 'drop-shadow(2px 2px 2px #444444)'}}/></IconButton>
</Tooltip>
<Tooltip title={t("Join RoboSats English speaking community!")}>
<IconButton component="a" target="_blank" href="https://t.me/robosats"><Flags.US width={30} height={30} style={{filter: 'drop-shadow(2px 2px 2px #444444)'}}/></IconButton>
</Tooltip>
</ListItemText>
</ListItem>
<Divider/>

<ListItemButton component="a" target="_blank" href="https://github.com/Reckless-Satoshi/robosats/issues">
<ListItemIcon><GitHubIcon/></ListItemIcon>
<ListItemText primary={t("Tell us about a new feature or a bug")}
secondary={t("Github Issues - The Robotic Satoshis Open Source Project")}/>
</ListItemButton>

</List>
</DialogContent>
</Dialog>
)
}

handleClickOpenProfile = () => {
this.getInfo();
this.setState({openProfile: true, profileShown: true});
Expand Down Expand Up @@ -448,7 +392,6 @@ bottomBarDesktop =()=>{
return(
<Paper elevation={6} style={{height:40}}>
{this.StatsDialog()}
{this.CommunityDialog()}
{this.dialogProfile()}
{this.exchangeSummaryDialog()}
<Grid container xs={12}>
Expand Down Expand Up @@ -709,7 +652,6 @@ bottomBarPhone =()=>{
return(
<Paper elevation={6} style={{height:40}}>
{this.StatsDialog()}
{this.CommunityDialog()}
{this.exchangeSummaryDialog()}
{this.dialogProfile()}
<Grid container xs={12}>
Expand Down Expand Up @@ -806,6 +748,10 @@ bottomBarPhone =()=>{
render() {
return (
<div>
<CommunityDialog
isOpen={this.state.openCommuniy}
handleClickCloseCommunity={this.handleClickCloseCommunity}
/>
<MediaQuery minWidth={1200}>
{this.bottomBarDesktop()}
</MediaQuery>
Expand Down
151 changes: 151 additions & 0 deletions frontend/src/components/CommunityDialog/CommunityDialog.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
import React from "react";
import { useTranslation } from "react-i18next";
import {
Dialog,
DialogContent,
Divider,
IconButton,
List,
ListItemText,
ListItem,
ListItemIcon,
ListItemButton,
Tooltip,
Typography,
} from "@mui/material";
import SendIcon from '@mui/icons-material/Send';
import GitHubIcon from '@mui/icons-material/GitHub';
import Flags from 'country-flag-icons/react/3x2'

type Props = {
isOpen: boolean;
handleClickCloseCommunity: () => void;
}

const CommunityDialog = ({
isOpen,
handleClickCloseCommunity,
}: Props): JSX.Element => {
const { t } = useTranslation();

const flagProps = {
width: 30,
height: 30,
style: {
filter: "drop-shadow(2px 2px 2px #444444)",
},
};

return (
<Dialog
open={isOpen}
onClose={handleClickCloseCommunity}
aria-labelledby="community-dialog-title"
aria-describedby="community-description"
>
<DialogContent>
<Typography component="h5" variant="h5">
{t("Community")}
</Typography>

<Typography component="div" variant="body2">
<p>{t("Support is only offered via public channels. Join our Telegram community if you have questions or want to hang out with other cool robots. Please, use our Github Issues if you find a bug or want to see new features!")}</p>
</Typography>

<List>
<Divider/>

<ListItemButton
component="a"
target="_blank"
href="https://t.me/robosats"
rel="noreferrer"
>
<ListItemIcon>
<SendIcon/>
</ListItemIcon>

<ListItemText
primary={t("Join the RoboSats group")}
secondary={t("Telegram (English / Main)")}
/>
</ListItemButton>

<Divider/>

<ListItem>
<ListItemIcon>
<SendIcon/>
</ListItemIcon>

<ListItemText secondary={t("RoboSats Telegram Communities")}>
<Tooltip title={t("Join RoboSats Spanish speaking community!") || ""}>
<IconButton
component="a"
target="_blank"
href="https://t.me/robosats_es"
rel="noreferrer"
>
<Flags.ES {...flagProps} />
</IconButton>
</Tooltip>

<Tooltip title={t("Join RoboSats Russian speaking community!") || ""}>
<IconButton
component="a"
target="_blank"
href="https://t.me/robosats_ru"
rel="noreferrer"
>
<Flags.RU {...flagProps} />
</IconButton>
</Tooltip>

<Tooltip title={t("Join RoboSats Chinese speaking community!") || ""}>
<IconButton
component="a"
target="_blank"
href="https://t.me/robosats_cn"
rel="noreferrer"
>
<Flags.CN {...flagProps} />
</IconButton>
</Tooltip>

<Tooltip title={t("Join RoboSats English speaking community!") || ""}>
<IconButton
component="a"
target="_blank"
href="https://t.me/robosats"
rel="noreferrer"
>
<Flags.US {...flagProps} />
</IconButton>
</Tooltip>
</ListItemText>
</ListItem>

<Divider/>

<ListItemButton
component="a"
target="_blank"
href="https://github.com/Reckless-Satoshi/robosats/issues"
rel="noreferrer"
>
<ListItemIcon>
<GitHubIcon/>
</ListItemIcon>

<ListItemText
primary={t("Tell us about a new feature or a bug")}
secondary={t("Github Issues - The Robotic Satoshis Open Source Project")}
/>
</ListItemButton>
</List>
</DialogContent>
</Dialog>
);
};

export default CommunityDialog;
1 change: 1 addition & 0 deletions frontend/src/components/CommunityDialog/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "./CommunityDialog";

0 comments on commit 423c816

Please sign in to comment.