From f8ab1f82698e1936542fa0848edc1b2ef6a120c9 Mon Sep 17 00:00:00 2001 From: SuperCoolYun Date: Mon, 25 Mar 2024 20:25:49 -0400 Subject: [PATCH] added del installed gateways functionality --- desk/app/near-gateways.hoon | 10 +++++++--- ui/src/app.jsx | 24 +++++++++++++++++++++--- ui/src/components/HeardGateways.jsx | 10 ++++++++-- ui/src/components/PublishedGateways.jsx | 14 ++------------ ui/src/index.css | 6 +++++- 5 files changed, 43 insertions(+), 21 deletions(-) diff --git a/desk/app/near-gateways.hoon b/desk/app/near-gateways.hoon index 5d29ad6f..c4a4d16a 100644 --- a/desk/app/near-gateways.hoon +++ b/desk/app/near-gateways.hoon @@ -142,8 +142,12 @@ :: %delete ?~ (~(get by published) identifier.act) - ~& >>> 'couldnt find in published gateways' - that + ?~ (~(get by installed) identifier.act) + ~& >>> 'couldnt find in published or installed gateways' + that + ~& > 'Deleted gateway' + =. installed (~(del by installed) identifier.act) + that ~& > 'Deleted gateway' =. published (~(del by published) identifier.act) =. installed (~(del by installed) identifier.act) @@ -396,5 +400,5 @@ -:(rear gateway) :: ::http{s}://{host}/~/scry/{app}{path}.{mark} -++ url 'https://s3.lonhep-tamfeb.startram.io/bucket/lonhep-tamfeb/2024.3.11..21.56.12-glob-0v7.l3ulb.vme1j.g5lip.sbco7.v4hf0.glob' +++ url 'glob of %near UI' -- \ No newline at end of file diff --git a/ui/src/app.jsx b/ui/src/app.jsx index c6bceb82..f33fccb3 100644 --- a/ui/src/app.jsx +++ b/ui/src/app.jsx @@ -2,12 +2,17 @@ import React, { useEffect, useState } from 'react'; import Urbit from '@urbit/http-api'; import HeardGateways from './components/HeardGateways.jsx' import PublishedGateways from './components/PublishedGateways.jsx' +import DeleteGateway from './components/DeleteGateway.jsx' export function App() { + const [showDelete, setShowDelete] = useState(false) + const [delGateway, setDelGateway] = useState({}) const api = new Urbit('', '', 'near-handler'); api.ship = window.ship; + + const [heard, setHeard] = useState([]) const [published, setPublished] = useState([]) const [installed, setInstalled] = useState([]) @@ -38,19 +43,32 @@ export function App() { } }, [loading]) +async function deleteGateway(gateway) { + api.poke({ + app: "near-gateways", + mark: "near-action", + json: {"delete": {"ship": gateway.ship, "id": gateway.id}}, + onSuccess: () => {setDelGateway({}), window.location.reload(), setShowDelete(false)}, + onError: () => setError('Failed to delete gateway') + }) +} + return (
{loading ?
loading
: -
+
+ {showDelete ? +
+ :
}

Published

-
+

Heard

-
+
}
diff --git a/ui/src/components/HeardGateways.jsx b/ui/src/components/HeardGateways.jsx index 801f6689..b42f9dc8 100644 --- a/ui/src/components/HeardGateways.jsx +++ b/ui/src/components/HeardGateways.jsx @@ -1,13 +1,17 @@ import React, { useState, useEffect } from 'react' function HeardGateways(props) { + const [installedGateways, setInstalledGateways] = useState([]) + const [newGateways, setNewGateways] = useState([]) + const api= props.api const heard = props.heard const installed = props.installed const loading = props.loading + const setShowDelete = props.setShowDelete + const setDelGateway = props.setDelGateway + - const [installedGateways, setInstalledGateways] = useState([]) - const [newGateways, setNewGateways] = useState([]) async function pokeInstall(gateway) { console.log(gateway) @@ -78,6 +82,8 @@ function HeardGateways(props) {
Gateway +
)})} {newGateways !== null ? diff --git a/ui/src/components/PublishedGateways.jsx b/ui/src/components/PublishedGateways.jsx index 26914747..f2127fbd 100644 --- a/ui/src/components/PublishedGateways.jsx +++ b/ui/src/components/PublishedGateways.jsx @@ -4,22 +4,13 @@ import DeleteGateway from './DeleteGateway.jsx' function PublishedGateways(props) { const [showNew, setShowNew] = useState(false) - const [showDelete, setShowDelete] = useState(false) - const [delGateway, setDelGateway] = useState({}) const published = props.published const loading = props.loading const api = props.api + const setShowDelete = props.setShowDelete + const setDelGateway = props.setDelGateway - async function deleteGateway(gateway) { - api.poke({ - app: "near-gateways", - mark: "near-action", - json: {"delete": {"ship": gateway.ship, "id": gateway.id}}, - onSuccess: () => {setDelGateway({}), window.location.reload(), setShowDelete(false)}, - onError: () => setError('Failed to delete gateway') - }) - } return(
@@ -28,7 +19,6 @@ function PublishedGateways(props) {
:
} - {showDelete ?
:
}
{(published !== null) && !loading ?
diff --git a/ui/src/index.css b/ui/src/index.css index 9af45a10..554a550b 100644 --- a/ui/src/index.css +++ b/ui/src/index.css @@ -1,6 +1,10 @@ @font-face { - font-family: "urbitSans"; + /* font-family: "urbitSans"; src: url("./fonts/UrbitSansWeb-Regular.woff2") format('woff2'); + 10:09 */ + font-family: "urbitSans"; + src: url('https://media.urbit.org/fonts/UrbitSans/UrbitSansVFWeb-Regular.woff2') + format('woff2'); /* font-family: "urbitSansMono"; src: url("./fonts/UrbitSansMonoWeb-Thin.woff2") format('woff2'); */ }