Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Commit

Permalink
chore: run prettier fix
Browse files Browse the repository at this point in the history
  • Loading branch information
EjembiEmmanuel committed Oct 27, 2024
1 parent 9d1214f commit e14fdf7
Show file tree
Hide file tree
Showing 21 changed files with 1,686 additions and 1,710 deletions.
123 changes: 61 additions & 62 deletions frontend/src/app/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,70 +1,69 @@
import { useState } from "react";
import { useState } from 'react';
import {
Dialog,
DialogPanel,
DialogTitle,
Transition,
TransitionChild,
} from "@headlessui/react";
import {
BackwardIcon
} from "@heroicons/react/24/outline";
import { BackIcon2 } from "@/assets/icons/icons";
Dialog,
DialogPanel,
DialogTitle,
Transition,
TransitionChild,
} from '@headlessui/react';
import { BackwardIcon } from '@heroicons/react/24/outline';
import { BackIcon2 } from '@/assets/icons/icons';

type ModalProps = {
open: boolean;
close: () => void;
title: string;
children: React.ReactNode;
open: boolean;
close: () => void;
title: string;
children: React.ReactNode;
};

export default function Modal({ open, title, children, close }: ModalProps) {
return (
<Transition show={open}>
<Dialog className="relative z-10" onClose={close}>
<TransitionChild
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<div className="fixed inset-0 bg-black bg-opacity-75 transition-opacity" >
</div>
</TransitionChild>
return (
<Transition show={open}>
<Dialog className="relative z-10" onClose={close}>
<TransitionChild
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<div className="fixed inset-0 bg-black bg-opacity-75 transition-opacity"></div>
</TransitionChild>

<div className="fixed inset-0 z-10 w-screen overflow-y-auto">
<div className="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
<TransitionChild
enter="ease-out duration-300"
enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
enterTo="opacity-100 translate-y-0 sm:scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
>
<DialogPanel className="relative w-full transform overflow-hidden rounded-lg bg-white px-4 pb-4 pt-5 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-6xl sm:p-6">
<div onClick={close} className="w-[38px] cusor-pointer h-[32px] rounded-full flex items-center justify-between px-2 ml-1 bg-primary mt-4 ">
<BackIcon2 />
</div>
<div className="sm:flex sm:items-start">

<div className="mt-3 sm:ml-4 sm:mt-0 sm:text-left">
<DialogTitle
as="h3"
className="text-base font-semibold leading-6 text-gray-900"
>
{title}
</DialogTitle>
<div className="mt-2">{children}</div>
</div>
</div>
</DialogPanel>
</TransitionChild>
</div>
</div>
</Dialog>
</Transition>
);
<div className="fixed inset-0 z-10 w-screen overflow-y-auto">
<div className="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
<TransitionChild
enter="ease-out duration-300"
enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
enterTo="opacity-100 translate-y-0 sm:scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
>
<DialogPanel className="relative w-full transform overflow-hidden rounded-lg bg-white px-4 pb-4 pt-5 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-6xl sm:p-6">
<div
onClick={close}
className="w-[38px] cusor-pointer h-[32px] rounded-full flex items-center justify-between px-2 ml-1 bg-primary mt-4 "
>
<BackIcon2 />
</div>
<div className="sm:flex sm:items-start">
<div className="mt-3 sm:ml-4 sm:mt-0 sm:text-left">
<DialogTitle
as="h3"
className="text-base font-semibold leading-6 text-gray-900"
>
{title}
</DialogTitle>
<div className="mt-2">{children}</div>
</div>
</div>
</DialogPanel>
</TransitionChild>
</div>
</div>
</Dialog>
</Transition>
);
}
60 changes: 30 additions & 30 deletions frontend/src/app/components/Addressbar.tsx
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
"use client";
'use client';
import {
useAccount,
useDisconnect,
useStarkProfile,
} from "@starknet-react/core";
import Image from "next/image";
import { Dispatch, SetStateAction, useEffect, useState } from "react";
import GenericModal from "./GenericModal";
useAccount,
useDisconnect,
useStarkProfile,
} from '@starknet-react/core';
import Image from 'next/image';
import { Dispatch, SetStateAction, useEffect, useState } from 'react';
import GenericModal from './GenericModal';

