Skip to content

Commit

Permalink
Move new tier setup to end of list; change style
Browse files Browse the repository at this point in the history
  • Loading branch information
wbt committed Oct 22, 2023
1 parent 201666f commit ddfdc17
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 37 deletions.
2 changes: 2 additions & 0 deletions packages/nextjs/components/example-ui/TierList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { TierCard } from "./TierCard";
import { TierSetup } from "./TierSetup";

export const TiersList = (props: { merchant?: string; tiersLength?: bigint }) => {
const tiersLength = props.tiersLength;
Expand All @@ -17,6 +18,7 @@ export const TiersList = (props: { merchant?: string; tiersLength?: bigint }) =>
{indicies.map(index => (
<TierCard key={index.toString()} merchant={merchant} tierIndex={index} showOfferedStatus={true} />
))}
<TierSetup />
</ol>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/components/example-ui/TierListing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const TierListing = () => {
const { data: yourContract } = useScaffoldContract({ contractName: "SubscryptoToken" });
console.log("subscryptoToken: ", yourContract);

let tierCountText = "No defined tiers for this merchant account yet! Use the tool to the right to create one.";
let tierCountText = "No defined tiers for this merchant account yet! You can create one below.";
if (isTierCountLoading) {
tierCountText = "Loading...";
} else if (typeof tiersLength === "undefined") {
Expand Down
56 changes: 22 additions & 34 deletions packages/nextjs/components/example-ui/TierSetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,28 @@ export const TierSetup = () => {
});

return (
<div className="flex bg-base-300 relative pb-10">
<div className="flex flex-col w-full mx-5 sm:mx-8 2xl:mx-20">
<div className="flex flex-col mt-6 px-7 py-8 bg-base-200 opacity-80 rounded-2xl shadow-lg border-2 border-primary">
<span className="text-xl my-4">Create a new service tier:</span>
<input
type="number"
placeholder="Calls/activities per week maximum"
className="input w-full px-5 border border-primary text-lg my-4"
onChange={e => setUnitsPerWeek(e.target.value)}
/>
<br />
<input
type="number"
placeholder="Price per week in credits (each ≈$1)"
className="input w-full px-5 border border-primary text-lg my-4"
onChange={e => setPricePerWeek(e.target.value)}
/>
<div className="flex rounded-full p-1 flex-shrink-0 place-content-end">
<button
className="btn btn-primary rounded-full capitalize font-normal font-white flex items-center gap-1 hover:gap-2 transition-all tracking-widest"
onClick={() => writeAsync()}
disabled={isLoading}
>
{isLoading ? (
<span className="loading loading-spinner loading-sm"></span>
) : (
<>
Create tier <ArrowSmallRightIcon className="w-3 h-3 mt-0.5" />
</>
)}
</button>
</div>
</div>
<li className="py-8 px-5 border border-primary rounded-xl flex flex-col m-5">
<span className="text-xl my-4">Create a new service tier:</span>
Calls/activities per week maximum:
<input type="number" className="input border border-primary" onChange={e => setUnitsPerWeek(e.target.value)} />
<br />
Price per week in credits (each ≈$1):
<input type="number" className="input border border-primary" onChange={e => setPricePerWeek(e.target.value)} />
<div className="flex rounded-full p-1 flex-shrink-0 place-content-end">
<button
className="btn btn-primary rounded-full capitalize font-normal font-white flex items-center gap-1 hover:gap-2 transition-all tracking-widest"
onClick={() => writeAsync()}
disabled={isLoading}
>
{isLoading ? (
<span className="loading loading-spinner loading-sm"></span>
) : (
<>
Create tier <ArrowSmallRightIcon className="w-3 h-3 mt-0.5" />
</>
)}
</button>
</div>
</div>
</li>
);
};
2 changes: 0 additions & 2 deletions packages/nextjs/pages/merchant.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { NextPage } from "next";
import { MetaHeader } from "~~/components/MetaHeader";
import { TierListing } from "~~/components/example-ui/TierListing";
import { TierSetup } from "~~/components/example-ui/TierSetup";

const MerchantSetup: NextPage = () => {
return (
Expand All @@ -12,7 +11,6 @@ const MerchantSetup: NextPage = () => {
/>
<div className="grid lg:grid-cols-2 flex-grow" data-theme="exampleUi">
<TierListing />
<TierSetup />
</div>
</>
);
Expand Down

0 comments on commit ddfdc17

Please sign in to comment.