Skip to content

Commit

Permalink
UI improvements (#24)
Browse files Browse the repository at this point in the history
* implemented UI improvements

* Use soroban-cli token wrap subcommand

* have to update xdr Identifier

* Fix bug in account address parsing

* [WIP] trying to get simulate token.approve working

* nonce is a bigint

* Getting approve/deposit flow working

* HACK: use hardcoded key for now until freighter is ready

* minor fix to txn footprint parsing

* remove console.debug

* Created components

* Filling data

* Adjusted transaction behavior

* Update components/molecules/form-pledge/index.tsx

Co-authored-by: Paul Bellamy <[email protected]>

* Update components/organisms/pledge/index.tsx

Co-authored-by: Paul Bellamy <[email protected]>

* Code tweaks and transaction submission fix

* Added target amount

Co-authored-by: Paul Bellamy <[email protected]>
Co-authored-by: Paul Bellamy <[email protected]>
  • Loading branch information
3 people authored Oct 6, 2022
1 parent 82ce643 commit 5d3d39c
Show file tree
Hide file tree
Showing 57 changed files with 7,567 additions and 600 deletions.
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"semi": false,
"singleQuote": true,
"arrowParens": "avoid",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"importOrder": ["react", "<THIRD_PARTY_MODULES>", "components/*", "app/*|config/*|interfaces/*|stories/*", "^[./]"],
"importOrderSeparation": true
}
Binary file added assets/avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions assets/icons/congratulations.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 4 additions & 10 deletions wallet/components/Icons/Dropdown.tsx → assets/icons/dropdown.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions assets/icons/error.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/facebook.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions assets/icons/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import FacebookSvg from './facebook.svg'
import CongratulationsSvg from './congratulations.svg'
import TwitterSvg from './twitter.svg'
import LinkedinSvg from './linkedin.svg'
import LinkSvg from './link.svg'
import OpenSvg from './open.svg'
import DropdownSvg from './dropdown.svg'
import ErrorSvg from './error.svg'
import LoadingSvg from './loading.svg'

export {
FacebookSvg,
CongratulationsSvg,
TwitterSvg,
LinkedinSvg,
LinkSvg,
OpenSvg,
DropdownSvg,
ErrorSvg,
LoadingSvg,
}
3 changes: 3 additions & 0 deletions assets/icons/link.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/linkedin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions assets/icons/loading.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/open.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/twitter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions components/atoms/amount-input/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React, { Dispatch, SetStateAction } from 'react'
import styles from './style.module.css'

export interface InputProps {
placeHolder: string
setAmount: Dispatch<SetStateAction<number | undefined>>
input: string
setInput: Dispatch<SetStateAction<string>>
}

export function AmountInput({ placeHolder, setAmount, input, setInput }: InputProps) {
const handleChange = (event: {
target: { name: string; value: string }
}): void => {
setAmount(parseInt(event.target.value))
setInput(event.target.value)
}

return (
<input
name="amount"
type="number"
placeholder={placeHolder}
className={styles.input}
onChange={handleChange}
value={input}
min={0}
autoComplete="off"
/>
)
}
8 changes: 8 additions & 0 deletions components/atoms/amount-input/style.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.input {
width: 100%;
background: #ffffff;
border: 1px solid #e5e4e7;
border-radius: 8px;
height: 50px;
padding: 16px;
}
24 changes: 24 additions & 0 deletions components/atoms/author-info/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React, { ReactNode } from 'react'
import styles from './style.module.css'
import Image, { StaticImageData } from 'next/image'

export interface AuthorInfoProps {
image: StaticImageData
author: string
dateTime: string
}

export function AuthorInfo({ image, author, dateTime }: AuthorInfoProps) {
return (
<div className={styles.content}>
<Image src={image} width={36} height={36} alt="avatar" />
<div className={styles.author}>
<span>{dateTime}</span>
<br />
<span>
by <b>{author}</b>
</span>
</div>
</div>
)
}
12 changes: 12 additions & 0 deletions components/atoms/author-info/style.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.content {
display: flex;
margin-bottom: 1rem;
font-weight: 500;
font-size: 12px;
opacity: 0.6;
align-items: center;
}

.author {
margin-left: 1rem;
}
18 changes: 18 additions & 0 deletions components/atoms/button/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React, { ReactNode } from 'react'
import { Loading } from '../loading'
import styles from './style.module.css'