const AddressBar = ({
setOpenConnectedModal,
setOpenConnectedModal,
}: {
setOpenConnectedModal: Dispatch<SetStateAction<boolean>>;
setOpenConnectedModal: Dispatch<SetStateAction<boolean>>;
}) => {
const { address } = useAccount();
const { data: starkProfile } = useStarkProfile({
address,
});
const { address } = useAccount();
const { data: starkProfile } = useStarkProfile({
address,
});

const toggleModal = () => {
setOpenConnectedModal((prev) => !prev);
};
const toggleModal = () => {
setOpenConnectedModal((prev) => !prev);
};

if (!address) {
return null;
}
if (!address) {
return null;
}

return (
<button
onClick={toggleModal}
className="bg-primary py-2 px-4 text-white rounded-full transition duration-300"
>
<span>
{address?.slice(0, 6).concat("...").concat(address?.slice(-5))}
</span>
</button>
);
return (
<button
onClick={toggleModal}
className="bg-primary py-2 px-4 text-white rounded-full transition duration-300"
>
<span>
{address?.slice(0, 6).concat('...').concat(address?.slice(-5))}
</span>
</button>
);
};

export default AddressBar;
18 changes: 9 additions & 9 deletions frontend/src/app/components/ConnectModal.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Image from "next/image";
import GenericModal from "./GenericModal";
import { Connector, useConnect } from "@starknet-react/core";
import { useEffect, useState } from "react";
import Image from 'next/image';
import GenericModal from './GenericModal';
import { Connector, useConnect } from '@starknet-react/core';
import { useEffect, useState } from 'react';

type Props = {
isOpen: boolean;
Expand All @@ -26,12 +26,12 @@ const Wallet = ({
closeModal: (e: React.MouseEvent<HTMLButtonElement>) => void;
}) => {
const { connect } = useConnect();
const isSvg = src?.startsWith("<svg");
const isSvg = src?.startsWith('<svg');

function handleConnectWallet(e: React.MouseEvent<HTMLButtonElement>): void {
connect({ connector });
closeModal(e);
localStorage.setItem("lastUsedConnector", connector.name);
localStorage.setItem('lastUsedConnector', connector.name);
}

return (
Expand All @@ -44,7 +44,7 @@ const Wallet = ({
<div
className="h-full w-full object-cover rounded-[5px]"
dangerouslySetInnerHTML={{
__html: src ?? "",
__html: src ?? '',
}}
/>
) : (
Expand Down Expand Up @@ -144,7 +144,7 @@ const ConnectModal = ({ isOpen, onClose }: Props) => {
alt="text"
loader={loader}
src={
"https://media.istockphoto.com/id/1084096262/vector/concept-of-mobile-payments-wallet-connected-with-mobile-phone.jpg?s=612x612&w=0&k=20&c=noILf6rTUyxN41JnmeFhUmqQWiCWoXlg0zCLtcrabD4="
'https://media.istockphoto.com/id/1084096262/vector/concept-of-mobile-payments-wallet-connected-with-mobile-phone.jpg?s=612x612&w=0&k=20&c=noILf6rTUyxN41JnmeFhUmqQWiCWoXlg0zCLtcrabD4='
}
width={100}
height={100}
Expand All @@ -167,7 +167,7 @@ const ConnectModal = ({ isOpen, onClose }: Props) => {
alt="text"
loader={loader}
src={
"https://media.licdn.com/dms/image/D4E12AQFyWdLwXcJu3Q/article-cover_image-shrink_720_1280/0/1687854784940?e=2147483647&v=beta&t=nNDH-9XEcVYcb1PAc3S78ndQze0126KPOSZmnmMERNg"
'https://media.licdn.com/dms/image/D4E12AQFyWdLwXcJu3Q/article-cover_image-shrink_720_1280/0/1687854784940?e=2147483647&v=beta&t=nNDH-9XEcVYcb1PAc3S78ndQze0126KPOSZmnmMERNg'
}
width={100}
height={100}
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/app/components/GenericModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"use client";
'use client';
const GenericModal = ({
isOpen,
onClose,
Expand All @@ -20,15 +20,15 @@ const GenericModal = ({
<section
onClick={onClose}
className={`fixed h-screen w-screen grid top-0 left-0 z-[99] backdrop-blur ${
position ? position : "justify-center items-center"
} ${!isOpen ? "hidden" : ""}`}
position ? position : 'justify-center items-center'
} ${!isOpen ? 'hidden' : ''}`}
>
<div
onClick={(e) => e.stopPropagation()}
className={`bg-[#1c1b1f] rounded-[25px] flex flex-col border-[1px] border-solid border-outline-grey transition-[opacity,transform] duration-500 ease-in-out ${
animate
? "translate-y-0 opacity-100"
: "translate-y-full opacity-0"
? 'translate-y-0 opacity-100'
: 'translate-y-full opacity-0'
} ${className}`}
>
{children}
Expand Down
Loading

0 comments on commit e14fdf7

Please sign in to comment.