Skip to content

Commit

Permalink
feat(launchpad): Add Collection Creation form front
Browse files Browse the repository at this point in the history
  • Loading branch information
WaDadidou committed Jan 7, 2025
1 parent cf36eef commit 6ca68e0
Show file tree
Hide file tree
Showing 41 changed files with 4,422 additions and 87 deletions.
3 changes: 3 additions & 0 deletions assets/icons/cross.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
"graphql-request": "^5",
"html-to-draftjs": "^1.5.0",
"immutable": "^4.0.0",
"keccak256": "^1.0.6",
"kubernetes-models": "^4.3.1",
"leaflet": "^1.9.4",
"leaflet.markercluster": "^1.5.3",
Expand Down
78 changes: 78 additions & 0 deletions packages/components/FilePreview/SelectedFilesPreview/ItemView.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { FC } from "react";
import { TouchableOpacity, Image, StyleProp, ViewStyle } from "react-native";

import { BrandText } from "../../BrandText";
import { PrimaryBox } from "../../boxes/PrimaryBox";

import { neutral77, secondaryColor } from "@/utils/style/colors";
import { fontSemibold11, fontSemibold13 } from "@/utils/style/fonts";
import { layout } from "@/utils/style/layout";

export const itemSize = 120;
export const ItemView: FC<{
label: string;
subLabel?: string;
uri: string;
onPress: () => void;
style?: StyleProp<ViewStyle>;
}> = ({ label, subLabel, uri, onPress, style }) => {
return (
<TouchableOpacity
style={[
{
height: itemSize,
width: itemSize,
justifyContent: "flex-end",
alignItems: "center",
marginHorizontal: layout.spacing_x1,
},
style,
]}
onPress={onPress}
>
<PrimaryBox
style={{
height: itemSize,
width: itemSize,
}}
>
<Image
source={{ uri }}
style={{
height: itemSize - 2,
width: itemSize - 2,
borderRadius: 8,
}}
/>
</PrimaryBox>

<PrimaryBox
style={{
paddingHorizontal: layout.spacing_x1,
paddingVertical: layout.spacing_x0_5,
width: itemSize - 10,
bottom: -20,
alignItems: "center",
justifyContent: "center",
position: "absolute",
}}
>
<BrandText
style={[fontSemibold13, { color: secondaryColor }]}
numberOfLines={1}
>
{label}
</BrandText>
{subLabel && (
<BrandText
style={[fontSemibold11, { color: neutral77 }]}
numberOfLines={1}
ellipsizeMode="middle"
>
{subLabel}
</BrandText>
)}
</PrimaryBox>
</TouchableOpacity>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { FC } from "react";
import { View } from "react-native";

import { itemSize, ItemView } from "./ItemView";
import { BrandText } from "../../BrandText";
import { PrimaryBox } from "../../boxes/PrimaryBox";

import { DeleteButton } from "@/components/FilePreview/DeleteButton";
import { GridList } from "@/components/layout/GridList";
import { neutral33, neutral55 } from "@/utils/style/colors";
import { fontSemibold20 } from "@/utils/style/fonts";
import { layout } from "@/utils/style/layout";
import { LocalFileData } from "@/utils/types/files";

export const SelectedFilesPreview: FC<{
files: LocalFileData[];
onPressItem: (file: LocalFileData, itemIndex: number) => void;
onPressDeleteItem: (itemIndex: number) => void;
}> = ({ files, onPressItem, onPressDeleteItem }) => {
return (
<View
style={{
justifyContent: "flex-end",
height: "100%",
}}
>
{files.length ? (
<GridList<LocalFileData>
data={files}
keyExtractor={(item) => item.url}
renderItem={({ item, index }, elemWidth) => (
<View
style={{
height: itemSize + 6, // +6 to show DeleteButton
justifyContent: "flex-end",
}}
>
<DeleteButton
onPress={() => onPressDeleteItem(index)}
style={{ top: 0, right: 0 }}
/>
<ItemView
uri={URL.createObjectURL(item.file)}
label={`#${index + 1}`}
subLabel={item.file.name}
onPress={() => {
onPressItem(item, index);
}}
style={{ width: elemWidth }}
/>
</View>
)}
minElemWidth={itemSize}
gap={layout.spacing_x2_5}
noFixedHeight
/>
) : (
<PrimaryBox
style={{
height: 267,
width: "100%",
justifyContent: "center",
alignItems: "center",
borderColor: neutral33,
}}
>
<BrandText style={[fontSemibold20, { color: neutral55 }]}>
Selected files preview
</BrandText>
</PrimaryBox>
)}
</View>
);
};
127 changes: 127 additions & 0 deletions packages/components/NetworkSelector/NetworkSelectorWithLabel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
import { FC, useState } from "react";
import { StyleProp, View, ViewStyle } from "react-native";

import { NetworkSelectorMenu } from "./NetworkSelectorMenu";
import { BrandText } from "../BrandText";
import { SVG } from "../SVG";
import { TertiaryBox } from "../boxes/TertiaryBox";
import { Label } from "../inputs/TextInputCustom";

import chevronDownSVG from "@/assets/icons/chevron-down.svg";
import chevronUpSVG from "@/assets/icons/chevron-up.svg";
import { NetworkIcon } from "@/components/NetworkIcon";
import { CustomPressable } from "@/components/buttons/CustomPressable";
import { SpacerRow } from "@/components/spacer";
import { useDropdowns } from "@/hooks/useDropdowns";
import { useSelectedNetworkInfo } from "@/hooks/useSelectedNetwork";
import { NetworkFeature, NetworkKind } from "@/networks";
import { neutral17, neutral77, secondaryColor } from "@/utils/style/colors";
import { fontSemibold14 } from "@/utils/style/fonts";
import { layout } from "@/utils/style/layout";

export const NetworkSelectorWithLabel: FC<{
label: string;
style?: StyleProp<ViewStyle>;
forceNetworkId?: string;
forceNetworkKind?: NetworkKind;
forceNetworkFeatures?: NetworkFeature[];
}> = ({
style,
forceNetworkId,
forceNetworkKind,
forceNetworkFeatures,
label,
}) => {
const [isDropdownOpen, setDropdownState, ref] = useDropdowns();
const [hovered, setHovered] = useState(false);
const selectedNetworkInfo = useSelectedNetworkInfo();

return (
<View
style={[
style,
{
width: "100%",
zIndex: 100,
},
]}
ref={ref}
>
<CustomPressable
onHoverIn={() => setHovered(true)}
onHoverOut={() => setHovered(false)}
onPress={() => setDropdownState(!isDropdownOpen)}
>
<Label style={{ marginBottom: layout.spacing_x1_5 }} hovered={hovered}>
{label}
</Label>

<TertiaryBox
style={[
{
width: "100%",
height: 40,
flexDirection: "row",
paddingHorizontal: 12,
backgroundColor: neutral17,
alignItems: "center",
},
hovered && { borderColor: secondaryColor },
]}
>
<View
style={{
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
flex: 1,
}}
>
<View
style={{
flexDirection: "row",
alignItems: "center",
}}
>
<NetworkIcon
networkId={selectedNetworkInfo?.id || ""}
size={16}
/>
<SpacerRow size={1} />

<BrandText
style={[
fontSemibold14,
{
marginRight: layout.spacing_x1,
color: selectedNetworkInfo ? secondaryColor : neutral77,
},
]}
>
{selectedNetworkInfo?.displayName}
</BrandText>
</View>

<SVG
source={isDropdownOpen ? chevronUpSVG : chevronDownSVG}
width={16}
height={16}
color={secondaryColor}
/>
</View>
</TertiaryBox>

{isDropdownOpen && (
<NetworkSelectorMenu
onSelect={() => {}}
optionsMenuwidth={416}
style={{ width: "100%", marginTop: layout.spacing_x0_75 }}
forceNetworkId={forceNetworkId}
forceNetworkKind={forceNetworkKind}
forceNetworkFeatures={forceNetworkFeatures}
/>
)}
</CustomPressable>
</View>
);
};
11 changes: 10 additions & 1 deletion packages/components/navigation/getNormalModeScreens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ import { GuardiansScreen } from "@/screens/Guardians/GuardiansScreen";
import { HashtagFeedScreen } from "@/screens/HashtagFeed/HashtagFeedScreen";
import { HomeScreen } from "@/screens/Home/HomeScreen";
import { LaunchpadApplyScreen } from "@/screens/Launchpad/LaunchpadApply/LaunchpadApplyScreen";
import { LaunchpadCreateScreen } from "@/screens/Launchpad/LaunchpadApply/LaunchpadCreate/LaunchpadCreateScreen";
import { LaunchpadScreen } from "@/screens/Launchpad/LaunchpadHome/LaunchpadScreen";
import { MintCollectionScreen } from "@/screens/Launchpad/MintCollectionScreen";
import { MintCollectionScreen } from "@/screens/Launchpad/LaunchpadHome/MintCollectionScreen";
import { LaunchpadERC20CreateSaleScreen } from "@/screens/LaunchpadERC20/LaunchpadERC20Sales/LaunchpadERC20CreateSaleScreen";
import { LaunchpadERC20SalesScreen } from "@/screens/LaunchpadERC20/LaunchpadERC20Sales/LaunchpadERC20SalesScreen";
import { LaunchpadERC20Screen } from "@/screens/LaunchpadERC20/LaunchpadERC20Screen";
Expand Down Expand Up @@ -229,6 +230,14 @@ export const getNormalModeScreens = ({
title: screenTitle("Launchpad (Apply)"),
}}
/>
<Nav.Screen
name="LaunchpadCreate"
component={LaunchpadCreateScreen}
options={{
header: () => null,
title: screenTitle("Create Collection"),
}}
/>

<Nav.Screen
name="MintCollection"
Expand Down
Loading

0 comments on commit 6ca68e0

Please sign in to comment.