Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function FunctionResultModalContent(_a) {
var functionResult = _a.functionResult;
var navigate = useNavigate();
if (functionResult && typeof functionResult === "object" && !Array.isArray(functionResult))
return (_jsx(_Fragment, { children: _jsxs("div", __assign({ className: "p-4 md:p-5" }, { children: ["You created a\u00A0", _jsx(Link, __assign({ to: "/objects/".concat(functionResult._rev), className: "font-medium text-blue-600 dark:text-blue-500 hover:underline", onClick: function () {
return (_jsx(_Fragment, { children: _jsxs("div", __assign({ className: "p-4 md:p-5 dark:text-gray-400" }, { children: ["You created a\u00A0", _jsx(Link, __assign({ to: "/objects/".concat(functionResult._rev), className: "font-medium text-blue-600 dark:text-blue-500 hover:underline", onClick: function () {
navigate("/objects/".concat(functionResult._rev));
window.location.reload();
} }, { children: "smart object" })), "."] })) }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function FunctionResultModalContent({ functionResult }: any) {
if (functionResult && typeof functionResult === "object" && !Array.isArray(functionResult))
return (
<>
<div className="p-4 md:p-5">
<div className="p-4 md:p-5 dark:text-gray-400">
You created a&nbsp;
<Link
to={`/objects/${functionResult._rev}`}
Expand Down
24 changes: 13 additions & 11 deletions packages/cra-template/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,19 @@ export default function App() {
<ComputerContext.Provider value={computer}>
<Auth.LoginModal />
<Wallet />
<Navbar />
<div className="p-8 max-w-screen-xl flex flex-wrap items-center justify-between mx-auto">
<Routes>
<Route path="/" element={<AllAssets />} />
<Route path="/mine" element={<MyAssets />} />
<Route path="/mint" element={<Mint />} />
<Route path="/objects/:rev" element={<SmartObject.Component />} />
<Route path="/transactions/:txn" element={<Transaction.Component />} />
<Route path="*" element={<Navigate to="/" replace={true} />} />
<Route path="*" element={<Error404 />} />
</Routes>
<div className="dark:bg-gray-800 min-h-screen">
<Navbar />
<div className="p-8 max-w-screen-xl flex flex-wrap items-center justify-between mx-auto">
<Routes>
<Route path="/" element={<AllAssets />} />
<Route path="/mine" element={<MyAssets />} />
<Route path="/mint" element={<Mint />} />
<Route path="/objects/:rev" element={<SmartObject.Component />} />
<Route path="/transactions/:txn" element={<Transaction.Component />} />
<Route path="*" element={<Navigate to="/" replace={true} />} />
<Route path="*" element={<Error404 />} />
</Routes>
</div>
</div>
</ComputerContext.Provider>
</UtilsContext.UtilsProvider>
Expand Down
4 changes: 2 additions & 2 deletions packages/cra-template/src/components/Mint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Counter } from "../contracts/counter"
function SuccessContent(rev: string) {
return (
<>
<div className="p-4 md:p-5">
<div className="p-4 md:p-5 dark:text-gray-400">
<div>
You created a{" "}
<Link
Expand Down Expand Up @@ -35,7 +35,7 @@ function SuccessContent(rev: string) {
function ErrorContent(msg: string) {
return (
<>
<div className="p-4 md:p-5">
<div className="p-4 md:p-5 dark:text-gray-400">
<div>
Something went wrong.
<br />
Expand Down
26 changes: 14 additions & 12 deletions packages/explorer/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,20 @@ export default function App() {
<ComputerContext.Provider value={computer}>
<Auth.LoginModal />
<Wallet />
<NavBar />
<div className="p-8 max-w-screen-xl flex flex-wrap items-center justify-between mx-auto">
<Routes>
<Route path="/" element={<Gallery.WithPagination />} />
<Route path="/blocks" element={<Blocks />} />
<Route path="/playground" element={<Playground />} />
<Route path="/transactions/:txn" element={<Transaction.Component />} />
<Route path="/blocks/:block" element={<Block />} />
<Route path="/objects/:rev" element={<SmartObject.Component />} />
<Route path="/modules/:rev" element={<Module />} />
<Route path="*" element={<Error404 />} />
</Routes>
<div className="dark:bg-gray-800 min-h-screen">
<NavBar />
<div className="p-8 max-w-screen-xl flex flex-wrap items-center justify-between mx-auto">
<Routes>
<Route path="/" element={<Gallery.WithPagination />} />
<Route path="/blocks" element={<Blocks />} />
<Route path="/playground" element={<Playground />} />
<Route path="/transactions/:txn" element={<Transaction.Component />} />
<Route path="/blocks/:block" element={<Block />} />
<Route path="/objects/:rev" element={<SmartObject.Component />} />
<Route path="/modules/:rev" element={<Module />} />
<Route path="*" element={<Error404 />} />
</Routes>
</div>
</div>
</ComputerContext.Provider>
</UtilsContext.UtilsProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ const DeployModule = (props: {
>
Deploy Module
</button>
<div className="bg-white h-64"></div>
</>
)
}
Expand Down
26 changes: 14 additions & 12 deletions packages/ft2/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,20 @@ export default function App() {
<ComputerContext.Provider value={computer}>
<Auth.LoginModal />
<Wallet />
<Navbar />
<div className="p-8 max-w-screen-xl flex flex-wrap items-center justify-between mx-auto">
<Routes>
<Route path="/" element={<AllAssets />} />
<Route path="/mine" element={<MyAssets />} />
<Route path="/mint" element={<Mint />} />
<Route path="/orders" element={<Orders />} />
<Route path="/objects/:rev" element={<SmartObject.Component />} />
<Route path="/transactions/:txn" element={<Transaction.Component />} />
<Route path="*" element={<Navigate to="/" replace={true} />} />
<Route path="*" element={<Error404 />} />
</Routes>
<div className="dark:bg-gray-800 min-h-screen">
<Navbar />
<div className="p-8 max-w-screen-xl flex flex-wrap items-center justify-between mx-auto">
<Routes>
<Route path="/" element={<AllAssets />} />
<Route path="/mine" element={<MyAssets />} />
<Route path="/mint" element={<Mint />} />
<Route path="/orders" element={<Orders />} />
<Route path="/objects/:rev" element={<SmartObject.Component />} />
<Route path="/transactions/:txn" element={<Transaction.Component />} />
<Route path="*" element={<Navigate to="/" replace={true} />} />
<Route path="*" element={<Error404 />} />
</Routes>
</div>
</div>
</ComputerContext.Provider>
</UtilsContext.UtilsProvider>
Expand Down
109 changes: 55 additions & 54 deletions packages/ft2/src/components/Mint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { useContext, useState } from "react"
import { ComputerContext, Modal, UtilsContext } from "@bitcoin-computer/components"
import { TBC20 } from "@bitcoin-computer/TBC20"
import { Link } from "react-router-dom"
import { REACT_APP_TOKEN_MOD_SPEC } from '../constants/modSpecs'
import { REACT_APP_TOKEN_MOD_SPEC } from "../constants/modSpecs"

function SuccessContent(rev: string) {
return (
<>
<div className="p-4 md:p-5">
<div className="p-4 md:p-5 dark:text-gray-400">
<div>
You created a{" "}
<Link
Expand Down Expand Up @@ -36,7 +36,7 @@ function SuccessContent(rev: string) {
function ErrorContent(msg: string) {
return (
<>
<div className="p-4 md:p-5">
<div className="p-4 md:p-5 dark:text-gray-400">
<div>
Something went wrong.
<br />
Expand Down Expand Up @@ -67,17 +67,16 @@ export default function Mint() {
const [symbol, setSymbol] = useState("AAA")
const { showLoader } = UtilsContext.useUtilsComponents()


const onSubmit = async (e: React.SyntheticEvent) => {
e.preventDefault()
try {
showLoader(true)
const tbc20 = new TBC20(computer, REACT_APP_TOKEN_MOD_SPEC)
const mintId = await tbc20.mint(computer.getPublicKey(), parseInt(amount, 10), name, symbol)
setSuccessRev(mintId || '')
setSuccessRev(mintId || "")
showLoader(false)
Modal.showModal("success-modal")
} catch (err) {
} catch (err) {
showLoader(false)
if (err instanceof Error) {
setErrorMsg(err.message)
Expand All @@ -88,54 +87,56 @@ export default function Mint() {

return (
<>
<form onSubmit={onSubmit} className="w-full lg:w-1/2">
<div className="grid gap-6 mb-6">
<h2 className="text-2xl font-bold dark:text-white">Mint NFT</h2>
<div>
<label className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
Name
</label>
<input
type="text"
id="name"
value={name}
onChange={(e) => setName(e.target.value)}
className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
/>
</div>
<div>
<label className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
Symbol
</label>
<input
type="text"
id="symbol"
value={symbol}
onChange={(e) => setSymbol(e.target.value)}
className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
/>
</div>
<div>
<label className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
Supply
</label>
<input
type="text"
id="imageUrl"
value={amount}
onChange={(e) => { setAmount(e.target.value) }}
className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
/>
<form onSubmit={onSubmit} className="w-full lg:w-1/2">
<div className="grid gap-6 mb-6">
<h2 className="text-2xl font-bold dark:text-white">Mint NFT</h2>
<div>
<label className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
Name
</label>
<input
type="text"
id="name"
value={name}
onChange={(e) => setName(e.target.value)}
className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
/>
</div>
<div>
<label className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
Symbol
</label>
<input
type="text"
id="symbol"
value={symbol}
onChange={(e) => setSymbol(e.target.value)}
className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
/>
</div>
<div>
<label className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
Supply
</label>
<input
type="text"
id="imageUrl"
value={amount}
onChange={(e) => {
setAmount(e.target.value)
}}
className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
/>
</div>
</div>
</div>
<button
type="submit"
className="mt-1 text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
>
Mint NFT
</button>
</form>
<Modal.Component
<button
type="submit"
className="mt-1 text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
>
Mint NFT
</button>
</form>
<Modal.Component
title={"Success"}
content={SuccessContent}
contentData={successRev}
Expand All @@ -147,6 +148,6 @@ export default function Mint() {
contentData={errorMsg}
id={"error-modal"}
/>
</>
</>
)
}
24 changes: 13 additions & 11 deletions packages/nft/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,19 @@ export default function App() {
<ComputerContext.Provider value={computer}>
<Auth.LoginModal />
<Wallet paymentModSpec={VITE_PAYMENT_MOD_SPEC} />
<Navbar />
<div className="p-8 max-w-screen-xl flex flex-wrap items-center justify-between mx-auto">
<Routes>
<Route path="/" element={<AllAssets />} />
<Route path="/mine" element={<MyAssets />} />
<Route path="/mint" element={<Mint />} />
<Route path="/objects/:id" element={<NftView />} />
<Route path="/transactions/:txn" element={<Transaction.Component />} />
<Route path="*" element={<Navigate to="/" replace={true} />} />
<Route path="*" element={<Error404 />} />
</Routes>
<div className="dark:bg-gray-800 min-h-screen">
<Navbar />
<div className="p-8 max-w-screen-xl flex flex-wrap items-center justify-between mx-auto ">
<Routes>
<Route path="/" element={<AllAssets />} />
<Route path="/mine" element={<MyAssets />} />
<Route path="/mint" element={<Mint />} />
<Route path="/objects/:id" element={<NftView />} />
<Route path="/transactions/:txn" element={<Transaction.Component />} />
<Route path="*" element={<Navigate to="/" replace={true} />} />
<Route path="*" element={<Error404 />} />
</Routes>
</div>
</div>
</ComputerContext.Provider>
</UtilsContext.UtilsProvider>
Expand Down
2 changes: 1 addition & 1 deletion packages/nft/src/components/Gallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function NFTCard({ nft }: { nft: NFT }) {
<>
<div className="bg-white border border-gray-200 rounded-lg shadow dark:bg-gray-800 dark:border-gray-700 mb-4">
<img className="h-auto rounded-t-lg max-w-full w-full" src={nft.url} alt="" />
<div className="p-4 border-t">
<div className="p-4">
<h5
className="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white break-words"
title={nft.name}
Expand Down
4 changes: 2 additions & 2 deletions packages/nft/src/components/Mint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function SuccessContent(id: string) {
return (
<>
<div className="p-4 md:p-5">
<div>
<div className="dark:text-gray-400">
Congratiolations! You minted an nft. Click{" "}
<Link
to={`/objects/${id}`}
Expand Down Expand Up @@ -133,7 +133,7 @@ function MintForm(props: {
/>
{url && (
<div className="w-full h-64 flex items-center justify-center">
<div className="w-4/5 md:w-1/2 lg:w-1/2 h-full bg-gray-200 flex items-center justify-center mt-8">
<div className="w-4/5 md:w-1/2 lg:w-1/2 h-full bg-gray-200 flex items-center justify-center mt-8 dark:bg-gray-700">
<img className="max-h-full max-w-full object-contain" src={url} alt="" />
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions packages/nft/src/components/Nft.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const SmartObjectValues = ({ smartObject }: any) => {
)}
{smartObject.url && (
<div className="w-full h-80 flex items-center justify-center my-4">
<div className="w-full h-full bg-gray-200 flex items-center justify-center">
<div className="w-full h-full bg-gray-200 flex items-center justify-center dark:bg-gray-700">
<img
className="max-h-full max-w-full object-contain"
src={smartObject.url}
Expand Down Expand Up @@ -293,7 +293,7 @@ function SuccessContent(id: string) {
return (
<>
<div className="p-4 md:p-5">
<div>
<div className="dark:text-gray-400">
You bought this NFT{" "}
<Link
to={`/objects/${id}`}
Expand Down
Loading