Skip to content

Commit

Permalink
feat: show map modal before send post
Browse files Browse the repository at this point in the history
  • Loading branch information
thomarnauld authored and VishalRakholiya-iView committed Feb 26, 2024
1 parent cb267e3 commit d2874f4
Show file tree
Hide file tree
Showing 13 changed files with 1,534 additions and 1,374 deletions.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"@reduxjs/toolkit": "^1.8.3",
"@solana/web3.js": "^1.87.6",
"@tanstack/react-query": "^4.12.0",
"@types/leaflet": "^1.9.8",
"assert": "^2.1.0",
"axios": "^1.6.2",
"bech32": "^2.0.0",
Expand Down Expand Up @@ -99,6 +100,7 @@
"html-to-draftjs": "^1.5.0",
"immutable": "^4.0.0",
"kubernetes-models": "^4.3.1",
"leaflet": "^1.9.4",
"listr2": "^8.0.1",
"lodash": "^4.17.21",
"long": "^5.2.1",
Expand All @@ -112,6 +114,7 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hook-form": "^7.50.1",
"react-leaflet": "^4.2.1",
"react-native": "0.73.4",
"react-native-click-outside": "^0.1.1",
"react-native-confetti-cannon": "^1.5.2",
Expand All @@ -123,6 +126,7 @@
"react-native-heroicons": "^3.2.0",
"react-native-image-picker": "^7.1.0",
"react-native-keyboard-aware-scrollview": "^2.1.0",
"react-native-leaflet-view": "^0.1.2",
"react-native-paper": "^4.12.5",
"react-native-pell-rich-editor": "^1.8.8",
"react-native-pie-chart": "^3.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const NetworkSelectorMenu: FC<{
mainContainerStyle={[
{
paddingHorizontal: layout.spacing_x2,
paddingTop: layout.spacing_x2,
paddingVertical: layout.spacing_x2,
backgroundColor: neutral17,
alignItems: "flex-start",
},
Expand Down
1 change: 1 addition & 0 deletions packages/components/boxes/Box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export type BoxStyle = Pick<
| "top"
| "bottom"
| "flex"
| "zIndex"
> & { borderRadius?: number; backgroundColor?: string; borderColor?: string };

export type GradientParams = Omit<LinearGradientProps, keyof ViewProps>;
Expand Down
2 changes: 2 additions & 0 deletions packages/components/boxes/TertiaryBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export const TertiaryBox: React.FC<{
{
borderWidth: 1,
borderColor: neutral33,
justifyContent: "center",
alignItems: "center",
},
style,
]}
Expand Down
148 changes: 78 additions & 70 deletions packages/components/modals/ModalBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ import { useAppNavigation } from "@/hooks/navigation/useAppNavigation";

// TODO: Simplify this component (Useless childrenBottom ?. Better to let the parent totally decides which children to use ? Used in WalletManager.tsx, be careful !)

type ModalBaseProps = {
export type ModalBaseProps = {
label?: string;
labelComponent?: ReactNode;
onClose?: () => void;
onBackPress?: () => void;
width?: number;
visible?: boolean;
Header?: ComponentType;
hideHeader?: boolean;
childrenBottom?: JSX.Element | JSX.Element[];
hideMainSeparator?: boolean;
description?: string;
Expand Down Expand Up @@ -78,6 +79,7 @@ const ModalBase: React.FC<ModalBaseProps> = ({
childrenBottom,
children,
Header,
hideHeader = false,
hideMainSeparator,
description,
scrollable,
Expand Down Expand Up @@ -160,81 +162,87 @@ const ModalBase: React.FC<ModalBaseProps> = ({
]}
>
{/*------ Modal header */}
<View
style={{
flexDirection: "row",
justifyContent: "space-between",
width: "100%",
paddingHorizontal: modalMarginPadding,
paddingVertical: layout.spacing_x2,
}}
>
{!!(label || labelComponent || description) && (
<View
style={{ flex: 1, flexDirection: "row", alignItems: "center" }}
>
{onBackPress && (
<TouchableOpacity
activeOpacity={0.9}
style={{
height: 32,
width: 32,
backgroundColor: neutral22,
borderRadius: 20,
alignItems: "center",
justifyContent: "center",
marginRight: 12,
}}
onPress={onBackPress}
>
<SVG source={chevronLeft} height={12} width={12} />
</TouchableOpacity>
)}

<View style={{ flex: 1, width: "100%" }}>
{!!label && (
<BrandText style={{ color: "white", lineHeight: 24 }}>
{label}
</BrandText>
{!hideHeader && (
<View
style={{
flexDirection: "row",
justifyContent: "space-between",
width: "100%",
paddingHorizontal: modalMarginPadding,
paddingVertical: layout.spacing_x1_5,
}}
>
{(label || labelComponent || description) && (
<View
style={{
flex: 1,
flexDirection: "row",
alignItems: "center",
}}
>
{onBackPress && (
<TouchableOpacity
activeOpacity={0.9}
style={{
height: 32,
width: 32,
backgroundColor: neutral22,
borderRadius: 20,
alignItems: "center",
justifyContent: "center",
marginRight: 12,
}}
onPress={onBackPress}
>
<SVG source={chevronLeft} height={12} width={12} />
</TouchableOpacity>
)}

{labelComponent}

{!!description && (
<>
<SpacerColumn size={1} />
<BrandText
style={[
fontSemibold14,
{
color: neutral77,
width: "100%",
lineHeight: 20,
flexWrap: "wrap",
},
]}
>
{description}
<View style={{ flex: 1, width: "100%" }}>
{!!label && (
<BrandText style={{ color: "white", lineHeight: 24 }}>
{label}
</BrandText>
</>
)}
)}

{labelComponent}

{!!description && (
<>
<SpacerColumn size={1} />
<BrandText
style={[
fontSemibold14,
{
color: neutral77,
width: "100%",
lineHeight: 20,
flexWrap: "wrap",
},
]}
>
{description}
</BrandText>
</>
)}
</View>
</View>
</View>
)}
)}

{!!Header && <Header />}
{!!Header && <Header />}

<TouchableOpacity
containerStyle={[
{ marginLeft: modalMarginPadding },
closeButtonStyle,
]}
style={{ justifyContent: "center" }}
onPress={onClose}
>
<SVG width={32} height={32} source={closeSVG} />
</TouchableOpacity>
</View>
<TouchableOpacity
containerStyle={[
{ marginLeft: modalMarginPadding },
closeButtonStyle,
]}
style={{ justifyContent: "center" }}
onPress={onClose}
>
<SVG width={32} height={32} source={closeSVG} />
</TouchableOpacity>
</View>
)}
{!!children && (
<View
style={[
Expand Down
9 changes: 9 additions & 0 deletions packages/components/modals/ModalWithoutHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from "react";

import ModalBase, { ModalBaseProps } from "./ModalBase";

interface ModalWithoutHeaderProps extends ModalBaseProps {}

export const ModalWithoutHeader: React.FC<ModalWithoutHeaderProps> = ({
...props
}) => <ModalBase hideHeader {...props} />;
Loading

0 comments on commit d2874f4

Please sign in to comment.