diff --git a/src/components/AddContentModal/BudgetStep/index.tsx b/src/components/AddContentModal/BudgetStep/index.tsx index f95e11b74..fe0aa8c38 100644 --- a/src/components/AddContentModal/BudgetStep/index.tsx +++ b/src/components/AddContentModal/BudgetStep/index.tsx @@ -5,8 +5,7 @@ import CheckIcon from '~/components/Icons/CheckIcon' import { Flex } from '~/components/common/Flex' import { Text } from '~/components/common/Text' import { useUserStore } from '~/stores/useUserStore' -import { colors } from '~/utils/colors' -import { formatBudget } from './utils' +import { colors, formatBudget } from '~/utils' type Props = { onClick: () => void diff --git a/src/components/AddContentModal/LocationStep/index.tsx b/src/components/AddContentModal/LocationStep/index.tsx index 2a38d2ee7..e3ef9a731 100644 --- a/src/components/AddContentModal/LocationStep/index.tsx +++ b/src/components/AddContentModal/LocationStep/index.tsx @@ -5,7 +5,7 @@ import styled from 'styled-components' import { Flex } from '~/components/common/Flex' import { Text } from '~/components/common/Text' import { TextInput } from '~/components/common/TextInput' -import { colors } from '~/utils/colors' +import { colors } from '~/utils' import { FormData } from '..' import { validateLatitude, validateLongitude } from './utils' diff --git a/src/components/AddContentModal/index.tsx b/src/components/AddContentModal/index.tsx index c5953d367..4c58581d8 100644 --- a/src/components/AddContentModal/index.tsx +++ b/src/components/AddContentModal/index.tsx @@ -10,11 +10,7 @@ import { api } from '~/network/api' import { useModal } from '~/stores/useModalStore' import { useUserStore } from '~/stores/useUserStore' import { SubmitErrRes } from '~/types' -import { colors } from '~/utils/colors' -import { getLSat } from '~/utils/getLSat' -import { payLsat } from '~/utils/payLsat' -import { updateBudget } from '~/utils/setBudget' -import { executeIfProd } from '~/utils/tests' +import { colors, getLSat, payLsat, updateBudget, executeIfProd } from '~/utils' import { ToastMessage } from '../common/Toast/toastMessage' import { BudgetStep } from './BudgetStep' import { LocationStep } from './LocationStep' diff --git a/src/components/AddSourceModal/BudgetStep/index.tsx b/src/components/AddSourceModal/BudgetStep/index.tsx index fadb10c47..75d4d19da 100644 --- a/src/components/AddSourceModal/BudgetStep/index.tsx +++ b/src/components/AddSourceModal/BudgetStep/index.tsx @@ -5,7 +5,7 @@ import CheckIcon from '~/components/Icons/CheckIcon' import { Flex } from '~/components/common/Flex' import { Text } from '~/components/common/Text' import { useUserStore } from '~/stores/useUserStore' -import { colors } from '~/utils/colors' +import { formatBudget, colors } from '~/utils' type Props = { onClick: () => void @@ -14,18 +14,6 @@ type Props = { export const BudgetStep: FC = ({ onClick }) => { const [budget] = useUserStore((s) => [s.budget]) - function formatBudget(value: number | null) { - if (value === null) { - return '?' - } - - const stringBudget = value.toLocaleString() - - const splittedBudget = stringBudget.split(',') - - return splittedBudget.join(' ') - } - return ( diff --git a/src/components/AddContentModal/BudgetStep/utils/__tests__/index.ts b/src/utils/formatBudget/__tests__/index.ts similarity index 100% rename from src/components/AddContentModal/BudgetStep/utils/__tests__/index.ts rename to src/utils/formatBudget/__tests__/index.ts diff --git a/src/components/AddContentModal/BudgetStep/utils/index.ts b/src/utils/formatBudget/index.ts similarity index 100% rename from src/components/AddContentModal/BudgetStep/utils/index.ts rename to src/utils/formatBudget/index.ts diff --git a/src/utils/index.ts b/src/utils/index.ts new file mode 100644 index 000000000..0f8800fff --- /dev/null +++ b/src/utils/index.ts @@ -0,0 +1,46 @@ +import { assertNever } from './assertNever' +import { boost } from './boost' +import { colors } from './colors' +import { formatBudget } from './formatBudget' +import { formatDescription } from './formatDescription' +import { formatTimestamp } from './formatTimestamp' +import { getLSat } from './getLSat' +import { getSelectedNodeTimestamps } from './getSelectedNodeTimestamps' +import { getSuperficialNodeWeight } from './getSuperficialNodeWeight' +import { overrideConsole } from './logger' +import { media } from './media' +import { payLsat } from './payLsat' +import { saveConsumedContent, saveSearchTerm } from './relayHelper' +import { updateBudget } from './setBudget' +import { convertToChatMessage } from './stringToChatMessage' +import { executeIfTetsRunning, executeIfProd, addToGlobalForE2e, E2ETests } from './tests' +import { timeToMilliseconds } from './timeToMilliseconds' +import { useIsMatchBreakpoint } from './useIsMatchBreakpoint' +// import APP_VERSION from './versionHelper' +import { videoTimetoSeconds } from './videoTimetoSeconds' + +export { + assertNever, + boost, + colors, + formatBudget, + formatDescription, + formatTimestamp, + getLSat, + getSelectedNodeTimestamps, + getSuperficialNodeWeight, + overrideConsole, + media, + payLsat, + saveConsumedContent, + saveSearchTerm, + updateBudget, + convertToChatMessage, + executeIfTetsRunning, + executeIfProd, + addToGlobalForE2e, + E2ETests, + timeToMilliseconds, + useIsMatchBreakpoint, + videoTimetoSeconds, +}