Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: sexier landing pages #184

Merged
merged 2 commits into from
Jan 8, 2025
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
122 changes: 86 additions & 36 deletions pages/bank.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { MFX_TOKEN_DATA } from '@/utils/constants';
import env from '@/config/env';
import { SEO } from '@/components';
import { useResponsivePageSize } from '@/hooks/useResponsivePageSize';
import Link from 'next/link';

interface PageSizeConfig {
tokenList: number;
Expand Down Expand Up @@ -149,16 +150,18 @@ export default function Bank() {
>
Bank
</h1>
<div className="relative w-full sm:w-[224px]">
<input
type="text"
placeholder="Search for an asset ..."
className="input input-bordered w-full h-[40px] rounded-[12px] border-none bg-secondary text-secondary-content pl-10 focus:outline-none focus-visible:ring-1 focus-visible:ring-primary"
value={searchTerm}
onChange={e => setSearchTerm(e.target.value)}
/>
<SearchIcon className="h-6 w-6 absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400" />
</div>
{combinedBalances.length > 0 && (
<div className="relative w-full sm:w-[224px]">
<input
type="text"
placeholder="Search for an asset ..."
className="input input-bordered w-full h-[40px] rounded-[12px] border-none bg-secondary text-secondary-content pl-10 focus:outline-none focus-visible:ring-1 focus-visible:ring-primary"
value={searchTerm}
onChange={e => setSearchTerm(e.target.value)}
/>
<SearchIcon className="h-6 w-6 absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400" />
</div>
)}
</div>
</div>
<div
Expand Down Expand Up @@ -189,32 +192,38 @@ export default function Bank() {
</div>

<div className="flex flex-col w-full mt-4">
{activeTab === 'assets' && (
<TokenList
refetchBalances={refetchBalances || resolveRefetch}
isLoading={isLoading}
balances={combinedBalances}
refetchHistory={refetchHistory}
address={address ?? ''}
pageSize={tokenListPageSize}
searchTerm={searchTerm}
/>
)}
{activeTab === 'history' && (
<HistoryBox
currentPage={currentPage}
setCurrentPage={setCurrentPage}
address={address ?? ''}
isLoading={isLoading}
sendTxs={sendTxs}
totalPages={totalPages}
txLoading={txLoading}
isError={isError}
refetch={refetchHistory}
skeletonGroupCount={skeletonGroupCount}
skeletonTxCount={skeletonTxCount}
/>
)}
{activeTab === 'assets' &&
(combinedBalances.length === 0 ? (
<NoAssetsFound />
) : (
<TokenList
refetchBalances={refetchBalances || resolveRefetch}
isLoading={isLoading}
balances={combinedBalances}
refetchHistory={refetchHistory}
address={address ?? ''}
pageSize={tokenListPageSize}
searchTerm={searchTerm}
/>
))}
{activeTab === 'history' &&
(sendTxs.length === 0 ? (
<NoActivityFound />
) : (
<HistoryBox
currentPage={currentPage}
setCurrentPage={setCurrentPage}
address={address ?? ''}
isLoading={isLoading}
sendTxs={sendTxs}
totalPages={totalPages}
txLoading={txLoading}
isError={isError}
refetch={refetchHistory}
skeletonGroupCount={skeletonGroupCount}
skeletonTxCount={skeletonTxCount}
/>
))}
</div>
</div>
</div>
Expand All @@ -224,3 +233,44 @@ export default function Bank() {
</div>
);
}

function NoAssetsFound() {
return (
<section className="transition-opacity duration-300 h-auto mt-12 ease-in-out animate-fadeIn w-full flex items-center justify-center">
<div className="grid max-w-4xl bg-base-300 p-12 rounded-md w-full mx-auto gap-8 lg:grid-cols-12">
<div className="mr-auto place-self-center lg:col-span-7">
<h1 className="max-w-2xl mb-4 text-2xl font-extrabold tracking-tight leading-none md:text-3xl xl:text-4xl dark:text-white text-black">
No Assets Found
</h1>
<p className="max-w-2xl mb-6 font-light text-gray-500 lg:mb-8 md:text-lg lg:text-xl">
You do not have any assets yet.
</p>
</div>
<div className="hidden lg:mt-0 lg:ml-24 lg:col-span-5 lg:flex">
<BankIcon className="h-60 w-60 text-primary" />
</div>
</div>
</section>
);
}

function NoActivityFound() {
return (
<section className="transition-opacity duration-300 h-auto mt-12 ease-in-out animate-fadeIn w-full flex items-center justify-center">
<div className="grid max-w-4xl bg-base-300 p-12 rounded-md w-full mx-auto gap-8 lg:grid-cols-12">
<div className="mr-auto place-self-center lg:col-span-7">
<h1 className="max-w-2xl mb-4 text-2xl font-extrabold tracking-tight leading-none md:text-3xl xl:text-4xl dark:text-white text-black">
No Activity Found
</h1>
<p className="max-w-2xl mb-6 font-light text-gray-500 lg:mb-8 md:text-lg lg:text-xl">
You do not have any activity yet. Submit a transaction and revisit this page to view
your history!
</p>
</div>
<div className="hidden lg:mt-0 lg:ml-24 lg:col-span-5 lg:flex">
<BankIcon className="h-60 w-60 text-primary" />
</div>
</div>
</section>
);
}
100 changes: 64 additions & 36 deletions pages/factory/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { SEO } from '@/components';
import env from '@/config/env';

import { useResponsivePageSize } from '@/hooks/useResponsivePageSize';
import Link from 'next/link';

interface PageSizeConfig {
denomList: number;
Expand Down Expand Up @@ -117,50 +118,77 @@ export default function Factory() {
/>
) : (
<div className="relative w-full h-full overflow-hidden scrollbar-hide p-1">
<div className="h-full flex flex-col ">
<div className="flex flex-col md:flex-row justify-between items-start md:items-center mb-4 gap-4">
<div className="flex flex-col sm:flex-row items-start sm:items-center gap-4 w-full md:w-auto">
<h1
className="text-secondary-content"
style={{ fontSize: '20px', fontWeight: 700, lineHeight: '24px' }}
>
Tokens
</h1>
<div className="relative w-full sm:w-[224px]">
<input
type="text"
placeholder="Search for a token ..."
className="input input-bordered w-full h-[40px] rounded-[12px] border-none bg-secondary text-secondary-content pl-10 focus:outline-none focus-visible:ring-1 focus-visible:ring-primary"
value={searchTerm}
onChange={e => setSearchTerm(e.target.value)}
/>
<SearchIcon className="h-6 w-6 absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400" />
{combinedData.length > 0 ? (
<div className="h-full flex flex-col ">
<div className="flex flex-col md:flex-row justify-between items-start md:items-center mb-4 gap-4">
<div className="flex flex-col sm:flex-row items-start sm:items-center gap-4 w-full md:w-auto">
<h1
className="text-secondary-content"
style={{ fontSize: '20px', fontWeight: 700, lineHeight: '24px' }}
>
Tokens
</h1>
<div className="relative w-full sm:w-[224px]">
<input
type="text"
placeholder="Search for a token ..."
className="input input-bordered w-full h-[40px] rounded-[12px] border-none bg-secondary text-secondary-content pl-10 focus:outline-none focus-visible:ring-1 focus-visible:ring-primary"
value={searchTerm}
onChange={e => setSearchTerm(e.target.value)}
/>
<SearchIcon className="h-6 w-6 absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400" />
</div>
</div>
</div>
</div>

<div className="flex flex-col w-full mt-4">
{isError ? (
<div className="text-center my-auto text-error">
Error loading tokens. Please try again.
</div>
) : (
<DenomList
denoms={combinedData}
isLoading={isLoading}
refetchDenoms={refetchData}
pageSize={denomListPageSize}
address={address ?? ''}
admin={address ?? ''}
searchTerm={searchTerm}
/>
)}
<div className="flex flex-col w-full mt-4">
{isError ? (
<div className="text-center my-auto text-error">
Error loading tokens. Please try again.
</div>
) : (
<DenomList
denoms={combinedData}
isLoading={isLoading}
refetchDenoms={refetchData}
pageSize={denomListPageSize}
address={address ?? ''}
admin={address ?? ''}
searchTerm={searchTerm}
/>
)}
</div>
</div>
</div>
) : (
<NoAssetsFound />
)}
</div>
)}
</div>
</div>
</div>
);
}

function NoAssetsFound() {
return (
<section className="transition-opacity duration-300 h-[80vh] ease-in-out animate-fadeIn w-full flex items-center justify-center">
<div className="grid max-w-4xl bg-base-300 p-12 rounded-md w-full mx-auto gap-8 lg:grid-cols-12">
<div className="mr-auto place-self-center lg:col-span-7">
<h1 className="max-w-2xl mb-4 text-2xl font-extrabold tracking-tight leading-none md:text-3xl xl:text-4xl dark:text-white text-black">
No Assets Found
</h1>
<p className="max-w-2xl mb-6 font-light text-gray-500 lg:mb-8 md:text-lg lg:text-xl">
You do not have any factory assets yet. Create a new asset in the factory page!
</p>
<Link href="/groups/create" passHref>
<button className="btn btn-gradient">Create New Token</button>
</Link>
Comment on lines +184 to +186
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix incorrect navigation link.

The "Create New Token" button links to "/groups/create" instead of the token creation page.

-          <Link href="/groups/create" passHref>
+          <Link href="/factory/create" passHref>
             <button className="btn btn-gradient">Create New Token</button>
           </Link>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Link href="/groups/create" passHref>
<button className="btn btn-gradient">Create New Token</button>
</Link>
<Link href="/factory/create" passHref>
<button className="btn btn-gradient">Create New Token</button>
</Link>

</div>
<div className="hidden lg:mt-0 lg:ml-24 lg:col-span-5 lg:flex">
<FactoryIcon className="h-60 w-60 text-primary" />
</div>
</div>
</section>
);
}
Loading