Skip to content

Commit

Permalink
navbar + admin form for everyone (AbdelStark#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
MSghais authored Aug 1, 2024
1 parent 03be7fa commit 816e1a7
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 26 deletions.
40 changes: 40 additions & 0 deletions askeladd-dvm-marketplace/src/app/components/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"use client";

import Link from 'next/link';
import React, { useState } from 'react';
const Navbar: React.FC = () => {
const [isOpen, setIsOpen] = useState(false);
return (
<nav className=" dark:bg-dark-purple w-full z-20 top-0 start-0 border-b border-gray-200 dark:border-gray-600">
<div className="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
<Link href="/" className="flex items-center space-x-3 rtl:space-x-reverse">
{/* <img src="/vercel.svg" className="h-8" alt="ASKELADD" width={50} height={50} /> */}
<span className="self-center text-md font-semibold whitespace-nowrap dark:text-white">ASKELADD</span>
</Link>
<div className="flex md:order-2 space-x-3 md:space-x-0 rtl:space-x-reverse">
<button
aria-expanded={isOpen}
onClick={() => setIsOpen(!isOpen)} // Toggle the state on click
data-collapse-toggle="navbar-sticky" type="button" className="inline-flex items-center p-2 w-10 h-10 justify-center text-sm text-gray-500 rounded-lg md:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600" aria-controls="navbar-sticky">
<span className="sr-only">Open main menu</span>
<svg className="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 17 14">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 1h15M1 7h15M1 13h15" />
</svg>
</button>
</div>
{/* <div className={`items-center justify-between w-full md:flex md:w-auto md:order-1 ${isOpen ? 'flex' : 'hidden'}`} id="navbar-sticky"> */}

<div className={`items-center justify-between ${isOpen ? 'flex' : 'hidden'} w-full md:flex md:w-auto md:order-1`} id="navbar-sticky"> <ul className="flex flex-col p-4 md:p-0 mt-4 font-medium border border-gray-100 rounded-lg bg-gray-50 md:space-x-8 rtl:space-x-reverse md:flex-row md:mt-0 md:border-0 md:bg-white dark:bg-gray-800 md:dark:bg-gray-900 dark:border-gray-700">
<li>
<Link href={"/config-marketplace"}
onClick={() => setIsOpen(!isOpen)}
className="text-white focus:outline-none font-medium rounded-lg text-sm px-4 py-2 text-center dark:focus:ring-blue-800">DVM ZK Config</Link>
</li>
</ul>
</div>
</div>
</nav>
);
};

export default Navbar;
44 changes: 21 additions & 23 deletions askeladd-dvm-marketplace/src/app/config-marketplace/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ export default function Home() {
{isLoading ? "PROCESSING..." : "CONNECT"}
</button>

{publicKey && publicKey != APPLICATION_PUBKEY_DVM ?
<div>
{/* <div>
<div className="arcade-cabinet">
<div className="cabinet-content">
<div>
Expand All @@ -190,9 +189,11 @@ export default function Home() {
</div>
</div>
</div>
</div>
</div> */}

{

: publicKey && publicKey == APPLICATION_PUBKEY_DVM &&
// : publicKey && publicKey == APPLICATION_PUBKEY_DVM &&
<div className="arcade-cabinet">
<div className="cabinet-content">
<h1 className="text-4xl mb-4 text-center glitch neon-text" data-text="Askeladd DVM Arcade NIP-89">Askeladd DVM Marketplace</h1>
Expand All @@ -218,10 +219,10 @@ export default function Home() {
<p>Selected event: {appKind}</p>
<div className="mb-4 flex">
<button
className={appKind == ASKELADD_KINDS.KIND_JOB_REQUEST && configKind == ConfigHandle.SPECIFIC_KIND ? "bg-green" : "bg"}
className={appKind == ASKELADD_KINDS.KIND_JOB_REQUEST && configKind == ConfigHandle.SPECIFIC_KIND ? "bg-blue-500" : "bg"}
onClick={() => handleSetAppKindSpecific(ASKELADD_KINDS.KIND_JOB_REQUEST, ConfigHandle.SPECIFIC_KIND)}>ZK Job request</button>
<button
className={appKind == ASKELADD_KINDS.KIND_JOB_RESULT && configKind == ConfigHandle.SPECIFIC_KIND ? "bg-green" : "bg"}
className={appKind == ASKELADD_KINDS.KIND_JOB_RESULT && configKind == ConfigHandle.SPECIFIC_KIND ? "bg-blue-500" : "bg"}
onClick={() => handleSetAppKindSpecific(ASKELADD_KINDS.KIND_JOB_RESULT, ConfigHandle.SPECIFIC_KIND)}>ZK Job result</button>
</div>
</>
Expand All @@ -241,16 +242,8 @@ export default function Home() {
</div>
}



<button
className={`block mb-5 font-bold py-2 px-4 rounded bg-blue-500 hover:bg-blue-700 ${isLoading ? "opacity-50 cursor-not-allowed" : ""}`}
disabled={isLoading}
onClick={fetchEventsApp}>{events && events?.length ? "Refresh" : "Load"}</button>


<div onClick={() => setOpenHowItWork(!openHowItWork)}
className="cursor-pointer my-5 p-5"
className="max-w-sm cursor-pointer my-5 p-1 m-1 whitespace-pre-line"
>
<p className="text-white">How the ASKELADD DVM ZK works?</p>
{!openHowItWork &&
Expand All @@ -260,22 +253,30 @@ export default function Home() {
<>
<div>
<p>As an User </p>
<p className="text-white">User send a JOB_REQUEST with different params on the Nostr event:</p>
<p className="text-white">You need theses params on the Nostr event:</p>
<p className="text-white">User send a JOB_REQUEST with different params on the Nostr event.</p>
<p className="text-white">It can change with all STWO Prover enabled on the Marketplace</p>
<p className="text-white mb-5">You need theses params on the Nostr event:</p>
<p>Inputs </p>

<p className="text-white">Request: {JSON.stringify({
"claim": "413300",
"log_size":"5"
"log_size": "5"
})} &quot; The input of the Program</p>
<p className="text-white ">Tags: {`["param", "input_name", "value"]`} </p>
<p className="text-white ">Tags: {`[
["param", "input_name", "value"] // The input of the Program
]`} </p>
</div>
<button> Close </button>
</>
}
</div>

<div className="text-left max-w-md">
<button
className={`block mb-5 font-bold py-2 px-4 rounded bg-blue-500 hover:bg-blue-700 ${isLoading ? "opacity-50 cursor-not-allowed" : ""}`}
disabled={isLoading}
onClick={fetchEventsApp}>{events && events?.length ? "Refresh" : "Load"}</button>

<div className="text-left max-w-md">
<p className="text-center mb-5"> Existing Config of DVM</p>
<p className="text-center text-white mb-1">Last config</p>
{lastConfig &&
Expand All @@ -286,12 +287,9 @@ export default function Home() {

<p className="block mb-1 font-bold py-2 px-4 "> By Event KIND enabled on ASKELADD (WIP)</p>
<p className="block mb-5 text-md text-white px-4"> (5600, 6600 and more soon)</p>

<p className="block mb-5 font-bold text-white px-4"> Admin config (WIP)</p>
<p className="block mb-5 text-md text-white px-4">TODO</p>

<p className="block mb-5 font-bold py-2 px-4"> Others config</p>

<div className="grid sm:grid-cols-1 grid-cols-2 md:grid-cols-3 gap-4">{events?.map((event, i) => {
return (
<EventCard key={i} event={event}></EventCard>
Expand Down
8 changes: 5 additions & 3 deletions askeladd-dvm-marketplace/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { NostrProvider } from "@/context/NostrContext";
import { NostrProvider } from "@/context/NostrContext";
import "./globals.css";
import { Inter } from "next/font/google";
import Navbar from "./components/Navbar";

const inter = Inter({ subsets: ["latin"] });

Expand All @@ -17,8 +18,9 @@ export default function RootLayout({
return (
<html lang="en">
<NostrProvider>
<body className={inter.className}>{children}</body>

<body className={inter.className}>
<Navbar></Navbar>
{children}</body>
</NostrProvider>
</html>
);
Expand Down

0 comments on commit 816e1a7

Please sign in to comment.