Skip to content

Commit

Permalink
Merge pull request #93 from cardano2vn/refactor-code
Browse files Browse the repository at this point in the history
chore: update dependencies, improve minting UI, and clean up unused code
  • Loading branch information
tidvn authored Nov 17, 2024
2 parents 30ac8cb + 03686cd commit a296e53
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 33 deletions.
1 change: 0 additions & 1 deletion src/app/(app)/dashboard/mint/(home)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export default function MintPage() {
return (
<div className="py-8 px-10 m-auto flex flex-col">
<div className="rounded-xl p-6 bg-section shadow-md flex flex-col gap-3">
<h1 className="text-2xl font-medium leading-7">Mint</h1>
<div className="mt-2 grid gap-4 grid-cols-3 max-md:grid-cols-1">
<Link
href={dashboardRoutes.mint.children.mintOne.redirect}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import { Images } from "@/components/common/images";
import { AspectRatio } from "@/components/ui/aspect-ratio";
import { Button } from "@/components/ui/button";
Expand Down
4 changes: 0 additions & 4 deletions src/app/(app)/dashboard/mint/one/_context/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,10 @@ const useMintOneStore = create<MintOneStore>((set) => ({
const tasks = [...state.tasks];
if (status === "error" || isEmpty(name)) {
const lastTaskIndex = tasks.length - 1;
const newContent = isEmpty(content)
? tasks[lastTaskIndex].content
: tasks[lastTaskIndex].content + ` : ${content}`;
if (lastTaskIndex >= 0) {
tasks[lastTaskIndex] = {
...tasks[lastTaskIndex],
status,
content: newContent,
};
}
} else {
Expand Down
22 changes: 8 additions & 14 deletions src/components/common/icons.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import {
ArrowRight,
CircuitBoard,
Globe,
House,
ImagePlus,
LayoutGrid,
LucideIcon,
LucideProps,
Expand All @@ -20,13 +15,12 @@ import { IconType } from "react-icons";
import { FaYoutube } from "react-icons/fa";
import { TiHome } from "react-icons/ti";
import { FaToolbox } from "react-icons/fa6";
import { SiCoinmarketcap } from "react-icons/si";
export type Icon = LucideIcon | IconType;

export const Icons = {
arrowRight: ({ ...props }: LucideProps) => {
return (
<svg viewBox="0 0 24 24" width="20" height="20">
<svg viewBox="0 0 24 24" width="20" height="20" {...props}>
<path
fillRule="evenodd"
clipRule="evenodd"
Expand All @@ -39,13 +33,13 @@ export const Icons = {
house: TiHome,
imagePlus: IoIosCreate,
circuitBoard: FaToolbox,
menuIcon: SiCoinmarketcap,
store: SiCoinmarketcap,
globe: SiCoinmarketcap,
send: SiCoinmarketcap,
squareMenu: SiCoinmarketcap,
layoutGrid: SiCoinmarketcap,
search: SiCoinmarketcap,
menuIcon: MenuIcon,
store: Store,
globe: Globe,
send: Send,
squareMenu: SquareMenu,
layoutGrid: LayoutGrid,
search: Search,
calendar: Calendar,
ideaScale: ({ ...props }: LucideProps) => (
<svg
Expand Down
20 changes: 6 additions & 14 deletions src/components/layouts/desktop-dashboard/sidebar/menu-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,17 @@ export function MenuList() {
asChild
disabled={disabled}
>
<Link href={href}>
<Link href={href} className="flex items-center">
<span
className={cn(
"h-6 w-6",
isOpen === false ? "" : "mr-4",
"flex h-10 w-10 items-center justify-center",
)}
>
<Icon className={`h-6 w-6 flex-none`} />
</span>
<span
className={cn(
"max-w-[200px] truncate",
isOpen === false
? "-translate-x-96 opacity-0"
: "translate-x-0 opacity-100",
)}
>
{title}
<Icon className="h-6 w-6" />
</span>
{isOpen === true && (
<span className="flex-grow">{title}</span>
)}
</Link>
</Button>
</TooltipTrigger>
Expand Down
1 change: 1 addition & 0 deletions src/services/blockchain/getWalletAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export async function getWalletAssets({
try {
const assetsAddress =
await koiosFetcher.fetchAssetsFromAddress(walletAddress);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const totalPage = Math.ceil(assetsAddress.length / Number(pageSize));
const assetsSlice = [...assetsAddress].slice(
(Number(page) - 1) * Number(pageSize),
Expand Down
1 change: 1 addition & 0 deletions src/utils/convert-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import cbor from "cbor";
*/
export async function converMetadata(
datum: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
key?: string,
): Promise<unknown> {
try {
Expand Down

0 comments on commit a296e53

Please sign in to comment.