export interface ButtonProps {
title: string
onClick: () => void
disabled: boolean
isLoading: boolean
}

export function Button({ title, onClick, disabled, isLoading }: ButtonProps) {
return (
<button className={styles.button} onClick={onClick} disabled={disabled}>
{isLoading ? <Loading size={18} /> : title}
</button>
)
}
21 changes: 21 additions & 0 deletions components/atoms/button/style.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.button {
width: 100%;
display: flex;
padding: 16px 12px;
height: 50px;
background: #3e63dd;
border-radius: 8px;
border: none;
font-weight: 600;
font-size: 16px;
color: #ffffff;
justify-content: center;
align-items: center;
cursor: pointer;
margin-top: 1rem;
}

.button:disabled {
background: #889cde;
cursor: not-allowed;
}
10 changes: 10 additions & 0 deletions components/atoms/card/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React, { ReactNode } from 'react'
import styles from './style.module.css'

export interface CardProps {
children: ReactNode
}

export function Card({ children }: CardProps) {
return <div className={styles.card}>{children}</div>
}
11 changes: 11 additions & 0 deletions components/atoms/card/style.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.card {
margin: 1rem;
padding: 1.5rem;
text-align: left;
border-radius: 12px;
background-color: #ffffff;
height: fit-content;
display: flex;
flex-direction: column;
min-width: 400px;
}
37 changes: 37 additions & 0 deletions components/atoms/checkbox/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React, { Dispatch, ReactNode, SetStateAction } from 'react'
import styles from './style.module.css'

export interface CheckboxProps {
title: string
value: number
isChecked: boolean
setAmount: Dispatch<SetStateAction<number | undefined>>
clearInput: () => void
}

export function Checkbox({
title,
value,
isChecked,
setAmount,
clearInput,
}: CheckboxProps) {
const handleCheckBox = (event: {
target: { checked: any; value: string }
}) => {
clearInput()
setAmount(parseInt(event.target.value))
}

return (
<label className={styles.label}>
<input
type="checkbox"
value={value}
checked={isChecked}
onChange={handleCheckBox}
/>
<span>{title}</span>
</label>
)
}
26 changes: 26 additions & 0 deletions components/atoms/checkbox/style.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.label {
position: relative;
cursor: pointer;
font-weight: 600;
font-size: 12px;
}

.label [type='checkbox'] {
display: none;
}

.label [type='checkbox'] + span {
width: 100%;
display: inline-block;
padding: 1em;
border: 1px solid #e5e4e7;
border-radius: 8px;
text-align: center;
}

.label :checked + span {
display: inline-block;
border: 1px solid #3e63dd;
color: #3e63dd;
border-radius: 8px;
}
25 changes: 25 additions & 0 deletions components/atoms/connect-button/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react'
import { AppContext } from '../../../wallet'
import styles from './style.module.css'

export interface ConnectButtonProps {
label: string
isHigher?: boolean
}

export function ConnectButton({ label, isHigher }: ConnectButtonProps) {
const { connect } = React.useContext(AppContext)
const openConnectModal = async () => {
await connect()
}

return (
<button
className={styles.button}
style={{ height: isHigher ? 50 : 38 }}
onClick={openConnectModal}
>
{label}
</button>
)
}
21 changes: 21 additions & 0 deletions components/atoms/connect-button/style.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.button {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
padding: 16px 12px;
gap: 8px;
background: #1a1523;
border-radius: 8px;
border: 0;
height: 38px;
font-weight: 600;
font-size: 14px;
line-height: 22px;
color: #ffffff;
cursor: pointer;
}

.higher {
height: 58px;
}
8 changes: 8 additions & 0 deletions components/atoms/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export * from './card'
export * from './button'
export * from './amount-input'
export * from './progress-bar'
export * from './checkbox'
export * from './author-info'
export * from './connect-button'
export * from './loading'
18 changes: 18 additions & 0 deletions components/atoms/loading/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react'
import Image from 'next/image'
import { LoadingSvg } from '../../../assets/icons'

export interface SpacerProps {
size: number
}

export function Loading({ size }: SpacerProps) {
return (
<Image
src={LoadingSvg}
width={size}
height={size}
alt="loading..."
/>
)
}
Loading

0 comments on commit 5d3d39c

Please sign in to comment.