From 05b6606d37d59af87a9928b3dd4e124fcac0b451 Mon Sep 17 00:00:00 2001 From: Will Galebach Date: Mon, 15 Apr 2024 22:43:46 +0100 Subject: [PATCH 1/4] Fixed vite config --- kinode/packages/app_store/ui/src/App.tsx | 1 + kinode/packages/app_store/ui/src/index.css | 8 ++++---- kinode/packages/app_store/ui/vite.config.ts | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kinode/packages/app_store/ui/src/App.tsx b/kinode/packages/app_store/ui/src/App.tsx index e0bf09e5..cc4d6d7b 100644 --- a/kinode/packages/app_store/ui/src/App.tsx +++ b/kinode/packages/app_store/ui/src/App.tsx @@ -63,6 +63,7 @@ function App() { useEffect(() => { provider?.getNetwork().then(network => { + // TODO: don't have this fire 20 times on load if (network.chainId === ChainId.OPTIMISM) { setPackageAbi(PackageStore__factory.connect( PACKAGE_STORE_ADDRESSES[ChainId.OPTIMISM], diff --git a/kinode/packages/app_store/ui/src/index.css b/kinode/packages/app_store/ui/src/index.css index 9248736c..1ea698f1 100644 --- a/kinode/packages/app_store/ui/src/index.css +++ b/kinode/packages/app_store/ui/src/index.css @@ -4,17 +4,17 @@ @font-face { font-family: 'Futura'; - src: url('./fonts/Futura-Heavy.ttf'); + src: url('/main:app_store:sys/assets/fonts/Futura-Heavy.ttf'); } @font-face { font-family: 'OpenSans'; - src: url('./fonts/OpenSans-CondBold.ttf'); + src: url('/main:app_store:sys/assets/fonts/OpenSans-CondBold.ttf'); } @font-face { font-family: 'Barlow'; - src: url('./fonts/BarlowCondensed-Black.ttf'); + src: url('/main:app_store:sys/assets/fonts/BarlowCondensed-Black.ttf'); } body { @@ -84,7 +84,7 @@ button[type="submit"], } body { - @apply bg-[url('./background.jpg')] bg-cover bg-no-repeat bg-center bg-fixed text-white; + @apply bg-[url('/main:app_store:sys/assets/background.jpg')] bg-cover bg-no-repeat bg-center bg-fixed text-white; } input { diff --git a/kinode/packages/app_store/ui/vite.config.ts b/kinode/packages/app_store/ui/vite.config.ts index 294ec407..f8c8742c 100644 --- a/kinode/packages/app_store/ui/vite.config.ts +++ b/kinode/packages/app_store/ui/vite.config.ts @@ -19,7 +19,6 @@ This must match the process name from pkg/manifest.json + pkg/metadata.json The format is "/" + "process_name:package_name:publisher_node" */ const BASE_URL = `/main:app_store:sys`; -// const BASE_URL = `/${manifest[0].process_name}:${metadata.package}:${metadata.publisher}`; // This is the proxy URL, it must match the node you are developing against const PROXY_URL = (process.env.VITE_NODE_URL || 'http://127.0.0.1:8080').replace('localhost', '127.0.0.1'); @@ -79,7 +78,7 @@ export default defineConfig({ rewrite: (path) => path.replace(BASE_URL, ''), }, // This route will match all other HTTP requests to the backend - [`^${BASE_URL}/(?!(@vite/client|src/.*|node_modules/.*|@react-refresh|$))`]: { + [`^${BASE_URL}/(?!(@vite/client|src/.*|node_modules/.*|@react-refresh|__uno.css|$))`]: { target: PROXY_URL, changeOrigin: true, }, From d0029a233be39d646bc715ebeb017cee5223f792 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Mon, 15 Apr 2024 17:44:59 -0600 Subject: [PATCH 2/4] unpublish added --- .../app_store/ui/src/pages/PublishPage.tsx | 64 ++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/kinode/packages/app_store/ui/src/pages/PublishPage.tsx b/kinode/packages/app_store/ui/src/pages/PublishPage.tsx index 60d7bd38..034043b5 100644 --- a/kinode/packages/app_store/ui/src/pages/PublishPage.tsx +++ b/kinode/packages/app_store/ui/src/pages/PublishPage.tsx @@ -44,6 +44,7 @@ export default function PublishPage({ const [metadataUrl, setMetadataUrl] = useState(""); const [metadataHash, setMetadataHash] = useState(""); // BytesLike const [isUpdate, setIsUpdate] = useState(false); + const [myPublishedApps, setMyPublishedApps] = useState([]); useEffect(() => { const app: AppInfo | undefined = state?.app; @@ -54,6 +55,12 @@ export default function PublishPage({ } }, [state]) + useEffect(() => { + setMyPublishedApps( + listedApps.filter((app) => app.owner?.toLowerCase() === account?.toLowerCase()) + ); + }, [listedApps, account]) + const connectWallet = useCallback(async () => { await metaMask.activate().catch(() => { }); @@ -157,6 +164,35 @@ export default function PublishPage({ ] ); + const unpublishPackage = useCallback( + async (packageName: string, publisherName: string) => { + try { + await setChain(OPTIMISM_OPT_HEX); + + const tx = await + packageAbi.unlistPacakge( + utils.keccak256(utils.solidityPack( + ["string", "bytes"], + [packageName, toDNSWireFormat(publisherName)] + )) + ); + + await new Promise((resolve) => setTimeout(resolve, 2000)); + + setLoading("Unlisting package..."); + await tx.wait(); + } catch (error) { + console.error(error); + window.alert( + "Error unlisting package" + ); + } finally { + setLoading(""); + } + }, + [packageAbi, setLoading] + ); + const checkIfUpdate = useCallback(async () => { if (isUpdate) return; @@ -173,9 +209,10 @@ export default function PublishPage({ return (
+

fOOOO

setShowMetadataForm(false) : undefined} />
-

Publish Package

+

Publish Packages

{Boolean(account) &&
Publishing as: @@ -293,6 +330,31 @@ export default function PublishPage({ )} + +
+

Packages You Own

+ {myPublishedApps.length > 0 ? ( +
+ {myPublishedApps.map((app) => ( +
+
+ + {app.package} +
+ {/* */} + + {/* */} +
+ ))} +
+ ) : ( +
+ No packages published +
+ )} +
); } From 5f35e5cc24c51b751645788ec22b2733afef6581 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Mon, 15 Apr 2024 17:45:29 -0600 Subject: [PATCH 3/4] text fixed --- kinode/packages/app_store/ui/src/pages/PublishPage.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kinode/packages/app_store/ui/src/pages/PublishPage.tsx b/kinode/packages/app_store/ui/src/pages/PublishPage.tsx index 034043b5..ca835fe2 100644 --- a/kinode/packages/app_store/ui/src/pages/PublishPage.tsx +++ b/kinode/packages/app_store/ui/src/pages/PublishPage.tsx @@ -209,10 +209,9 @@ export default function PublishPage({ return (
-

fOOOO

setShowMetadataForm(false) : undefined} />
-

Publish Packages

+

Publish Package

{Boolean(account) &&
Publishing as: From 1e1bc15b48870ca19fd1ca42d61e33e8c4f252f4 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Mon, 15 Apr 2024 17:50:45 -0600 Subject: [PATCH 4/4] css update --- kinode/packages/app_store/ui/src/pages/PublishPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kinode/packages/app_store/ui/src/pages/PublishPage.tsx b/kinode/packages/app_store/ui/src/pages/PublishPage.tsx index ca835fe2..6ed02b46 100644 --- a/kinode/packages/app_store/ui/src/pages/PublishPage.tsx +++ b/kinode/packages/app_store/ui/src/pages/PublishPage.tsx @@ -330,7 +330,7 @@ export default function PublishPage({ )} -
+

Packages You Own

{myPublishedApps.length > 0 ? (