diff --git a/src/components/elements/AmountInput/index.tsx b/src/components/Elements/AmountInput/index.tsx similarity index 96% rename from src/components/elements/AmountInput/index.tsx rename to src/components/Elements/AmountInput/index.tsx index 2292307c..c24d4ccf 100644 --- a/src/components/elements/AmountInput/index.tsx +++ b/src/components/Elements/AmountInput/index.tsx @@ -10,7 +10,7 @@ interface AmountInputProps { // TODO: Fetch dot price and show how much is the currency amount worth. -const AmountInput = ({ +export const AmountInput = ({ amount, currency, title, @@ -60,5 +60,3 @@ const AmountInput = ({ ); }; - -export default AmountInput; diff --git a/src/components/elements/Banner/index.tsx b/src/components/Elements/Banner/index.tsx similarity index 89% rename from src/components/elements/Banner/index.tsx rename to src/components/Elements/Banner/index.tsx index 1764d2ff..f93a59dc 100644 --- a/src/components/elements/Banner/index.tsx +++ b/src/components/Elements/Banner/index.tsx @@ -7,7 +7,7 @@ interface BannerProps { severity: 'info' | 'error' | 'warning' | 'success'; } -const Banner = ({ content, severity }: BannerProps) => { +export const Banner = ({ content, severity }: BannerProps) => { const [open, setOpen] = useState(true); const handleClose = () => { @@ -36,5 +36,3 @@ const Banner = ({ content, severity }: BannerProps) => { ); }; - -export default Banner; diff --git a/src/components/elements/FeatureCard/index.module.scss b/src/components/Elements/FeatureCard/index.module.scss similarity index 100% rename from src/components/elements/FeatureCard/index.module.scss rename to src/components/Elements/FeatureCard/index.module.scss diff --git a/src/components/elements/FeatureCard/index.tsx b/src/components/Elements/FeatureCard/index.tsx similarity index 95% rename from src/components/elements/FeatureCard/index.tsx rename to src/components/Elements/FeatureCard/index.tsx index 7e85625d..b02afca3 100644 --- a/src/components/elements/FeatureCard/index.tsx +++ b/src/components/Elements/FeatureCard/index.tsx @@ -19,7 +19,7 @@ interface FeatureCardProps { href: string; } -const FeatureCard = ({ +export const FeatureCard = ({ title, buttonText, image, @@ -50,5 +50,3 @@ const FeatureCard = ({ ); }; - -export default FeatureCard; diff --git a/src/components/elements/Label/index.tsx b/src/components/Elements/Label/index.tsx similarity index 100% rename from src/components/elements/Label/index.tsx rename to src/components/Elements/Label/index.tsx diff --git a/src/components/elements/ListingCard/index.module.scss b/src/components/Elements/ListingCard/index.module.scss similarity index 100% rename from src/components/elements/ListingCard/index.module.scss rename to src/components/Elements/ListingCard/index.module.scss diff --git a/src/components/elements/ListingCard/index.tsx b/src/components/Elements/ListingCard/index.tsx similarity index 100% rename from src/components/elements/ListingCard/index.tsx rename to src/components/Elements/ListingCard/index.tsx diff --git a/src/components/elements/MarketFilters/DurationFilter.tsx b/src/components/Elements/MarketFilters/DurationFilter.tsx similarity index 100% rename from src/components/elements/MarketFilters/DurationFilter.tsx rename to src/components/Elements/MarketFilters/DurationFilter.tsx diff --git a/src/components/elements/MarketFilters/PriceFilter.tsx b/src/components/Elements/MarketFilters/PriceFilter.tsx similarity index 100% rename from src/components/elements/MarketFilters/PriceFilter.tsx rename to src/components/Elements/MarketFilters/PriceFilter.tsx diff --git a/src/components/elements/MarketFilters/RegionEndFilter.tsx b/src/components/Elements/MarketFilters/RegionEndFilter.tsx similarity index 100% rename from src/components/elements/MarketFilters/RegionEndFilter.tsx rename to src/components/Elements/MarketFilters/RegionEndFilter.tsx diff --git a/src/components/elements/MarketFilters/RegionStartFilter.tsx b/src/components/Elements/MarketFilters/RegionStartFilter.tsx similarity index 100% rename from src/components/elements/MarketFilters/RegionStartFilter.tsx rename to src/components/Elements/MarketFilters/RegionStartFilter.tsx diff --git a/src/components/elements/MarketFilters/coreOccupancyFilter.tsx b/src/components/Elements/MarketFilters/coreOccupancyFilter.tsx similarity index 100% rename from src/components/elements/MarketFilters/coreOccupancyFilter.tsx rename to src/components/Elements/MarketFilters/coreOccupancyFilter.tsx diff --git a/src/components/elements/MarketFilters/index.tsx b/src/components/Elements/MarketFilters/index.tsx similarity index 97% rename from src/components/elements/MarketFilters/index.tsx rename to src/components/Elements/MarketFilters/index.tsx index b65df2e5..68ff5ecb 100644 --- a/src/components/elements/MarketFilters/index.tsx +++ b/src/components/Elements/MarketFilters/index.tsx @@ -29,7 +29,7 @@ type Filters = { regionEndFilter: (_listing: Listing) => boolean; }; -const MarketFilters = ({ listings, setFilteredListings }: Props) => { +export const MarketFilters = ({ listings, setFilteredListings }: Props) => { const [filters, setFilters] = useState({ coreOccupancyFilter: () => true, durationFilter: () => true, @@ -112,5 +112,3 @@ const MarketFilters = ({ listings, setFilteredListings }: Props) => { ); }; - -export default MarketFilters; diff --git a/src/components/elements/MarketFilters/sort.tsx b/src/components/Elements/MarketFilters/sort.tsx similarity index 100% rename from src/components/elements/MarketFilters/sort.tsx rename to src/components/Elements/MarketFilters/sort.tsx diff --git a/src/components/elements/Progress/index.tsx b/src/components/Elements/Progress/index.tsx similarity index 94% rename from src/components/elements/Progress/index.tsx rename to src/components/Elements/Progress/index.tsx index f5f77bdd..6e3b070f 100644 --- a/src/components/elements/Progress/index.tsx +++ b/src/components/Elements/Progress/index.tsx @@ -30,7 +30,7 @@ interface ProgressProps { sections: Section[]; } -const Progress = ({ progress, sections }: ProgressProps) => { +export const Progress = ({ progress, sections }: ProgressProps) => { return ( @@ -62,5 +62,3 @@ const Progress = ({ progress, sections }: ProgressProps) => { ); }; - -export default Progress; diff --git a/src/components/elements/RegionCard/index.module.scss b/src/components/Elements/RegionCard/index.module.scss similarity index 100% rename from src/components/elements/RegionCard/index.module.scss rename to src/components/Elements/RegionCard/index.module.scss diff --git a/src/components/elements/RegionCard/index.tsx b/src/components/Elements/RegionCard/index.tsx similarity index 100% rename from src/components/elements/RegionCard/index.tsx rename to src/components/Elements/RegionCard/index.tsx diff --git a/src/components/elements/SaleInfo/index.module.scss b/src/components/Elements/SaleInfo/index.module.scss similarity index 100% rename from src/components/elements/SaleInfo/index.module.scss rename to src/components/Elements/SaleInfo/index.module.scss diff --git a/src/components/elements/SaleInfo/index.tsx b/src/components/Elements/SaleInfo/index.tsx similarity index 98% rename from src/components/elements/SaleInfo/index.tsx rename to src/components/Elements/SaleInfo/index.tsx index e91761d4..7daec652 100644 --- a/src/components/elements/SaleInfo/index.tsx +++ b/src/components/Elements/SaleInfo/index.tsx @@ -19,7 +19,7 @@ interface SaleInfoGridProps { saleEnd: number; } -const SaleInfoGrid = ({ +export const SaleInfoGrid = ({ saleInfo, currentPhase, currentPrice, @@ -116,5 +116,3 @@ const SaleInfoGrid = ({ ); }; - -export default SaleInfoGrid; diff --git a/src/components/elements/StatusIndicator/index.module.scss b/src/components/Elements/StatusIndicator/index.module.scss similarity index 100% rename from src/components/elements/StatusIndicator/index.module.scss rename to src/components/Elements/StatusIndicator/index.module.scss diff --git a/src/components/elements/StatusIndicator/index.tsx b/src/components/Elements/StatusIndicator/index.tsx similarity index 99% rename from src/components/elements/StatusIndicator/index.tsx rename to src/components/Elements/StatusIndicator/index.tsx index 76b5447c..5367e18f 100644 --- a/src/components/elements/StatusIndicator/index.tsx +++ b/src/components/Elements/StatusIndicator/index.tsx @@ -9,6 +9,7 @@ interface StatusIndicatorProps { state: ApiState; label: string; } + export const StatusIndicator = ({ state, label }: StatusIndicatorProps) => { const theme = useTheme(); return ( diff --git a/src/components/Elements/index.ts b/src/components/Elements/index.ts new file mode 100644 index 00000000..6b96619d --- /dev/null +++ b/src/components/Elements/index.ts @@ -0,0 +1,10 @@ +export * from './AmountInput'; +export * from './Banner'; +export * from './FeatureCard'; +export * from './Label'; +export * from './ListingCard'; +export * from './MarketFilters'; +export * from './Progress'; +export * from './RegionCard'; +export * from './SaleInfo'; +export * from './StatusIndicator'; diff --git a/src/components/Layout/index.tsx b/src/components/Layout/index.tsx index 4e1e5201..6aead507 100644 --- a/src/components/Layout/index.tsx +++ b/src/components/Layout/index.tsx @@ -2,7 +2,7 @@ import { Divider, Paper, useTheme } from '@mui/material'; import React, { ReactElement } from 'react'; import styles from './index.module.scss'; -import Banner from '../elements/Banner'; +import { Banner } from '../Elements'; import { Header } from '../Header'; import { Sidebar } from '../Sidebar'; diff --git a/src/components/Modals/Interlace/index.tsx b/src/components/Modals/Interlace/index.tsx index b5a8d8e8..67c85428 100644 --- a/src/components/Modals/Interlace/index.tsx +++ b/src/components/Modals/Interlace/index.tsx @@ -15,7 +15,7 @@ import { useInkathon } from '@scio-labs/use-inkathon'; import { CoreMask } from 'coretime-utils'; import { useEffect, useState } from 'react'; -import { RegionCard } from '@/components/elements'; +import { RegionCard } from '@/components/Elements'; import { useCoretimeApi } from '@/contexts/apis'; import { useRegions } from '@/contexts/regions'; diff --git a/src/components/Modals/Partition/index.tsx b/src/components/Modals/Partition/index.tsx index ce6bfd0e..eb6e8ab2 100644 --- a/src/components/Modals/Partition/index.tsx +++ b/src/components/Modals/Partition/index.tsx @@ -14,7 +14,7 @@ import { import { useInkathon } from '@scio-labs/use-inkathon'; import { useEffect, useState } from 'react'; -import { RegionCard } from '@/components/elements'; +import { RegionCard } from '@/components/Elements'; import { useCoretimeApi } from '@/contexts/apis'; import { useCommon } from '@/contexts/common'; diff --git a/src/components/Modals/Purchase/index.tsx b/src/components/Modals/Purchase/index.tsx index 868ff95d..f656a4ef 100644 --- a/src/components/Modals/Purchase/index.tsx +++ b/src/components/Modals/Purchase/index.tsx @@ -9,7 +9,7 @@ import { import { contractTx, useContract, useInkathon } from '@scio-labs/use-inkathon'; import { useState } from 'react'; -import { ListingCard } from '@/components/elements/ListingCard'; +import { ListingCard } from '@/components/Elements/ListingCard'; import { CONTRACT_MARKET } from '@/contexts/apis/consts'; import { useToast } from '@/contexts/toast'; @@ -65,10 +65,9 @@ export const PurchaseModal = ({ setWorking(false); } catch (e: any) { toastError( - `Failed to purchase region from sale. Error: ${ - e.errorMessage === 'Error' - ? 'Please check your balance.' - : e.errorMessage + `Failed to purchase region from sale. Error: ${e.errorMessage === 'Error' + ? 'Please check your balance.' + : e.errorMessage }` ); setWorking(false); diff --git a/src/components/Modals/Sell/index.tsx b/src/components/Modals/Sell/index.tsx index e1e84258..c671bf13 100644 --- a/src/components/Modals/Sell/index.tsx +++ b/src/components/Modals/Sell/index.tsx @@ -12,9 +12,8 @@ import { contractTx, useContract, useInkathon } from '@scio-labs/use-inkathon'; import { Region } from 'coretime-utils'; import { useEffect, useState } from 'react'; -import { RegionCard } from '@/components/elements'; -import AmountInput from '@/components/elements/AmountInput'; -import { RecipientSelector } from '@/components/elements/RecipientSelector'; +import { AmountInput, RegionCard } from '@/components/Elements'; +import { RecipientSelector } from '@/components/Selectors/RecipientSelector'; import { CONTRACT_MARKET, CONTRACT_XC_REGIONS } from '@/contexts/apis/consts'; import { useRegions } from '@/contexts/regions'; @@ -86,8 +85,7 @@ export const SellModal = ({ setWorking(false); } catch (e: any) { toastError( - `Failed to approve the region. Error: ${ - e.errorMessage === 'Error' ? 'Please check your balance.' : e + `Failed to approve the region. Error: ${e.errorMessage === 'Error' ? 'Please check your balance.' : e }` ); setWorking(false); @@ -128,10 +126,9 @@ export const SellModal = ({ setWorking(false); } catch (e: any) { toastError( - `Failed to list the region. Error: ${ - e.errorMessage === 'Error' - ? 'Please check your balance.' - : e.errorMessage + `Failed to list the region. Error: ${e.errorMessage === 'Error' + ? 'Please check your balance.' + : e.errorMessage }` ); setWorking(false); diff --git a/src/components/Modals/TaskAssign/index.tsx b/src/components/Modals/TaskAssign/index.tsx index 6a879f88..e956bdc3 100644 --- a/src/components/Modals/TaskAssign/index.tsx +++ b/src/components/Modals/TaskAssign/index.tsx @@ -15,7 +15,7 @@ import { import { useInkathon } from '@scio-labs/use-inkathon'; import { useEffect, useState } from 'react'; -import { RegionCard } from '@/components/elements'; +import { RegionCard } from '@/components/Elements'; import { useCoretimeApi, useRelayApi } from '@/contexts/apis'; import { useRegions } from '@/contexts/regions'; diff --git a/src/components/Modals/Transfer/index.tsx b/src/components/Modals/Transfer/index.tsx index 52d1b599..5f795ba8 100644 --- a/src/components/Modals/Transfer/index.tsx +++ b/src/components/Modals/Transfer/index.tsx @@ -18,7 +18,7 @@ import { transferRegionOnCoretimeChain, } from '@/utils/native/transfer'; -import { RegionCard } from '@/components/elements'; +import { RegionCard } from '@/components/Elements'; import { useCoretimeApi } from '@/contexts/apis'; import { CONTRACT_XC_REGIONS } from '@/contexts/apis/consts'; diff --git a/src/components/Modals/Unlist/index.tsx b/src/components/Modals/Unlist/index.tsx index 90bb0626..8d560577 100644 --- a/src/components/Modals/Unlist/index.tsx +++ b/src/components/Modals/Unlist/index.tsx @@ -10,7 +10,7 @@ import { contractTx, useContract, useInkathon } from '@scio-labs/use-inkathon'; import { Region } from 'coretime-utils'; import { useState } from 'react'; -import { RegionCard } from '@/components/elements'; +import { RegionCard } from '@/components/Elements'; import { CONTRACT_MARKET } from '@/contexts/apis/consts'; import { useMarket } from '@/contexts/market'; @@ -72,10 +72,9 @@ export const UnlistModal = ({ setWorking(false); } catch (e: any) { toastError( - `Failed to unlist region from sale. Error: ${ - e.errorMessage === 'Error' - ? 'Please check your balance.' - : e.errorMessage + `Failed to unlist region from sale. Error: ${e.errorMessage === 'Error' + ? 'Please check your balance.' + : e.errorMessage }` ); setWorking(false); diff --git a/src/components/Modals/index.ts b/src/components/Modals/index.ts index d8a691a6..79dfc91d 100644 --- a/src/components/Modals/index.ts +++ b/src/components/Modals/index.ts @@ -1,6 +1,8 @@ export * from './Interlace'; export * from './Partition'; +export * from './Purchase'; export * from './Sell'; export * from './TaskAssign'; export * from './Transfer'; +export * from './Unlist'; export * from './WalletConnect'; diff --git a/src/pages/transfer/ChainSelector.tsx b/src/components/Selectors/ChainSelector/index.tsx similarity index 91% rename from src/pages/transfer/ChainSelector.tsx rename to src/components/Selectors/ChainSelector/index.tsx index b9aaf5fe..90eb8507 100644 --- a/src/pages/transfer/ChainSelector.tsx +++ b/src/components/Selectors/ChainSelector/index.tsx @@ -22,9 +22,3 @@ export const ChainSelector = ({ chain, setChain }: ChainSelectorProps) => { ); }; - -const page = () => { - return <>; -}; - -export default page; diff --git a/src/components/elements/RecipientSelector/index.tsx b/src/components/Selectors/RecipientSelector/index.tsx similarity index 100% rename from src/components/elements/RecipientSelector/index.tsx rename to src/components/Selectors/RecipientSelector/index.tsx diff --git a/src/pages/transfer/RegionSelector.tsx b/src/components/Selectors/RegionSelector/index.tsx similarity index 93% rename from src/pages/transfer/RegionSelector.tsx rename to src/components/Selectors/RegionSelector/index.tsx index 47436195..968e15c1 100644 --- a/src/pages/transfer/RegionSelector.tsx +++ b/src/components/Selectors/RegionSelector/index.tsx @@ -32,9 +32,3 @@ export const RegionSelector = ({ ); }; - -const page = () => { - return <>; -}; - -export default page; diff --git a/src/components/Selectors/index.ts b/src/components/Selectors/index.ts new file mode 100644 index 00000000..4d14d6b7 --- /dev/null +++ b/src/components/Selectors/index.ts @@ -0,0 +1,3 @@ +export * from './ChainSelector'; +export * from './RecipientSelector'; +export * from './RegionSelector'; \ No newline at end of file diff --git a/src/components/Sidebar/index.tsx b/src/components/Sidebar/index.tsx index 4c58f988..346c8731 100644 --- a/src/components/Sidebar/index.tsx +++ b/src/components/Sidebar/index.tsx @@ -12,7 +12,7 @@ import { ApiState } from '@/contexts/apis/types'; import { TransferIcon } from '@/icons'; import styles from './index.module.scss'; -import { StatusIndicator } from '../elements'; +import { StatusIndicator } from '../Elements'; interface MenuItemProps { label: string; @@ -27,9 +27,8 @@ const MenuItem = ({ label, enabled, route, icon }: MenuItemProps) => { return ( enabled && route && push(route)} > {{ diff --git a/src/components/elements/index.ts b/src/components/elements/index.ts deleted file mode 100644 index 54ccf9af..00000000 --- a/src/components/elements/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './Label'; -export * from './RegionCard'; -export * from './StatusIndicator'; diff --git a/src/components/index.ts b/src/components/index.ts index 277b525d..a9e2384b 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -1,5 +1,6 @@ -export * from './elements'; +export * from './Elements'; export * from './Header'; export * from './Layout'; export * from './Modals'; +export * from './Selectors'; export * from './Sidebar'; diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 69d9509b..53bed76d 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -12,7 +12,7 @@ import '../../styles/global.scss'; import createEmotionCache from '@/utils/createEmotionCache'; import theme from '@/utils/muiTheme'; -import { Layout } from '@/components/Layout'; +import { Layout } from '@/components'; import { CoretimeApiContextProvider, diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 2c05e054..5e90f92e 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,6 +1,6 @@ import { Box, Grid, Typography, useTheme } from '@mui/material'; -import FeatureCard from '@/components/elements/FeatureCard'; +import { FeatureCard } from '@/components'; import Chart from '@/assets/chart.png'; import Config from '@/assets/config.png'; diff --git a/src/pages/market/marketplace.tsx b/src/pages/market/marketplace.tsx index b27867d0..26398cf1 100644 --- a/src/pages/market/marketplace.tsx +++ b/src/pages/market/marketplace.tsx @@ -3,9 +3,7 @@ import { useEffect, useState } from 'react'; import theme from '@/utils/muiTheme'; -import { ListingCard } from '@/components/elements/ListingCard'; -import MarketFilters from '@/components/elements/MarketFilters'; -import { PurchaseModal } from '@/components/Modals/Purchase'; +import { ListingCard, MarketFilters, PurchaseModal } from '@/components'; import { useMarket } from '@/contexts/market'; import { Listing } from '@/models'; diff --git a/src/pages/purchase.tsx b/src/pages/purchase.tsx index e26fdc58..8b49dd35 100644 --- a/src/pages/purchase.tsx +++ b/src/pages/purchase.tsx @@ -15,8 +15,7 @@ import { parseHNString, } from '@/utils/functions'; -import Progress, { Section } from '@/components/elements/Progress'; -import SaleInfoGrid from '@/components/elements/SaleInfo'; +import { Progress, SaleInfoGrid, Section } from '@/components'; import { useCoretimeApi } from '@/contexts/apis'; import { ApiState } from '@/contexts/apis/types'; @@ -209,11 +208,11 @@ const Purchase = () => { {loading || - !currentPhase || - !saleEnd || - !currentBlockNumber || - !progress || - !saleEndTimestamp ? ( + !currentPhase || + !saleEnd || + !currentBlockNumber || + !progress || + !saleEndTimestamp ? ( <> Connect your wallet diff --git a/src/pages/transfer/index.tsx b/src/pages/transfer/index.tsx index 2287f4c5..f2446dc8 100644 --- a/src/pages/transfer/index.tsx +++ b/src/pages/transfer/index.tsx @@ -28,8 +28,7 @@ import { transferRegionOnCoretimeChain, } from '@/utils/native/transfer'; -import { RegionCard } from '@/components'; -import { RecipientSelector } from '@/components/elements/RecipientSelector'; +import { ChainSelector, RecipientSelector, RegionCard, RegionSelector } from '@/components'; import { useCoretimeApi } from '@/contexts/apis'; import { CONTRACT_XC_REGIONS } from '@/contexts/apis/consts'; @@ -39,9 +38,6 @@ import { useToast } from '@/contexts/toast'; import XcRegionsMetadata from '@/contracts/xc_regions.json'; import { RegionLocation, RegionMetadata } from '@/models'; -import { ChainSelector } from './ChainSelector'; -import { RegionSelector } from './RegionSelector'; - const Page = () => { const { activeAccount, activeSigner, api: contractsApi } = useInkathon(); const { contract } = useContract(XcRegionsMetadata, CONTRACT_XC_REGIONS);