-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from massalabs/refacto
Fix ui issues and refactor
- Loading branch information
Showing
38 changed files
with
1,452 additions
and
1,129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import useToken from '@/hooks/useToken'; | ||
import { ScheduleInfo } from '@/store/scheduler'; | ||
import { commonButton } from '@/styles/buttons'; | ||
import { Button, formatAmount } from '@massalabs/react-ui-kit'; | ||
|
||
export function AllowanceButton({ | ||
scheduleInfo, | ||
disabled, | ||
}: { | ||
scheduleInfo: ScheduleInfo; | ||
disabled: boolean; | ||
}) { | ||
const { increaseAllowance } = useToken(); | ||
|
||
if (disabled) { | ||
return; | ||
} | ||
|
||
return ( | ||
<Button | ||
variant="secondary" | ||
onClick={() => | ||
increaseAllowance(scheduleInfo.amount * scheduleInfo.occurrences) | ||
} | ||
customClass={['border-primary text-primary ', ...commonButton].join(' ')} | ||
> | ||
{`Allow spending ${ | ||
formatAmount( | ||
scheduleInfo.amount * scheduleInfo.occurrences, | ||
scheduleInfo.asset.decimals, | ||
).preview | ||
} ${scheduleInfo.asset.name}`} | ||
</Button> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export function ArrowButton({ onClick }: { onClick: () => void }) { | ||
return ( | ||
<button | ||
className="p-2 rounded-full bg-white hover:bg-gray-200 | ||
text-primary hover:ring-1 ring-primary transition-all | ||
duration-100 ease-in-out active:translate-y-1" | ||
onClick={onClick} | ||
> | ||
↓ | ||
</button> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import useSchedule from '@/hooks/useSchedule'; | ||
import { commonButton } from '@/styles/buttons'; | ||
import { Button, toast } from '@massalabs/react-ui-kit'; | ||
|
||
export function CreateScheduleButton({ disabled }: { disabled: boolean }) { | ||
const { createSchedule } = useSchedule(); | ||
|
||
const handleCreateSchedule = async () => { | ||
try { | ||
createSchedule(); | ||
} catch (error) { | ||
console.error(error); | ||
toast.error('Failed to create schedule'); | ||
} | ||
}; | ||
|
||
return ( | ||
<Button | ||
customClass={`bg-primary text-white ${commonButton}`} | ||
onClick={handleCreateSchedule} | ||
disabled={disabled} | ||
variant="secondary" | ||
> | ||
Create Schedule | ||
</Button> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React from 'react'; | ||
|
||
import { Tooltip } from '@massalabs/react-ui-kit'; | ||
import { FiInfo } from 'react-icons/fi'; | ||
|
||
interface ModeRadioButtonProps { | ||
isVesting: boolean; | ||
handleModeChange: (e: React.ChangeEvent<HTMLInputElement>) => void; | ||
mode: string; | ||
modeDesc: string; | ||
disabled?: boolean; | ||
} | ||
|
||
const ModeRadioButton: React.FC<ModeRadioButtonProps> = ({ | ||
isVesting, | ||
handleModeChange, | ||
mode, | ||
modeDesc, | ||
disabled, | ||
}) => { | ||
return ( | ||
<label className="flex items-center gap-2"> | ||
<input | ||
disabled={disabled} | ||
type="radio" | ||
value={mode} | ||
className="w-4 h-4 text-primary bg-gray-100 border-gray-300 | ||
focus:ring-primary dark:focus:ring-primary | ||
dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 | ||
dark:border-gray-600 disabled:bg-gray-200 disabled:cursor-not-allowed disabled:opacity-50" | ||
checked={isVesting} | ||
onChange={handleModeChange} | ||
/> | ||
<p className="text-sm text-gray-700">{mode}</p> | ||
<Tooltip customClass="py-2" body={modeDesc}> | ||
<FiInfo className="mr-1" size={12} /> | ||
</Tooltip> | ||
</label> | ||
); | ||
}; | ||
|
||
export default ModeRadioButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { ConnectButton } from './ConnectWalletPopup'; | ||
import LogoSyntra from '../assets/logo-syntra.svg'; | ||
import { useNetworkStore } from '@/store/network'; | ||
|
||
export function NavBar() { | ||
const { network } = useNetworkStore(); | ||
return ( | ||
<nav className="flex justify-between items-center px-10 py-5 w-full"> | ||
<div className="flex flex-col"> | ||
<img src={LogoSyntra} alt="Syntra" className="w-40 h-14" /> | ||
<p className="font-caveat text-white self-end -m-5 first-letter:uppercase"> | ||
{network} | ||
</p> | ||
</div> | ||
<ConnectButton /> | ||
</nav> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.