Skip to content

Commit

Permalink
fic(launchpad): Remove pluralOrNot usages
Browse files Browse the repository at this point in the history
Rollback SocialButton changes
  • Loading branch information
WaDadidou committed Nov 8, 2024
1 parent 8c554e1 commit 180e2de
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 56 deletions.
29 changes: 8 additions & 21 deletions packages/components/buttons/SocialButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ import { Box } from "@/components/boxes/Box";
import { withAlpha, neutral22, neutral33 } from "@/utils/style/colors";
import { fontMedium14 } from "@/utils/style/fonts";

//TODO: Simplify this componet

export const iconDefaultSize = 20;
export const iconSize = 32;
export const iconPadding = 12;
export const outerPadding = 6;
export const innerGap = 8;

Expand All @@ -27,24 +26,23 @@ const IconWithText: React.FC<{
iconSvg: React.FC<SvgProps>;
textColor?: ColorValue;
iconColor?: ColorValue;
iconSize?: number;
}> = ({ text, iconSvg, textColor, iconColor, iconSize = iconDefaultSize }) => {
}> = ({ text, iconSvg, textColor, iconColor }) => {
return (
<View style={{ flexDirection: "row", alignItems: "center" }}>
<Box
style={{
backgroundColor: neutral33,
borderRadius: 6,
width: 32,
height: 32,
width: iconSize,
height: iconSize,
justifyContent: "center",
alignItems: "center",
}}
>
<SVG
source={iconSvg}
height={iconSize}
width={iconSize}
height={iconSize - iconPadding}
width={iconSize - iconPadding}
color={iconColor || "white"}
/>
</Box>
Expand Down Expand Up @@ -92,20 +90,10 @@ export const SocialButton: React.FC<{
iconSvg: React.FC<SvgProps>;
textColor?: ColorValue;
iconColor?: ColorValue;
iconSize?: number;
onPress?: () => void;
link?: string;
style?: StyleProp<ViewStyle>;
}> = ({
text,
onPress,
link,
iconSvg,
style,
textColor,
iconColor,
iconSize,
}) => {
}> = ({ text, onPress, link, iconSvg, style, textColor, iconColor }) => {
const content = (
<Box
style={{
Expand All @@ -121,7 +109,6 @@ export const SocialButton: React.FC<{
text={text}
textColor={textColor}
iconColor={iconColor}
iconSize={iconSize}
iconSvg={iconSvg}
/>
</Box>
Expand Down
10 changes: 5 additions & 5 deletions packages/components/buttons/SocialButtonSecondary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import { ViewStyle, StyleProp, TouchableOpacity } from "react-native";
import { SvgProps } from "react-native-svg";

import { iconDefaultSize, innerGap, outerPadding } from "./SocialButton";
import { iconPadding, iconSize, innerGap, outerPadding } from "./SocialButton";
import { BrandText } from "../BrandText";
import { SVG } from "../SVG";
import { Box } from "../boxes/Box";
Expand Down Expand Up @@ -37,16 +37,16 @@ export const SocialButtonSecondary: React.FC<{
style={{
backgroundColor: primaryColor,
borderRadius: 6,
width: iconDefaultSize,
height: iconDefaultSize,
width: iconSize,
height: iconSize,
justifyContent: "center",
alignItems: "center",
}}
>
<SVG
source={iconSvg}
height={iconDefaultSize}
width={iconDefaultSize}
height={iconSize - iconPadding}
width={iconSize - iconPadding}
color={primaryTextColor}
/>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ export const ApplicationDetail: React.FC<{
text="Collection"
iconSvg={launchpadApplySVG}
iconColor={neutralFF}
iconSize={24}
onPress={onPressDeployedCollectionButton}
/>
)}
Expand Down
15 changes: 5 additions & 10 deletions packages/screens/Launchpad/LaunchpadApply/LaunchpadApplyScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
import React from "react";
import { Linking, TextStyle, View } from "react-native";

import LaunchpadBannerImage from "@/assets/banners/launchpad.jpg";
import { BrandText } from "@/components/BrandText";
import { ImageBackgroundLogoText } from "@/components/ImageBackgroundLogoText";
import { ScreenContainer } from "@/components/ScreenContainer";
import {
LargeBoxButton,
LargeBoxButtonProps,
} from "../../../components/buttons/LargeBoxButton";

import LaunchpadBannerImage from "@/assets/banners/launchpad.jpg";
import { BrandText } from "@/components/BrandText";
import { ImageBackgroundLogoText } from "@/components/ImageBackgroundLogoText";
import { OmniLink } from "@/components/OmniLink";
import { ScreenContainer } from "@/components/ScreenContainer";
import { CustomPressable } from "@/components/buttons/CustomPressable";
import { SpacerColumn } from "@/components/spacer";
import { useMaxResolution } from "@/hooks/useMaxResolution";
import { NetworkFeature } from "@/networks";
import { ScreenFC } from "@/utils/navigation";
import { neutral77 } from "@/utils/style/colors";
import {
fontSemibold14,
fontSemibold20,
fontSemibold28,
} from "@/utils/style/fonts";
import { fontSemibold14, fontSemibold28 } from "@/utils/style/fonts";
import { layout } from "@/utils/style/layout";

const MD_BREAKPOINT = 720;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { parse } from "papaparse";
import pluralize from "pluralize";
import React, { FC, useEffect, useRef, useState } from "react";
import { useFieldArray, useFormContext } from "react-hook-form";
import { SafeAreaView, TouchableOpacity, View } from "react-native";
Expand All @@ -25,7 +26,6 @@ import {
import { errorColor, neutral33 } from "@/utils/style/colors";
import { fontSemibold14 } from "@/utils/style/fonts";
import { layout } from "@/utils/style/layout";
import { pluralOrNot } from "@/utils/text";
import { LocalFileData } from "@/utils/types/files";
import {
CollectionAssetsAttributeFormValues,
Expand Down Expand Up @@ -225,8 +225,8 @@ export const AssetsTab: React.FC = () => {

// Handling warnings
if (missingIdRows.length) {
const title = `Incomplete ${pluralOrNot("attribute", missingIdRows.length)}`;
const message = `Missing "id" in ${missingIdRows.length} ${pluralOrNot("attribute", missingIdRows.length)} that ${pluralOrNot("is", missingIdRows.length)} ignored.\nPlease complete properly your attributes mapping file.\nCheck the description for more information.`;
const title = `Incomplete ${pluralize("attribute", missingIdRows.length)}`;
const message = `Missing "id" in ${pluralize("attribute", missingIdRows.length, true)} that ${pluralize("has", missingIdRows.length)} been ignored.\nPlease complete properly your attributes mapping file.\nCheck the description for more information.`;
console.warn(title + ".\n" + message);
setAttributesIssues((issues) => [
...issues,
Expand All @@ -238,8 +238,8 @@ export const AssetsTab: React.FC = () => {
]);
}
if (missingTypeRows.length) {
const title = `Incomplete ${pluralOrNot("attribute", missingTypeRows.length)}`;
const message = `Missing "type" in ${missingTypeRows.length} ${pluralOrNot("attribute", missingTypeRows.length)} that ${pluralOrNot("is", missingTypeRows.length)} ignored.\nPlease complete properly your attributes mapping file.\nCheck the description for more information.`;
const title = `Incomplete ${pluralize("attribute", missingTypeRows.length)}`;
const message = `Missing "type" in ${pluralize("attribute", missingTypeRows.length, true)} that ${pluralize("has", missingTypeRows.length)} been ignored.\nPlease complete properly your attributes mapping file.\nCheck the description for more information.`;
console.warn(title + ".\n" + message);
setAttributesIssues((issues) => [
...issues,
Expand All @@ -251,8 +251,8 @@ export const AssetsTab: React.FC = () => {
]);
}
if (missingValueRows.length) {
const title = `Incomplete ${pluralOrNot("attribute", missingValueRows.length)}`;
const message = `Missing "value" in ${missingValueRows.length} ${pluralOrNot("attribute", missingValueRows.length)} that ${pluralOrNot("is", missingValueRows.length)} ignored.\nPlease complete properly your attributes mapping file.\nCheck the description for more information.`;
const title = `Incomplete ${pluralize("attribute", missingValueRows.length)}`;
const message = `Missing "value" in ${pluralize("attribute", missingValueRows.length, true)} that ${pluralize("has", missingValueRows.length)} been ignored.\nPlease complete properly your attributes mapping file.\nCheck the description for more information.`;
console.warn(title + ".\n" + message);
setAttributesIssues((issues) => [
...issues,
Expand All @@ -265,7 +265,7 @@ export const AssetsTab: React.FC = () => {
}
if (wrongIdRows.length) {
const title = `Wrong id`;
const message = `${wrongIdRows.length} ${pluralOrNot("attribute", wrongIdRows.length)} contain a wrong "id" value and has beed ignored. Only a number is allwowed.\nCheck the description for more information.`;
const message = `${pluralize("attribute", wrongIdRows.length, true)} ${pluralize("has", wrongIdRows.length)} a wrong "id" value and ${pluralize("has", wrongIdRows.length)} beed ignored. Only a number is allowed.\nCheck the description for more information.`;
console.warn(title + ".\n" + message);
setAttributesIssues((issues) => [
...issues,
Expand Down Expand Up @@ -401,8 +401,8 @@ export const AssetsTab: React.FC = () => {

// Handling warnings
if (missingNameRows.length) {
const title = `Incomplete ${pluralOrNot("asset", missingNameRows.length)}`;
const message = `Missing "name" in ${missingNameRows.length} ${pluralOrNot("asset", missingNameRows.length)} that ${pluralOrNot("is", missingNameRows.length)} ignored.\nPlease complete properly your assets mapping file.\nCheck the description for more information.`;
const title = `Incomplete ${pluralize("asset", missingNameRows.length)}`;
const message = `Missing "name" in ${pluralize("asset", missingNameRows.length, true)} that ${pluralize("has", missingNameRows.length)} been ignored.\nPlease complete properly your assets mapping file.\nCheck the description for more information.`;
console.warn(title + ".\n" + message);
setAssetsIssues((issues) => [
...issues,
Expand All @@ -414,8 +414,8 @@ export const AssetsTab: React.FC = () => {
]);
}
if (missingAttributesRows.length) {
const title = `Incomplete ${pluralOrNot("asset", missingAttributesRows.length)}`;
const message = `Missing "attributes" in ${missingAttributesRows.length} ${pluralOrNot("asset", missingAttributesRows.length)} that ${pluralOrNot("is", missingAttributesRows.length)} ignored.\nPlease complete properly your assets mapping file.\nCheck the description for more information.`;
const title = `Incomplete ${pluralize("asset", missingAttributesRows.length)}`;
const message = `Missing "attributes" in ${pluralize("asset", missingAttributesRows.length, true)} that ${pluralize("has", missingAttributesRows.length)} been ignored.\nPlease complete properly your assets mapping file.\nCheck the description for more information.`;
console.warn(title + ".\n" + message);
setAssetsIssues((issues) => [
...issues,
Expand All @@ -428,7 +428,7 @@ export const AssetsTab: React.FC = () => {
}
if (wrongAttributesRowsInAssets.length) {
const title = `Wrong attributes`;
const message = `${wrongAttributesRowsInAssets.length} ${pluralOrNot("asset", wrongAttributesRowsInAssets.length)} contain a wrong "attributes" value and ${pluralOrNot("is", wrongAttributesRowsInAssets.length)} ignored. Only numbers with comma separator are allwowed.\nCheck the description for more information.`;
const message = `${pluralize("asset", wrongAttributesRowsInAssets.length, true)} ${pluralize("has", wrongAttributesRowsInAssets.length)} a wrong "attributes" value and ${pluralize("has", wrongAttributesRowsInAssets.length)} been ignored. Only numbers with comma separator are allwowed.\nCheck the description for more information.`;
console.warn(title + ".\n" + message);
setAssetsIssues((issues) => [
...issues,
Expand All @@ -441,7 +441,7 @@ export const AssetsTab: React.FC = () => {
}
if (wrongUrlsRowsInAssets.length) {
const title = `Wrong URLs`;
const message = `${wrongUrlsRowsInAssets.length} ${pluralOrNot("asset", wrongUrlsRowsInAssets.length)} contain a wrong "youtube_url" or "external_url" value (No incidence).\nCheck the description for more information.`;
const message = `${pluralize("asset", wrongUrlsRowsInAssets.length, true)} ${pluralize("has", wrongUrlsRowsInAssets.length)} a wrong "youtube_url" or "external_url" value (No incidence).\nCheck the description for more information.`;
console.warn(title + ".\n" + message);
setAssetsIssues((issues) => [
...issues,
Expand All @@ -454,7 +454,7 @@ export const AssetsTab: React.FC = () => {
}
if (unknownAttributesRowsInAssets.length) {
const title = `Unknown attributes`;
const message = `${unknownAttributesRowsInAssets.length} ${pluralOrNot("asset", unknownAttributesRowsInAssets.length)} contain at least one "attributes" id that doesn't exist in your attributes mapping file. (No incidence)\nCheck the description for more information.`;
const message = `${pluralize("asset", unknownAttributesRowsInAssets.length, true)} ${pluralize("has", unknownAttributesRowsInAssets.length)} at least one "attributes" id that doesn't exist in your attributes mapping file. (No incidence)\nCheck the description for more information.`;
console.warn(title + ".\n" + message);
setAssetsIssues((issues) => [
...issues,
Expand Down Expand Up @@ -529,8 +529,8 @@ export const AssetsTab: React.FC = () => {
if (collectionAssetsMetadatas.length < images.length) {
const nbUnexpectedImages =
images.length - collectionAssetsMetadatas.length;
const title = `Unexpected ${pluralOrNot("image", nbUnexpectedImages)}`;
const message = `${nbUnexpectedImages} ${pluralOrNot("image", nbUnexpectedImages)} ${pluralOrNot("is", nbUnexpectedImages)} not expected in your assets mapping file and ${pluralOrNot("is", nbUnexpectedImages)} ignored.\nCheck the description for more information.`;
const title = `Unexpected ${pluralize("image", nbUnexpectedImages)}`;
const message = `${pluralize("image", nbUnexpectedImages, true)} ${pluralize("is", nbUnexpectedImages)} not expected in your assets mapping file and ${pluralize("has", nbUnexpectedImages)} been ignored.\nCheck the description for more information.`;
console.warn(title + ".\n" + message);
setImagesIssues((issues) => [
...issues,
Expand All @@ -545,8 +545,8 @@ export const AssetsTab: React.FC = () => {
if (assetsMappingDataRows.length > collectionAssetsMetadatas.length) {
const nbMissingImages =
assetsMappingDataRows.length - collectionAssetsMetadatas.length;
const title = `Missing ${pluralOrNot("image", nbMissingImages)}`;
const message = `${nbMissingImages} ${pluralOrNot("image", nbMissingImages)} expected in your assets mapping file ${pluralOrNot("is", nbMissingImages)} missing.\nCheck the description for more information.`;
const title = `Missing ${pluralize("image", nbMissingImages)}`;
const message = `${pluralize("image", nbMissingImages, true)} expected in your assets mapping file ${pluralize("is", nbMissingImages)} missing.\nCheck the description for more information.`;
console.warn(title + ".\n" + message);
setImagesIssues((issues) => [
...issues,
Expand Down

0 comments on commit 180e2de

Please sign in to comment.