mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-19 13:18:26 +02:00
Show profile in address page (#116)
* Show profile id in address page * Go to profile page from address page * Update app name in public resources
This commit is contained in:
parent
50b07788ff
commit
54ca56dd0c
5 changed files with 48 additions and 12 deletions
BIN
frontend/react-material-admin/public/favicon.ico
Executable file → Normal file
BIN
frontend/react-material-admin/public/favicon.ico
Executable file → Normal file
Binary file not shown.
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 1.1 KiB |
|
|
@ -22,9 +22,9 @@
|
|||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>React Material Admin</title>
|
||||
<meta name="description" content="React Material Admin is a React Template built with Material-UI">
|
||||
<meta name="keywords" content="react material, material ui admin, react template, react material admin, react material dashboard">
|
||||
<title>Squeak Node</title>
|
||||
<meta name="description" content="Squeak Node is a frontend for accessing a squeak node">
|
||||
<meta name="keywords" content="squeak, bitcoin, lightning">
|
||||
<meta name="author" content="Flatlogic LLC.">
|
||||
</head>
|
||||
<body style="font-family: 'Roboto', sans-serif;">
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"short_name": "React Material Admin",
|
||||
"name": "React Material Admin is a React Template built with Material-UI",
|
||||
"short_name": "Squeak Node",
|
||||
"name": "Squeak Node is a frontend for accessing a squeak node",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
|
|
|
|||
|
|
@ -40,18 +40,25 @@ export default function ProfilePage() {
|
|||
},[]);
|
||||
|
||||
function NoProfileContent() {
|
||||
return <p>No profile loaded...</p>;
|
||||
return (
|
||||
<p>
|
||||
No profile loaded
|
||||
</p>
|
||||
)
|
||||
}
|
||||
|
||||
function ProfileContent() {
|
||||
return <p>{squeakProfile.getProfileName()}</p>;
|
||||
return (
|
||||
<p>
|
||||
Profile name: {squeakProfile.getProfileName()}
|
||||
</p>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageTitle title={'Squeak Profile: ' + (squeakProfile ? squeakProfile.getProfileName() : null)} />
|
||||
<div>
|
||||
Hello!
|
||||
{squeakProfile
|
||||
? ProfileContent()
|
||||
: NoProfileContent()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { Grid } from "@material-ui/core";
|
||||
import {useHistory} from "react-router-dom";
|
||||
import { Grid, Button } from "@material-ui/core";
|
||||
|
||||
// styles
|
||||
import useStyles from "./styles";
|
||||
|
|
@ -22,6 +23,7 @@ export default function SqueakAddressPage() {
|
|||
const { id } = useParams();
|
||||
const [squeaks, setSqueaks] = useState([]);
|
||||
const [squeakProfile, setSqueakProfile] = useState(null);
|
||||
const history = useHistory();
|
||||
|
||||
const getSqueaks = () => {
|
||||
console.log("called getSqueaks");
|
||||
|
|
@ -45,10 +47,15 @@ export default function SqueakAddressPage() {
|
|||
|
||||
client.getSqueakProfileByAddress(getSqueakProfileByAddressRequest, {}, (err, response) => {
|
||||
console.log(response);
|
||||
console.log(response.getSqueakProfile());
|
||||
console.log("Got squeak profile: " + response.getSqueakProfile());
|
||||
setSqueakProfile(response.getSqueakProfile());
|
||||
});
|
||||
};
|
||||
|
||||
const goToCreateProfilePage = (profileId) => {
|
||||
history.push("/app/profile/" + profileId);
|
||||
};
|
||||
|
||||
useEffect(()=>{
|
||||
getSqueaks()
|
||||
},[]);
|
||||
|
|
@ -56,12 +63,34 @@ export default function SqueakAddressPage() {
|
|||
getSqueakProfile()
|
||||
},[]);
|
||||
|
||||
function NoProfileContent() {
|
||||
return (
|
||||
<div>
|
||||
No profile loaded
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function ProfileContent() {
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
Profile:
|
||||
<Button variant="contained" onClick={() => {
|
||||
goToCreateProfilePage(squeakProfile.getProfileId());
|
||||
}}>{squeakProfile.getProfileName()}</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageTitle title={'Squeak Address: ' + id} />
|
||||
{squeakProfile
|
||||
? ProfileContent()
|
||||
: NoProfileContent()
|
||||
}
|
||||
<div>
|
||||
Hello!
|
||||
Number of squeaks for address: {squeaks.length}
|
||||
Number of squeaks for address: {squeaks.length}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue