Skip to content

Commit

Permalink
refactor transfer modal for new proxy bridge flow, add support for te…
Browse files Browse the repository at this point in the history
…rra luna
  • Loading branch information
TrevorJTClarke committed Aug 11, 2023
1 parent cdec62c commit 445bc7f
Show file tree
Hide file tree
Showing 17 changed files with 1,716 additions and 115 deletions.
17 changes: 2 additions & 15 deletions components/header.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React from 'react';
import Link from 'next/link';
import { useTheme } from '../contexts/theme';
import { NavProps, ActiveLink } from '../components';
import { ProfileWallet } from '../components/profile-wallet';
import { MoonIcon, SunIcon } from '@heroicons/react/24/outline';

export const navItems: NavProps[] = [
{
Expand All @@ -19,18 +17,17 @@ export const navItems: NavProps[] = [
];

export const Header = () => {
const { theme, toggleTheme } = useTheme();

return (
<header className="sticky top-0 z-50 px-8 hidden h-24 w-full max-w-full bg-white border-b border-black/10 dark:border-zinc-800 dark:bg-black lg:flex lg:flex-row lg:items-center lg:justify-between">
<header className="sticky top-0 z-50 px-8 hidden h-24 w-full max-w-full bg-black border-b border-black/10 border-zinc-800 lg:flex lg:flex-row lg:items-center lg:justify-between">
<div className="flex">
<Link href="/">
<div className="flex items-center transition-transform focus:scale-110 focus:outline-0 focus:drop-shadow-primary">
<img src="/ASTRAL_LOGO.svg" alt="ASTRAL" width="160" height="24" />
</div>
</Link>

<nav className="flex flex-row space-x-4 bg-white px-2 py-6 ml-4 dark:bg-black">
<nav className="flex flex-row space-x-4 px-2 py-6 ml-4 bg-black">
{navItems.map((item, idx) => (
<div key={idx}>
<ActiveLink
Expand All @@ -48,16 +45,6 @@ export const Header = () => {
</div>

<ProfileWallet />
{/* <button
className="inline-flex items-center justify-center w-12 h-12 text-black border rounded-lg dark:text-white hover:bg-black/10 dark:hover:bg-white/10 border-black/10 dark:border-white/10"
onClick={toggleTheme}
>
{theme === 'light' ? (
<MoonIcon className="w-5 h-5" />
) : (
<SunIcon className="w-6 h-6" />
)}
</button> */}
</header>
);
}
2 changes: 1 addition & 1 deletion components/react/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export const TailwindModal = ({
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
>
<Dialog.Panel className="relative transform overflow-hidden rounded-xl bg-white dark:bg-[#1A1B1F] px-4 pt-2.5 pb-4 [min-height:18rem] text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-xs sm:p-4">
<Dialog.Panel className="relative transform overflow-hidden rounded-xl bg-[#1A1B1F] px-4 pt-2.5 pb-4 [min-height:18rem] text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-xs sm:p-4">
<div className="w-full h-full">{_render}</div>
</Dialog.Panel>
</Transition.Child>
Expand Down
2 changes: 1 addition & 1 deletion components/transfer-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ export default function TransferModal({
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
>
<Dialog.Panel className="relative transform rounded-xl bg-white dark:bg-black p-8 [min-height:18rem] text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg md:max-w-3xl">
<Dialog.Panel className="relative transform rounded-xl bg-black p-8 [min-height:18rem] text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg md:max-w-3xl">

{currentView === TransferView.Setup && (
<div>
Expand Down
86 changes: 86 additions & 0 deletions components/transfers/TransferError.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/* eslint-disable @next/next/no-img-element */
import { Dialog } from '@headlessui/react'
import type { Dispatch } from './TransferModal'
import NftImage from '../nft-image'
import {
CheckIcon,
XMarkIcon,
} from '@heroicons/react/24/outline'
import {
classNames,
} from '../../config'

export interface TransferErrorsTypes {
setOpen: Dispatch <boolean>
setReset: Dispatch <any>
imageUrl?: string
errors: any[]
}

export default function TransferError({
setOpen,
setReset,
imageUrl,
errors,
}: TransferErrorsTypes) {
return (
<div className="relative mt-0 text-left sm:mt-0 text-white">
<Dialog.Title as="div" className="text-2xl font-semibold leading-6 text-gray-100">
Transfer Error

<div className="mt-2">
<p className="text-sm text-gray-500">
Something went wrong with your transfer. Please review the reasons below.
</p>
</div>
</Dialog.Title>

<button
type="button"
className="absolute top-0 right-0 bg-transparent opacity-0 hover:opacity-100 hover:bg-gray-800 px-4 py-3 rounded-xl"
onClick={() => setOpen(false)}
>
<XMarkIcon className="h-8 w-8 text-gray-400" aria-hidden="true" />
</button>

<div className="flex justify-start gap-16 relative mx-auto mt-8">
<NftImage className="min-h-[250px] min-w-[250px]" uri={imageUrl} />

<div className="my-auto">
<nav aria-label="Progress">
<ul role="list" className="overflow-hidden pointer-events-none text-red-600">
{errors && errors.map((item, idx) => (
<li key={idx} className={classNames(idx > 1 ? 'pb-10' : '', 'relative')}>
<p>{idx + 1}. {item}</p>
</li>
))}
{!errors.length && (
<li>
<p>Error could not be parsed correctly. Please try again.</p>
</li>
)}
</ul>
</nav>
</div>
</div>

<div className="mt-12 sm:mt-6 md:mt-12 sm:grid sm:grid-flow-row-dense sm:grid-cols-2 sm:gap-4">
<button
type="button"
className="inline-flex w-full justify-center rounded-md bg-pink-600 hover:bg-pink-600/80 px-8 py-4 text-sm font-semibold text-white shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-pink-600 sm:col-start-2"
onClick={() => setReset()}
>
Try Again
</button>
<button
type="button"
className="mt-3 inline-flex w-full justify-center rounded-md bg-transparent opacity-70 hover:opacity-95 px-8 py-4 text-sm font-semibold text-white shadow-sm ring-1 ring-inset ring-gray-300 sm:col-start-1 sm:mt-0"
onClick={() => setOpen(false)}
>
Cancel
</button>
</div>

</div>
)
}
Loading

0 comments on commit 445bc7f

Please sign in to comment.