Skip to content

Commit ce9dd57

Browse files
committed
chore(launchpad): Clean TSX
1 parent 8f25d69 commit ce9dd57

28 files changed

+110
-158
lines changed

packages/components/FilePreview/SelectedFilesPreview/ItemView.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import React, { FC } from "react";
1+
import { FC } from "react";
22
import { TouchableOpacity, Image, StyleProp, ViewStyle } from "react-native";
33

4-
import { neutral77, secondaryColor } from "../../../utils/style/colors";
5-
import { fontSemibold11, fontSemibold13 } from "../../../utils/style/fonts";
6-
import { layout } from "../../../utils/style/layout";
74
import { BrandText } from "../../BrandText";
85
import { PrimaryBox } from "../../boxes/PrimaryBox";
96

7+
import { neutral77, secondaryColor } from "@/utils/style/colors";
8+
import { fontSemibold11, fontSemibold13 } from "@/utils/style/fonts";
9+
import { layout } from "@/utils/style/layout";
10+
1011
export const itemSize = 120;
1112
export const ItemView: FC<{
1213
label: string;
@@ -47,10 +48,8 @@ export const ItemView: FC<{
4748

4849
<PrimaryBox
4950
style={{
50-
// borderRadius: 32,
5151
paddingHorizontal: layout.spacing_x1,
5252
paddingVertical: layout.spacing_x0_5,
53-
// height: 34,
5453
width: itemSize - 10,
5554
bottom: -20,
5655
alignItems: "center",

packages/components/FilePreview/SelectedFilesPreview/SelectedFilesPreview.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from "react";
1+
import { FC } from "react";
22
import { View } from "react-native";
33

44
import { itemSize, ItemView } from "./ItemView";
@@ -12,7 +12,7 @@ import { fontSemibold20 } from "@/utils/style/fonts";
1212
import { layout } from "@/utils/style/layout";
1313
import { LocalFileData } from "@/utils/types/files";
1414

15-
export const SelectedFilesPreview: React.FC<{
15+
export const SelectedFilesPreview: FC<{
1616
files: LocalFileData[];
1717
onPressItem: (file: LocalFileData, itemIndex: number) => void;
1818
onPressDeleteItem: (itemIndex: number) => void;

packages/components/NetworkSelector/NetworkSelectorWithLabel.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
import React, { useState } from "react";
1+
import { FC, useState } from "react";
22
import { StyleProp, View, ViewStyle } from "react-native";
33

44
import { NetworkSelectorMenu } from "./NetworkSelectorMenu";
5-
import chevronDownSVG from "../../../assets/icons/chevron-down.svg";
6-
import chevronUpSVG from "../../../assets/icons/chevron-up.svg";
7-
import { useDropdowns } from "../../hooks/useDropdowns";
8-
import { useSelectedNetworkInfo } from "../../hooks/useSelectedNetwork";
9-
import { NetworkFeature, NetworkKind } from "../../networks";
10-
import { neutral17, neutral77, secondaryColor } from "../../utils/style/colors";
11-
import { fontSemibold14 } from "../../utils/style/fonts";
12-
import { layout } from "../../utils/style/layout";
135
import { BrandText } from "../BrandText";
146
import { SVG } from "../SVG";
157
import { TertiaryBox } from "../boxes/TertiaryBox";
168
import { Label } from "../inputs/TextInputCustom";
179

10+
import chevronDownSVG from "@/assets/icons/chevron-down.svg";
11+
import chevronUpSVG from "@/assets/icons/chevron-up.svg";
1812
import { NetworkIcon } from "@/components/NetworkIcon";
1913
import { CustomPressable } from "@/components/buttons/CustomPressable";
2014
import { SpacerRow } from "@/components/spacer";
15+
import { useDropdowns } from "@/hooks/useDropdowns";
16+
import { useSelectedNetworkInfo } from "@/hooks/useSelectedNetwork";
17+
import { NetworkFeature, NetworkKind } from "@/networks";
18+
import { neutral17, neutral77, secondaryColor } from "@/utils/style/colors";
19+
import { fontSemibold14 } from "@/utils/style/fonts";
20+
import { layout } from "@/utils/style/layout";
2121

22-
export const NetworkSelectorWithLabel: React.FC<{
22+
export const NetworkSelectorWithLabel: FC<{
2323
label: string;
2424
style?: StyleProp<ViewStyle>;
2525
forceNetworkId?: string;

packages/screens/Launchpad/LaunchpadApply/LaunchpadApplyScreen.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
import React from "react";
21
import { Linking, TextStyle, View } from "react-native";
32

4-
import {
5-
LargeBoxButton,
6-
LargeBoxButtonProps,
7-
} from "../../../components/buttons/LargeBoxButton";
8-
93
import LaunchpadBannerImage from "@/assets/banners/launchpad.jpg";
104
import { BrandText } from "@/components/BrandText";
115
import { ImageBackgroundLogoText } from "@/components/ImageBackgroundLogoText";
126
import { OmniLink } from "@/components/OmniLink";
137
import { ScreenContainer } from "@/components/ScreenContainer";
148
import { CustomPressable } from "@/components/buttons/CustomPressable";
9+
import {
10+
LargeBoxButton,
11+
LargeBoxButtonProps,
12+
} from "@/components/buttons/LargeBoxButton";
1513
import { SpacerColumn } from "@/components/spacer";
1614
import { useMaxResolution } from "@/hooks/useMaxResolution";
1715
import { ScreenFC } from "@/utils/navigation";

packages/screens/Launchpad/LaunchpadApply/LaunchpadCreate/LaunchpadCreateScreen.tsx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { zodResolver } from "@hookform/resolvers/zod";
2-
import React, { useMemo, useState } from "react";
2+
import { useMemo, useState } from "react";
33
import { FormProvider, useForm } from "react-hook-form";
44
import { View } from "react-native";
55
import { useSelector } from "react-redux";
@@ -80,9 +80,6 @@ export const LaunchpadCreateScreen: ScreenFC<"LaunchpadCreate"> = () => {
8080
}, [selectedStepKey]);
8181

8282
const onValid = async () => {
83-
// TODO: Remove console.log when ready to merge
84-
console.log("==== collectionForm.getValues()", collectionForm.getValues());
85-
8683
setLoading(true);
8784
setLoadingFullScreen(true);
8885
try {
@@ -100,10 +97,6 @@ export const LaunchpadCreateScreen: ScreenFC<"LaunchpadCreate"> = () => {
10097
};
10198

10299
const onInvalid = () => {
103-
// TODO: Remove console.log when ready to merge
104-
console.log("==== collectionForm.getValues()", collectionForm.getValues());
105-
console.log("xxxxx collectionForm.formState", collectionForm.formState);
106-
107100
setToast({
108101
mode: "normal",
109102
type: "error",
@@ -174,12 +167,7 @@ export const LaunchpadCreateScreen: ScreenFC<"LaunchpadCreate"> = () => {
174167
text="Submit Collection"
175168
loader
176169
isLoading={isLoading}
177-
disabled={
178-
isLoading ||
179-
// TODO: Remove this condition when useCompleteCollection and MyCollections frontend are merged
180-
!collectionForm.getValues().assetsMetadatas?.assetsMetadatas
181-
?.length
182-
}
170+
disabled={isLoading}
183171
onPress={onPressSubmit}
184172
/>
185173
) : (

packages/screens/Launchpad/LaunchpadApply/LaunchpadCreate/components/LaunchpadStepper.tsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { Dispatch, FC, useRef } from "react";
1+
import { Dispatch, FC, SetStateAction, useRef } from "react";
22
import { useFormContext } from "react-hook-form";
33
import {
44
LayoutChangeEvent,
@@ -28,7 +28,7 @@ export type LaunchpadCreateStepKey = number;
2828

2929
interface LaunchpadStepperProps {
3030
selectedStepKey: LaunchpadCreateStepKey;
31-
setSelectedStepKey: Dispatch<React.SetStateAction<LaunchpadCreateStepKey>>;
31+
setSelectedStepKey: Dispatch<SetStateAction<LaunchpadCreateStepKey>>;
3232
}
3333

3434
interface LaunchpadCreateStep {
@@ -175,15 +175,13 @@ export const LaunchpadStepper: FC<LaunchpadStepperProps> = ({
175175
if (isSelected) onSelectedItemLayout(e);
176176
}}
177177
onPress={() => setSelectedStepKey(step.key)}
178-
style={[
179-
{
180-
flexDirection: "row",
181-
alignItems: "center",
182-
justifyContent: "center",
183-
paddingHorizontal: layout.spacing_x2,
184-
paddingVertical: layout.spacing_x1,
185-
},
186-
]}
178+
style={{
179+
flexDirection: "row",
180+
alignItems: "center",
181+
justifyContent: "center",
182+
paddingHorizontal: layout.spacing_x2,
183+
paddingVertical: layout.spacing_x1,
184+
}}
187185
>
188186
<View
189187
style={{

packages/screens/Launchpad/LaunchpadApply/LaunchpadCreate/components/steps/LaunchpadAdditional.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import React, { FC } from "react";
1+
import { FC } from "react";
22
import { Controller, useFormContext } from "react-hook-form";
33
import { View } from "react-native";
44

5-
import { SelectInputLaunchpad } from "../../../components/inputs/selectInputs/SelectInputLaunchpad";
6-
75
import { BrandText } from "@/components/BrandText";
86
import { ErrorText } from "@/components/ErrorText";
97
import { SpacerColumn } from "@/components/spacer";
108
import { TextInputLaunchpad } from "@/screens/Launchpad/LaunchpadApply/components/inputs/TextInputLaunchpad";
9+
import { SelectInputLaunchpad } from "@/screens/Launchpad/LaunchpadApply/components/inputs/selectInputs/SelectInputLaunchpad";
1110
import { neutral55, neutral77 } from "@/utils/style/colors";
1211
import {
1312
fontSemibold13,

packages/screens/Launchpad/LaunchpadApply/LaunchpadCreate/components/steps/LaunchpadAssetsAndMetadata/AssetModal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from "react";
1+
import { FC } from "react";
22
import { useFormContext } from "react-hook-form";
33
import { View } from "react-native";
44

@@ -29,7 +29,7 @@ import {
2929
CollectionAssetsMetadatasFormValues,
3030
} from "@/utils/types/launchpad";
3131

32-
export const AssetModal: React.FC<{
32+
export const AssetModal: FC<{
3333
onClose: () => void;
3434
isVisible: boolean;
3535
elem: CollectionAssetsMetadataFormValues;

packages/screens/Launchpad/LaunchpadApply/LaunchpadCreate/components/steps/LaunchpadAssetsAndMetadata/AssetsTab.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { parse } from "papaparse";
22
import pluralize from "pluralize";
3-
import React, { FC, useEffect, useRef, useState } from "react";
3+
import { FC, useEffect, useRef, useState } from "react";
44
import { useFieldArray, useFormContext } from "react-hook-form";
55
import { SafeAreaView, TouchableOpacity, View } from "react-native";
66

@@ -136,13 +136,13 @@ export const AssetsTab: React.FC = () => {
136136
}, [fields.length]);
137137

138138
// On upload attributes CSV mapping file
139-
const onUploadAttributesMapingFile = async (files: LocalFileData[]) => {
139+
const onUploadAttributesMapingFile = (files: LocalFileData[]) => {
140140
resetAllIssues();
141141
setAssetsMappingDataRows([]);
142142
assetsMetadatasForm.setValue("assetsMetadatas", []);
143143

144144
try {
145-
await parse<string[]>(files[0].file, {
145+
parse<string[]>(files[0].file, {
146146
complete: (parseResults) => {
147147
const attributesDataRows = parseResults.data;
148148

@@ -176,7 +176,7 @@ export const AssetsTab: React.FC = () => {
176176
const wrongIdRows: string[][] = [];
177177
const rowsIndexesToRemove: number[] = [];
178178

179-
// Controling attributes
179+
// Controlling attributes
180180
cleanDataRows(attributesDataRows).forEach((dataRow, dataRowIndex) => {
181181
const hasNoId = !dataRow[idColIndex]?.trim();
182182
const hasNoValue = !dataRow[valueColIndex]?.trim();
@@ -329,7 +329,7 @@ export const AssetsTab: React.FC = () => {
329329
const wrongUrlsRowsInAssets: string[][] = [];
330330
const rowsIndexesToRemove: number[] = [];
331331

332-
// Controling assets and attributes
332+
// Controlling assets and attributes
333333
cleanDataRows(assetsDataRows).forEach(
334334
(assetDataRow, assetDataRowIndex) => {
335335
const hasNoName = !assetDataRow[nameColIndex]?.trim();

packages/screens/Launchpad/LaunchpadApply/LaunchpadCreate/components/steps/LaunchpadAssetsAndMetadata/LaunchpadAssetsAndMetadata.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { zodResolver } from "@hookform/resolvers/zod";
2-
import React, { FC, useEffect, useState } from "react";
2+
import { FC, useEffect, useState } from "react";
33
import { FormProvider, useForm, useFormContext } from "react-hook-form";
44
import { View } from "react-native";
55

@@ -36,7 +36,7 @@ export const LaunchpadAssetsAndMetadata: FC = () => {
3636
const collectionAssetsMetadatas = watch("assetsMetadatas");
3737
const assetsMetadatasForm = useForm<CollectionAssetsMetadatasFormValues>({
3838
mode: "all",
39-
defaultValues: collectionAssetsMetadatas, // Retreive assetsMetadatas from collectionForm
39+
defaultValues: collectionAssetsMetadatas, // Retrieve assetsMetadatas from collectionForm
4040
resolver: zodResolver(ZodCollectionAssetsMetadatasFormValues),
4141
});
4242
const assetsMetadatas = assetsMetadatasForm.watch("assetsMetadatas");

0 commit comments

Comments
 (0)