mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-16 13:01:04 +02:00
Add button to go to squeaks from profile page (#388)
This commit is contained in:
parent
f0290e0677
commit
feb6a83bce
3 changed files with 44 additions and 6 deletions
|
|
@ -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()}
|
||||
</p>
|
||||
{ProfileSettingsForm()}
|
||||
{ViewSqueaksButton()}
|
||||
{DeleteProfileButton()}
|
||||
</>
|
||||
)
|
||||
|
|
@ -127,6 +133,23 @@ export default function ProfilePage() {
|
|||
)
|
||||
}
|
||||
|
||||
function ViewSqueaksButton() {
|
||||
return (
|
||||
<>
|
||||
<Grid item xs={12}>
|
||||
<div className={classes.root}>
|
||||
<Button
|
||||
variant="contained"
|
||||
onClick={() => {
|
||||
goToSqueakAddressPage(squeakProfile.getAddress());
|
||||
}}>View Squeaks
|
||||
</Button>
|
||||
</div>
|
||||
</Grid>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
function DeleteProfileDialogContent() {
|
||||
return (
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}}/>
|
||||
</Grid>
|
||||
|
|
|
|||
|
|
@ -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() {
|
|||
<div className={classes.root}>
|
||||
Profile:
|
||||
<Button variant="contained" onClick={() => {
|
||||
goToCreateProfilePage(squeakProfile.getProfileId());
|
||||
goToProfilePage(squeakProfile.getProfileId());
|
||||
}}>{squeakProfile.getProfileName()}</Button>
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue