Skip to content

Commit

Permalink
feat: update UI of Mint page
Browse files Browse the repository at this point in the history
  • Loading branch information
TwilightLogic committed May 15, 2024
1 parent 9ead0bd commit b343295
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
1 change: 1 addition & 0 deletions rooch-portal-v1/src/common/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@ export type PaymentTypes = {
export type TabItem = {
id: string
label: string
available: boolean
}
2 changes: 0 additions & 2 deletions rooch-portal-v1/src/pages/mint/components/featured-sfts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { useEffect, useState } from 'react'
import {
Table,
TableBody,
TableCaption,
TableCell,
TableHead,
TableHeader,
Expand Down Expand Up @@ -72,7 +71,6 @@ export const FeaturedSfts = () => {
return (
<div className="rounded-lg border w-full">
<Table>
<TableCaption className="text-left pl-2 mb-2">Lorem ipsum dolor sit.</TableCaption>
<TableHeader>
<TableRow>
<TableHead className="w-[150px]">SFT Name</TableHead>
Expand Down
30 changes: 23 additions & 7 deletions rooch-portal-v1/src/pages/mint/components/sft-tabs.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,41 @@
// Copyright (c) RoochNetwork
// SPDX-License-Identifier: Apache-2.0
import { useState } from 'react'

import { FeaturedSfts } from './featured-sfts'
import { Tokens } from './tokens'

import { TabItem } from '@/common/interface'
import { AlertCircle } from 'lucide-react'

const mintTabItems: TabItem[] = [
{ id: 'allTokens', label: 'All Tokens' },
{ id: 'featuredTokens', label: 'Featured Tokens' },
{ id: 'allTokens', label: 'All Tokens', available: false },
{ id: 'featuredTokens', label: 'Featured Tokens', available: false },
]

export const SftTabs = () => {
const [activeId, setActiveId] = useState<string>('allTokens')

const handleTabClick = (id: string) => {
setActiveId(id)
const handleTabClick = (id: string, available: boolean) => {
if (available) {
setActiveId(id)
}
}

const renderComingSoon = () => (
<div className="flex flex-col items-center justify-center text-center text-xl text-muted-foreground mt-10 animate-pulse">
<AlertCircle className="w-12 h-12 mb-4 text-blue-500" />
<p className="mb-2 font-semibold">Coming Soon!</p>
<p className="text-base text-gray-500">
We're working hard to bring this feature to you. Stay tuned!
</p>
</div>
)

const renderTabContent = () => {
const activeTab = mintTabItems.find((item) => item.id === activeId)
if (activeTab && !activeTab.available) {
return renderComingSoon()
}

switch (activeId) {
case 'allTokens':
return <FeaturedSfts />
Expand All @@ -41,7 +57,7 @@ export const SftTabs = () => {
? 'border-b-2 border-blue-500 text-blue-500'
: 'border-b-2 border-transparent text-muted-foreground'
} hover:text-blue-500 transition-all`}
onClick={() => handleTabClick(item.id)}
onClick={() => handleTabClick(item.id, item.available)}
>
<p className="font-semibold text-sm">{item.label}</p>
</button>
Expand Down
2 changes: 0 additions & 2 deletions rooch-portal-v1/src/pages/mint/components/tokens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import {
Table,
TableBody,
TableCaption,
TableCell,
TableHead,
TableHeader,
Expand Down Expand Up @@ -59,7 +58,6 @@ export const Tokens = () => {
return (
<div className="rounded-lg border w-full">
<Table>
<TableCaption className="text-left pl-2 mb-2">Lorem ipsum dolor sit.</TableCaption>
<TableHeader>
<TableRow>
<TableHead className="w-[150px]">SFT Name</TableHead>
Expand Down

0 comments on commit b343295

Please sign in to comment.