From feb6a83bce53de29a1c7359e72df7eb3d93a2b76 Mon Sep 17 00:00:00 2001
From: Jonathan Zernik
Date: Thu, 5 Nov 2020 16:34:13 -0500
Subject: [PATCH] Add button to go to squeaks from profile page (#388)
---
frontend/src/pages/profile/Profile.js | 25 ++++++++++++++++++-
frontend/src/pages/profiles/Profiles.js | 21 +++++++++++++---
.../src/pages/squeakaddress/SqueakAddress.js | 4 +--
3 files changed, 44 insertions(+), 6 deletions(-)
diff --git a/frontend/src/pages/profile/Profile.js b/frontend/src/pages/profile/Profile.js
index 8c71acc0..61c4cfcc 100644
--- a/frontend/src/pages/profile/Profile.js
+++ b/frontend/src/pages/profile/Profile.js
@@ -1,4 +1,5 @@
import React, { useState, useEffect } from 'react';
+import {useHistory} from "react-router-dom";
import { useParams } from 'react-router-dom';
import {
Grid,
@@ -31,7 +32,7 @@ export default function ProfilePage() {
const { id } = useParams();
const [squeakProfile, setSqueakProfile] = useState(null);
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
-
+ const history = useHistory();
const getSqueakProfile = (id) => {
getSqueakProfileRequest(id, setSqueakProfile);
@@ -47,6 +48,10 @@ export default function ProfilePage() {
})
};
+ const goToSqueakAddressPage = (squeakAddress) => {
+ history.push("/app/squeakaddress/" + squeakAddress);
+ };
+
useEffect(()=>{
getSqueakProfile(id)
@@ -87,6 +92,7 @@ export default function ProfilePage() {
Profile name: {squeakProfile.getProfileName()}
{ProfileSettingsForm()}
+ {ViewSqueaksButton()}
{DeleteProfileButton()}
>
)
@@ -127,6 +133,23 @@ export default function ProfilePage() {
)
}
+ function ViewSqueaksButton() {
+ return (
+ <>
+
+
+
+
+
+ >
+ )
+ }
+
function DeleteProfileDialogContent() {
return (
<>
diff --git a/frontend/src/pages/profiles/Profiles.js b/frontend/src/pages/profiles/Profiles.js
index db3d9e33..a66206ea 100644
--- a/frontend/src/pages/profiles/Profiles.js
+++ b/frontend/src/pages/profiles/Profiles.js
@@ -70,6 +70,10 @@ export default function Profiles() {
history.push("/app/squeakaddress/" + squeakAddress);
};
+ const goToProfilePage = (profileId) => {
+ history.push("/app/profile/" + profileId);
+ };
+
const handleClickOpenCreateSigningProfileDialog = () => {
setCreateSigningProfileDialogOpen(true);
};
@@ -174,21 +178,32 @@ export default function Profiles() {
title="Signing Profiles"
data={signingProfiles.map(p =>
[
+ p.getProfileId(),
p.getProfileName(),
p.getAddress(),
p.getFollowing().toString(),
p.getSharing().toString(),
]
)}
- columns={["Name", "Address", "Following", "Sharing"]}
+ columns={[
+ {
+ name: "Id",
+ options: {
+ display: false,
+ }
+ },
+ "Name", "Address", "Following", "Sharing"
+ ]}
options={{
filter: false,
print: false,
viewColumns: false,
selectableRows: "none",
onRowClick: rowData => {
- var address = rowData[1];
- goToSqueakAddressPage(address);
+ var id = rowData[0];
+ var address = rowData[2];
+ //goToSqueakAddressPage(address);
+ goToProfilePage(id);
}
}}/>
diff --git a/frontend/src/pages/squeakaddress/SqueakAddress.js b/frontend/src/pages/squeakaddress/SqueakAddress.js
index 05a93612..2795c01e 100644
--- a/frontend/src/pages/squeakaddress/SqueakAddress.js
+++ b/frontend/src/pages/squeakaddress/SqueakAddress.js
@@ -37,7 +37,7 @@ export default function SqueakAddressPage() {
getAddressSqueakDisplaysRequest(address, setSqueaks);
};
- const goToCreateProfilePage = (profileId) => {
+ const goToProfilePage = (profileId) => {
history.push("/app/profile/" + profileId);
};
@@ -72,7 +72,7 @@ export default function SqueakAddressPage() {
Profile:
)