Skip to content

Commit

Permalink
fix: refacto launchpad ready collections table
Browse files Browse the repository at this point in the history
  • Loading branch information
WaDadidou committed Jun 29, 2024
1 parent afcd659 commit 75444bc
Show file tree
Hide file tree
Showing 4 changed files with 229 additions and 182 deletions.
4 changes: 2 additions & 2 deletions packages/components/navigation/getNormalModeScreens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { LaunchpadApplyScreen } from "@/screens/Launchpad/LaunchpadApplyScreen";
import { LaunchpadCompleteScreen } from "@/screens/Launchpad/LaunchpadCompleteScreen";
import { LaunchpadCreateScreen } from "@/screens/Launchpad/LaunchpadCreate/LaunchpadCreateScreen";
import { LaunchpadMyCollectionsScreen } from "@/screens/Launchpad/LaunchpadMyCollectionsScreen";
import { LaunchpadReadyApplicationsScreen } from "@/screens/Launchpad/LaunchpadReadyApplications/LaunchpadReadyApplicationsScreen";
import { LaunchpadReadyCollectionsScreen } from "@/screens/Launchpad/LaunchpadReadyApplications/LaunchpadReadyCollectionsScreen";
import { LaunchpadScreen } from "@/screens/Launchpad/LaunchpadScreen";
import { MintCollectionScreen } from "@/screens/Launchpad/MintCollectionScreen";
import { CollectionScreen } from "@/screens/Marketplace/CollectionScreen";
Expand Down Expand Up @@ -259,7 +259,7 @@ export const getNormalModeScreens = ({ appMode }: { appMode: AppMode }) => {
/>
<Nav.Screen
name="LaunchpadReadyApplications"
component={LaunchpadReadyApplicationsScreen}
component={LaunchpadReadyCollectionsScreen}
options={{
header: () => null,
title: screenTitle("Launchpad Ready Applications"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
import React, { useState } from "react";
import { View } from "react-native";

import { ReadyLaunchApplicationsTable } from "./component/ReadyLaunchApplicationsTable";

import { BrandText } from "@/components/BrandText";
import { ScreenContainer } from "@/components/ScreenContainer";
import { HighVolSortButton } from "@/components/sorts/HighVolSortButton";
import { Tabs } from "@/components/tabs/Tabs";
import { useAppNavigation } from "@/hooks/navigation/useAppNavigation";
import { useIsMobile } from "@/hooks/useIsMobile";
import { NetworkFeature } from "@/networks";
import { LaunchpadReadyCollectionsTable } from "@/screens/Launchpad/LaunchpadReadyApplications/component/LaunchpadReadyCollectionsTable";
import { neutral33 } from "@/utils/style/colors";
import { fontSemibold20, fontSemibold28 } from "@/utils/style/fonts";
import { layout } from "@/utils/style/layout";
import {} from "@/screens/Launchpad/LaunchpadAdministrationDashboard/LaunchpadAdministrationDashboardScreen";

type TabsListType = "readyForListing" | "waitingForApproval";

const dummyData = {
rank: 1,
collectionNameData: "The R!ot",
collectionNetwork: "teritori",
projectReadinessForMint: "Complete and ready to mint",
whitelistQuantity: "0",
premiumMarketingPackage: "No",
basicMarketingPackage: "Yes",
};
export interface DummyLaunchpadReadyCollection {
id: number;
rank: number;
collectionNameData: string;
collectionNetwork: string;
projectReadinessForMint: string;
whitelistQuantity: string;
premiumMarketingPackage: string;
basicMarketingPackage: string;
}

export const LaunchpadReadyApplicationsScreen: React.FC = () => {
export const LaunchpadReadyCollectionsScreen: React.FC = () => {
const navigation = useAppNavigation();
const isMobile = useIsMobile();

Expand All @@ -41,6 +42,19 @@ export const LaunchpadReadyApplicationsScreen: React.FC = () => {
},
};

const dummyData: DummyLaunchpadReadyCollection[] = Array(25)
.fill({
id: 0,
rank: 0,
collectionNameData: "The R!ot",
collectionNetwork: "teritori",
projectReadinessForMint: "Complete and ready to mint",
whitelistQuantity: "0",
premiumMarketingPackage: "No",
basicMarketingPackage: "Yes",
})
.map((item, index) => ({ ...item, id: index + 1, rank: index + 1 }));

const [selectedTab, setSelectedTab] =
useState<TabsListType>("readyForListing");

Expand Down Expand Up @@ -108,7 +122,7 @@ export const LaunchpadReadyApplicationsScreen: React.FC = () => {
marginTop: layout.spacing_x4,
}}
>
<ReadyLaunchApplicationsTable rows={Array(25).fill(dummyData)} />
<LaunchpadReadyCollectionsTable rows={dummyData} />
</View>
</View>
</ScreenContainer>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
import React from "react";
import { FlatList, View } from "react-native";

import { CellBadgeRow } from "./CellBadgeRow";

import defaultCollectionImagePNG from "@/assets/default-images/ava.png";
import checkBadgeSVG from "@/assets/icons/certified.svg";
import solanaCircleSVG from "@/assets/icons/networks/solana-circle.svg";
import { SVG } from "@/components/SVG";
import { RoundedGradientImage } from "@/components/images/RoundedGradientImage";
import { SpacerColumn } from "@/components/spacer";
import { TableCell } from "@/components/table/TableCell";
import { TableHeader } from "@/components/table/TableHeader";
import { TableRow } from "@/components/table/TableRow";
import { CellBrandText, TableTextCell } from "@/components/table/TableTextCell";
import { TableWrapper } from "@/components/table/TableWrapper";
import { TableColumns } from "@/components/table/utils";
import { DummyLaunchpadReadyCollection } from "@/screens/Launchpad/LaunchpadReadyApplications/LaunchpadReadyCollectionsScreen";
import { layout, screenContentMaxWidthLarge } from "@/utils/style/layout";

const columns: TableColumns = {
rank: {
label: "#",
minWidth: 20,
flex: 0.25,
},
collectionNameData: {
label: "Collection Name",
minWidth: 260,
flex: 3,
},
collectionNetwork: {
label: "Collection Network",
minWidth: 160,
flex: 1.8,
},
projectReadinessForMint: {
label: "Project Readiness for Mint",
minWidth: 200,
flex: 2,
},
whitelistQuantity: {
label: "Whitelist quantity",
minWidth: 100,
flex: 1,
},
premiumMarketingPackage: {
label: "Premium marketing package",
minWidth: 160,
flex: 1.8,
},
basicMarketingPackage: {
label: "Basic marketing package",
minWidth: 140,
flex: 1.2,
},
};

const breakpointM = 1120;

export const LaunchpadReadyCollectionsTable: React.FC<{
rows: DummyLaunchpadReadyCollection[]; //TODO: Type this
}> = ({ rows }) => {
return (
<View
style={{
width: "100%",
maxWidth: screenContentMaxWidthLarge,
}}
>
<TableWrapper horizontalScrollBreakpoint={breakpointM}>
<TableHeader columns={columns} />
<FlatList
data={rows}
renderItem={({ item, index }) => (
<LaunchpadReadyApplicationsTableRow
collection={item}
index={index}
/>
)}
keyExtractor={(item) => item.id.toString()}
/>
<SpacerColumn size={16} />
</TableWrapper>
</View>
);
};

const LaunchpadReadyApplicationsTableRow: React.FC<{
collection: DummyLaunchpadReadyCollection;
index: number;
// prices: CoingeckoPrices;
}> = ({
collection,
index,
// prices
}) => {
return (
<View>
<TableRow>
<TableTextCell
style={{
minWidth: columns.rank.minWidth,
flex: columns.rank.flex,
}}
>
{`${index + 1}`}
</TableTextCell>

<TableCell
style={{
minWidth: columns.collectionNameData.minWidth,
flex: columns.collectionNameData.flex,
flexDirection: "row",
alignItems: "center",
}}
>
<RoundedGradientImage
size="XS"
sourceURI={defaultCollectionImagePNG}
style={{
marginRight: layout.spacing_x1,
}}
/>
<CellBrandText>{collection.collectionNameData}</CellBrandText>

<SVG
source={checkBadgeSVG}
width={18}
height={18}
style={{ marginLeft: layout.spacing_x1 }}
/>
</TableCell>

<TableCell
style={{
minWidth: columns.collectionNetwork.minWidth,
flex: columns.collectionNetwork.flex,
flexDirection: "row",
alignItems: "center",
}}
>
<SVG
source={solanaCircleSVG}
width={18}
height={18}
style={{ marginRight: layout.spacing_x1 }}
/>

<CellBrandText>{collection.collectionNetwork}</CellBrandText>
</TableCell>

<TableCell
style={{
minWidth: columns.projectReadinessForMint.minWidth,
flex: columns.projectReadinessForMint.flex,
}}
>
<CellBadgeRow
style={{ flex: columns.projectReadinessForMint.flex }}
text={collection.projectReadinessForMint}
/>
</TableCell>

<TableCell
style={{
minWidth: columns.whitelistQuantity.minWidth,
flex: columns.whitelistQuantity.flex,
}}
>
<CellBadgeRow
style={{ flex: columns.whitelistQuantity.flex }}
text={collection.whitelistQuantity}
/>
</TableCell>

<TableCell
style={{
minWidth: columns.premiumMarketingPackage.minWidth,
flex: columns.premiumMarketingPackage.flex,
}}
>
<CellBadgeRow
style={{ flex: columns.premiumMarketingPackage.flex }}
text={collection.premiumMarketingPackage}
/>
</TableCell>

<TableTextCell
style={{
minWidth: columns.basicMarketingPackage.minWidth,
flex: columns.basicMarketingPackage.flex,
}}
>
{collection.basicMarketingPackage}
</TableTextCell>
</TableRow>
</View>
);
};
Loading

0 comments on commit 75444bc

Please sign in to comment.