Skip to content

Commit

Permalink
style : style sign transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
wseungjin committed Apr 23, 2021
1 parent 235f5b1 commit 121ef3e
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 76 deletions.
125 changes: 58 additions & 67 deletions packages/mobile/src/modals/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,17 @@ import {
} from "@keplr-wallet/hooks";
import { Button, Input, Text } from "react-native-elements";
import {
bgcWhite,
flexDirectionRow,
justifyContentEnd,
m0,
pt4,
pb6,
px4,
sf,
h4,
alignItemsCenter,
justifyContentBetween,
fAlignCenter,
my3,
} from "../styles";
import { DefaultButton, WhiteButton } from "../components/buttons";
import { TransactionDetails } from "./transaction-details";
import { Page } from "../components/page";

export const ModalsRenderer: FunctionComponent = observer(() => {
const {
Expand Down Expand Up @@ -81,72 +77,67 @@ export const ModalsRenderer: FunctionComponent = observer(() => {
isVisible={interactionModalStore.lastUrl != null}
style={sf([justifyContentEnd, m0])}
>
<View
style={sf([
{ height: 600 },
bgcWhite,
px4,
pt4,
pb6,
justifyContentBetween,
])}
>
{interactionModalStore.lastUrl === "/unlock" ? (
<React.Fragment>
<Text style={sf([h4, fAlignCenter])}>Unlock</Text>
<Input
label="Password"
autoCompleteType="password"
secureTextEntry={true}
value={password}
onChangeText={setPassword}
/>
<Button
title="Unlock"
onPress={async () => {
await keyRingStore.unlock(password);
interactionModalStore.popUrl();
}}
/>
</React.Fragment>
) : null}
{interactionModalStore.lastUrl === "/sign" ? (
<React.Fragment>
<Text style={sf([h4, fAlignCenter])}>Confirm Transaction</Text>
{/* <ScrollView>
<Text>
{JSON.stringify(signDocHelper.signDocJson, null, 2)}
</Text>
</ScrollView> */}
<TransactionDetails
signDocHelper={signDocHelper}
memoConfig={memoConfig}
feeConfig={feeConfig}
gasConfig={gasConfig}
/>
<View style={flexDirectionRow}>
<WhiteButton
title="Reject"
color="error"
onPress={async () => {
await signInteractionStore.reject();
interactionModalStore.popUrl();
}}
<View style={{ height: 600 }}>
<Page>
{interactionModalStore.lastUrl === "/unlock" ? (
<React.Fragment>
<Text style={sf([h4, fAlignCenter, my3])}>Unlock</Text>
<Input
label="Password"
autoCompleteType="password"
secureTextEntry={true}
value={password}
onChangeText={setPassword}
/>
<DefaultButton
title="Approve"
<Button
title="Unlock"
onPress={async () => {
if (signDocHelper.signDocWrapper) {
await signInteractionStore.approveAndWaitEnd(
signDocHelper.signDocWrapper
);
}
await keyRingStore.unlock(password);
interactionModalStore.popUrl();
}}
/>
</View>
</React.Fragment>
) : null}
</React.Fragment>
) : null}
{interactionModalStore.lastUrl === "/sign" ? (
<React.Fragment>
<Text style={sf([h4, fAlignCenter, my3])}>
Confirm Transaction
</Text>
{/* <ScrollView>
<Text>
{JSON.stringify(signDocHelper.signDocJson, null, 2)}
</Text>
</ScrollView> */}
<TransactionDetails
signDocHelper={signDocHelper}
memoConfig={memoConfig}
feeConfig={feeConfig}
gasConfig={gasConfig}
/>
<View style={flexDirectionRow}>
<WhiteButton
title="Reject"
color="error"
onPress={async () => {
await signInteractionStore.reject();
interactionModalStore.popUrl();
}}
/>
<DefaultButton
title="Approve"
onPress={async () => {
if (signDocHelper.signDocWrapper) {
await signInteractionStore.approveAndWaitEnd(
signDocHelper.signDocWrapper
);
}
interactionModalStore.popUrl();
}}
/>
</View>
</React.Fragment>
) : null}
</Page>
</View>
</Modal>
</React.Fragment>
Expand Down
29 changes: 20 additions & 9 deletions packages/mobile/src/modals/transaction-details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,19 @@ import {
body3,
flex1,
flexDirectionRow,
h3,
sf,
h6,
mb3,
p3,
subtitle1,
subtitle2,
mb2,
cardStyle,
fcGrey1,
justifyContentAround,
bbw1,
bcGray,
px2,
} from "../styles";
import Icon from "react-native-vector-icons/Feather";

Expand Down Expand Up @@ -85,15 +93,18 @@ export const TransactionDetails: FunctionComponent<{

return (
<React.Fragment>
<ScrollView>{renderedMsgs}</ScrollView>
<View>
<Text style={subtitle2}>Memo</Text>
<Text style={sf([subtitle2, mb2])}>Messages</Text>
<ScrollView style={sf([cardStyle, px2, mb2])}>
{renderedMsgs}
</ScrollView>
<View style={mb3}>
<Text style={sf([subtitle2, mb2])}>Memo</Text>
<Text style={subtitle1}>
{memoConfig.memo ? memoConfig.memo : "(No memo)"}
</Text>
</View>
<View>
<Text style={subtitle2}>Fee</Text>
<View style={mb3}>
<Text style={sf([subtitle2, mb2])}>Fee</Text>
<Text style={subtitle1}>
{feeConfig.fee.maxDecimals(6).trim(true).toString()}
</Text>
Expand All @@ -109,13 +120,13 @@ const Msg: FunctionComponent<{
content: string;
}> = ({ icon = "question", title, content }) => {
return (
<View style={flexDirectionRow}>
<View style={sf([flexDirectionRow, bbw1, bcGray])}>
<View style={p3}>
<Icon name={icon} size={18} />
</View>
<View style={flex1}>
<View style={sf([flex1, justifyContentAround])}>
<Text style={h6}>{title}</Text>
<Text style={body3}>{content}</Text>
<Text style={sf([body3, fcGrey1])}>{content}</Text>
</View>
</View>
);
Expand Down
4 changes: 4 additions & 0 deletions packages/mobile/src/styles/flex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export const justifyContentBetween: StyleProp<ViewStyle> = {
justifyContent: "space-between",
};

export const justifyContentAround: StyleProp<ViewStyle> = {
justifyContent: "space-around",
};

export const justifyContentEnd: StyleProp<ViewStyle> = {
justifyContent: "flex-end",
};
Expand Down

0 comments on commit 121ef3e

Please sign in to comment.