diff --git a/frontend/src/components/SqueakProfileDetailItem/SqueakProfileDetailItem.js b/frontend/src/components/SqueakProfileDetailItem/SqueakProfileDetailItem.js new file mode 100644 index 00000000..0784d1c0 --- /dev/null +++ b/frontend/src/components/SqueakProfileDetailItem/SqueakProfileDetailItem.js @@ -0,0 +1,186 @@ +import React, { useState } from "react"; +import { + Paper, + IconButton, + Menu, + MenuItem, + Typography, + Grid, + Box, + Link, + Divider, + Button, +} from "@material-ui/core"; +import { MoreVert as MoreIcon } from "@material-ui/icons"; +import {useHistory} from "react-router-dom"; +import classnames from "classnames"; + +import Card from '@material-ui/core/Card'; +import CardActionArea from '@material-ui/core/CardActionArea'; +import CardActions from '@material-ui/core/CardActions'; +import CardContent from '@material-ui/core/CardContent'; +import CardMedia from '@material-ui/core/CardMedia'; + +import CardHeader from '@material-ui/core/CardHeader'; +import Avatar from '@material-ui/core/Avatar'; + +import MoreVertIcon from '@material-ui/icons/MoreVert'; +import VpnKeyIcon from '@material-ui/icons/VpnKey'; + +// styles +import useStyles from "./styles"; + +import Widget from "../../components/Widget"; + + + +import { + syncSqueakRequest, +} from "../../squeakclient/requests" + +import { + getBlockDetailUrl, +} from "../../bitcoin/blockexplorer" +import { + getProfileImageSrcString, +} from "../../squeakimages/images" + +import moment from 'moment'; + +export default function SqueakProfileDetailItem({ + squeakProfile, + handleViewSqueaksClick, + handleConfigureClick, + handleRenameClick, + handleChangeImageClick, + handleExportClick, + handleDeleteClick, + ...props +}) { + var classes = useStyles(); + const [anchorEl, setAnchorEl] = React.useState(null); + + const handleClick = (event) => { + setAnchorEl(event.currentTarget); + }; + + const handleClose = () => { + setAnchorEl(null); + }; + + const history = useHistory(); + + const goToSqueakAddressPage = () => { + history.push("/app/squeakaddress/" + squeakProfile.getAddress()); + }; + + const onViewSqueaksClick = () => { + console.log("Handling view squeaks click..."); + handleClose(); + if (!squeakProfile) { + return; + } + goToSqueakAddressPage(); + } + + const onConfigureClick = () => { + console.log("Handling configure click..."); + handleClose(); + if (!squeakProfile) { + return; + } + handleConfigureClick(); + } + + const onRenameClick = () => { + console.log("Handling rename click..."); + handleClose(); + if (!squeakProfile) { + return; + } + handleRenameClick(); + } + + const onChangeImageClick = () => { + console.log("Handling change image click..."); + handleClose(); + if (!squeakProfile) { + return; + } + handleChangeImageClick(); + } + + const onExportClick = () => { + console.log("Handling export click..."); + handleClose(); + if (!squeakProfile) { + return; + } + handleExportClick(); + } + + const onDeleteClick = () => { + console.log("Handling delete click..."); + handleClose(); + if (!squeakProfile) { + return; + } + handleDeleteClick(); + } + + + const profileImageBase64String = squeakProfile.getProfileImage(); + return ( + + + + + + + + Configure + Rename + Change Image + {squeakProfile.getHasPrivateKey() && + Export + } + Delete + + + } + title={squeakProfile.getProfileName()} +/> + + + + + {squeakProfile.getHasPrivateKey() && } + + + {squeakProfile.getAddress()} + + + + + + + ); +} diff --git a/frontend/src/components/SqueakProfileDetailItem/package.json b/frontend/src/components/SqueakProfileDetailItem/package.json new file mode 100644 index 00000000..fc443b08 --- /dev/null +++ b/frontend/src/components/SqueakProfileDetailItem/package.json @@ -0,0 +1,6 @@ +{ + "name": "SqueakProfileDetailItem", + "version": "0.0.0", + "private": true, + "main": "SqueakProfileDetailItem.js" +} diff --git a/frontend/src/components/SqueakProfileDetailItem/styles.js b/frontend/src/components/SqueakProfileDetailItem/styles.js new file mode 100644 index 00000000..600e929b --- /dev/null +++ b/frontend/src/components/SqueakProfileDetailItem/styles.js @@ -0,0 +1,49 @@ +import { makeStyles } from "@material-ui/styles"; + +export default makeStyles(theme => ({ + widgetWrapper: { + display: "flex", + minHeight: "100%", + }, + widgetHeader: { + padding: theme.spacing(3), + paddingBottom: theme.spacing(1), + display: "flex", + justifyContent: "space-between", + alignItems: "center", + }, + widgetRoot: { + boxShadow: theme.customShadows.widget, + }, + widgetBody: { + paddingBottom: theme.spacing(3), + paddingRight: theme.spacing(3), + paddingLeft: theme.spacing(3), + }, + noPadding: { + padding: 0, + }, + paper: { + padding: '6px 12px', + }, + secondaryTail: { + backgroundColor: theme.palette.secondary.main, + }, + moreButton: { + margin: -theme.spacing(1), + padding: 0, + width: 40, + height: 40, + color: theme.palette.text.hint, + "&:hover": { + backgroundColor: theme.palette.primary.main, + color: "rgba(255, 255, 255, 0.35)", + }, + }, + root: { + maxWidth: 345, + }, + media: { + height: 180, + }, +})); diff --git a/frontend/src/pages/profile/Profile.js b/frontend/src/pages/profile/Profile.js index ad8cf5d9..9c447f2c 100644 --- a/frontend/src/pages/profile/Profile.js +++ b/frontend/src/pages/profile/Profile.js @@ -38,6 +38,7 @@ import Widget from "../../components/Widget"; import DeleteProfileDialog from "../../components/DeleteProfileDialog"; import ExportPrivateKeyDialog from "../../components/ExportPrivateKeyDialog"; import ConfigureProfileDialog from "../../components/ConfigureProfileDialog"; +import SqueakProfileDetailItem from "../../components/SqueakProfileDetailItem"; import { getSqueakProfileRequest, @@ -111,6 +112,10 @@ export default function ProfilePage() { getSqueakProfile(id); }; + const handleViewSqueaks = () => { + goToSqueakAddressPage(squeakProfile.getAddress()); + }; + function ProfileContent() { return ( <> @@ -122,57 +127,15 @@ export default function ProfilePage() { function SqueakProfileImageDisplay() { const profileImageBase64String = squeakProfile.getProfileImage(); return ( - - - - - - - - Configure - Rename - Change Image - {squeakProfile.getHasPrivateKey() && - Export - } - Delete - - - } - title={squeakProfile.getProfileName()} -/> - - - - - {squeakProfile.getHasPrivateKey() && } - - - {squeakProfile.getAddress()} - - - - - - + ); } diff --git a/frontend/src/pages/profile/styles.js b/frontend/src/pages/profile/styles.js index 9eea8e34..976accde 100644 --- a/frontend/src/pages/profile/styles.js +++ b/frontend/src/pages/profile/styles.js @@ -12,10 +12,4 @@ export default makeStyles(theme => ({ text: { marginBottom: theme.spacing(2), }, - root: { - maxWidth: 345, - }, - media: { - height: 180, - }, }));