From 52fa3dabe9d77a126ddc9f2f246b5d911345a022 Mon Sep 17 00:00:00 2001 From: Stephen DeLorme Date: Sat, 7 May 2022 12:00:55 -0400 Subject: [PATCH 1/3] Dashboard styling --- src/index.css | 2 +- src/routes/Home.js | 21 +++++++++++++++++---- tailwind.config.js | 3 ++- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/index.css b/src/index.css index 7b91d67..8e131fb 100644 --- a/src/index.css +++ b/src/index.css @@ -10,7 +10,7 @@ } .default-bg { - @apply fixed h-screen w-screen; + @apply fixed h-screen w-screen z-0; opacity: 0.10; filter: blur(8px); background-image: url('../public/pebbles.jpg'); diff --git a/src/routes/Home.js b/src/routes/Home.js index a1241bf..ba1cff7 100644 --- a/src/routes/Home.js +++ b/src/routes/Home.js @@ -1,17 +1,30 @@ import React from "react"; import { Link, Outlet } from "react-router-dom"; +import Button from '../components/Button'; +import {PlusIcon} from '@heroicons/react/solid'; const Home = () => { return (
-
+

Welcome, Jerry

-
-

Balance

-

1000 sats

+
+

Your Balance

+

1000 sats

+ +
+

Members

+ +

Your tribe has no members. Add one!

+ + + + +
+
diff --git a/tailwind.config.js b/tailwind.config.js index e6cffd2..4711f2f 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -7,7 +7,8 @@ module.exports = { colors: { 'fam-orange': '#ff9500', 'fam-orange-inactive': '#A68659', - 'fam-bg-dark': '#3B474B' + 'fam-bg-dark': '#3B474B', + 'fam-teal': '#56737D' }, backgroundImage: { 'mountains': "url('../public/mountains.jpg')", From 785232b9a38aa96b078aaf7910b1e2b2d4b72d17 Mon Sep 17 00:00:00 2001 From: Stephen DeLorme Date: Sat, 7 May 2022 13:31:20 -0400 Subject: [PATCH 2/3] User invites frontend --- frontend/src/App.js | 2 ++ frontend/src/components/InputText.js | 13 +++++++ frontend/src/index.css | 4 +++ frontend/src/routes/Home.js | 2 +- frontend/src/routes/Invite.js | 53 ++++++++++++++++++++++++++++ 5 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 frontend/src/components/InputText.js create mode 100644 frontend/src/routes/Invite.js diff --git a/frontend/src/App.js b/frontend/src/App.js index b695a28..85e5708 100644 --- a/frontend/src/App.js +++ b/frontend/src/App.js @@ -16,6 +16,7 @@ import React from 'react'; import {ContactsIcon, CrossIcon, GearIcon, MenuIcon} from '@bitcoin-design/bitcoin-icons-react/filled'; import {ChartSquareBarIcon} from '@heroicons/react/solid'; import NewFamily from './routes/NewFamily'; +import Invite from './routes/Invite'; const Child = {}; @@ -56,6 +57,7 @@ function App() { } /> + } /> } /> }> }> diff --git a/frontend/src/components/InputText.js b/frontend/src/components/InputText.js new file mode 100644 index 0000000..9616215 --- /dev/null +++ b/frontend/src/components/InputText.js @@ -0,0 +1,13 @@ +const InputText = ({placeholder, value, type, onChange}) => { + return ( + + ) +} + +export default InputText; \ No newline at end of file diff --git a/frontend/src/index.css b/frontend/src/index.css index 8e131fb..6e36750 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -19,4 +19,8 @@ h1, h2 { @apply font-display; +} + +.tile { + @apply rounded-lg bg-fam-bg-dark p-8 drop-shadow-lg my-4 border border-fam-teal border-solid space-y-4 flex flex-col; } \ No newline at end of file diff --git a/frontend/src/routes/Home.js b/frontend/src/routes/Home.js index ba1cff7..af8323b 100644 --- a/frontend/src/routes/Home.js +++ b/frontend/src/routes/Home.js @@ -20,7 +20,7 @@ const Home = () => {

Your tribe has no members. Add one!

- +
diff --git a/frontend/src/routes/Invite.js b/frontend/src/routes/Invite.js new file mode 100644 index 0000000..007d456 --- /dev/null +++ b/frontend/src/routes/Invite.js @@ -0,0 +1,53 @@ +import React from "react"; +import { Link } from "react-router-dom"; +import Button from '../components/Button'; +import {MailIcon, PlusIcon} from '@heroicons/react/solid'; +import InputText from '../components/InputText'; + +const Invite = () => { + const [invited, setInvited] = React.useState(false) + const [invitedEmail, setInvitedEmail] = React.useState('') + + return ( +
+
+
+ {!invited ? +
+

Invite Members

+ +

Your tribe has no members. Add one!

+ + {setInvitedEmail(e.target.value)} } + /> + + +
+ : +
+

Invite Members

+ +

+ {invitedEmail} has been invited! Would you like to add another member? +

+ + + + + +
+ } +
+
+ ); +}; + +export default Invite; From d40d52154e067ee728474740854658a5fff7f8ff Mon Sep 17 00:00:00 2001 From: Jordan Brookman Date: Sat, 7 May 2022 16:11:59 -0400 Subject: [PATCH 3/3] Finish adding functions in nodes.js --- backend/sensei/nodes.js | 95 ++++++++++++++++++++++++++--------------- 1 file changed, 60 insertions(+), 35 deletions(-) diff --git a/backend/sensei/nodes.js b/backend/sensei/nodes.js index 34a6633..52b95d1 100644 --- a/backend/sensei/nodes.js +++ b/backend/sensei/nodes.js @@ -2,17 +2,13 @@ const fetch = require('node-fetch'); const BASE_URL = process.env.BASE_URL; const getUnusedAddress = async () => { - const res = await fetch(`${BASE_URL}/v1/node/wallet/address`, { - method: 'GET' - }); + const res = await fetch(`${BASE_URL}/v1/node/wallet/address`); console.log(res); return await res.json(); } const getBalance = async () => { - const res = await fetch(`${BASE_URL}/v1/node/wallet/balance`, { - method: 'GET' - }); + const res = await fetch(`${BASE_URL}/v1/node/wallet/balance`); console.log(res); return await res.json(); } @@ -23,34 +19,15 @@ const getChannels = async ({ page, searchTerm, take }) => { method: 'GET' }); - return await channels; + return await channels.json(); } const getPayments = async ({ filter = {}, pagination }) => { const { page, take, } = pagination; - const res = await fetch( - `${BASE_URL}/v1/node/payments?page=${page}&take=${take}`, - ); + const res = await fetch(`${BASE_URL}/v1/node/payments?page=${page}&take=${take}`); - return { - pagination: res.pagination, - payments: res.payments.map((payment) => { - return { - id: payment.id, - paymentHash: payment.payment_hash, - preimage: payment.preimage, - secret: payment.secret, - status: payment.status, - origin: payment.origin, - amtMsat: payment.amt_msat, - createdAt: payment.created_at, - updatedAt: payment.updated_at, - label: payment.label, - invoice: payment.invoice, - }; - }), - }; + return await res.json(); } const getInfo = async () => { @@ -69,11 +46,59 @@ const getInfo = async () => { const getPeers = async () => { const { peers } = await fetch(`${BASE_URL}/v1/node/peers`); - return { - peers: peers.map((peer) => { - return { - nodePubkey: peer.node_pubkey, - }; - }), - }; + return await peers.json(); +} + +const stopNode = async () => { + const res = await fetch(`${BASE_URL}/v1/node/stop`); + return res.json(); +} + +const createInvoice = async (amountMillisats, description) => { + const res = await fetch(`${BASE_URL}/v1/node/invoices`, + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + credentials: 'include', + body: JSON.stringify({ + amt_msat: amountMillisats, + description, + }), + }); + return await res.json(); +} + +const payInvoice = async (invoice) => { + const res = await fetch(`${BASE_URL}/v1/node/invoices/pay`, + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + credentials: 'include', + body: JSON.stringify({ + invoice + }) + } + + ); + return await res.json(); +} + +const keysend = async (destPubkey, amtMsat) => { + const res = await fetch(`${BASE_URL}/v1/node/keysend`, + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + credentials: 'include', + body: JSON.stringify({ + dest_pubkey: destPubkey, + amt_msat: amtMsat + }) + } + ); } \ No newline at end of file