diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 45d25427..06d6385d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: branches: [master] jobs: - build: + build-and-test: runs-on: ubuntu-latest steps: diff --git a/src/components/Modals/Interlace/index.tsx b/src/components/Modals/Interlace/index.tsx index 67c85428..ee2e2fbc 100644 --- a/src/components/Modals/Interlace/index.tsx +++ b/src/components/Modals/Interlace/index.tsx @@ -45,20 +45,16 @@ export const InterlaceModal = ({ const { fetchRegions } = useRegions(); const currentMask = regionMetadata.region.getMask().toBin(); + // Represents the first active bit in the bitmap. const oneStart = currentMask.indexOf('1'); + // Represents the last active bit in the bitmap. const oneEnd = currentMask.lastIndexOf('1'); const activeBits = oneEnd - oneStart + 1; const [working, setWorking] = useState(false); const [position, setPosition] = useState(oneStart); - const generateMask = (position: number): string => { - const mask = Array(COREMASK_BIT_LEN).fill('0'); - for (let i = oneStart; i <= position; ++i) mask[i] = '1'; - return mask.join(''); - }; - - const newMask = generateMask(position); + const newMask = CoreMask.fromChunk(oneStart, position + 1).toBin(); const onInterlace = async () => { if (!api || !activeAccount || !activeSigner) return; diff --git a/src/pages/purchase/index.tsx b/src/pages/purchase.tsx similarity index 99% rename from src/pages/purchase/index.tsx rename to src/pages/purchase.tsx index 4c295dc9..accdc9c6 100644 --- a/src/pages/purchase/index.tsx +++ b/src/pages/purchase.tsx @@ -29,7 +29,7 @@ import { getSaleEndInBlocks, getSaleProgress, getSaleStartInBlocks, -} from '../../utils/sale/util'; +} from '../utils/sale/utils'; const Purchase = () => { const theme = useTheme(); diff --git a/src/utils/sale/util.test.ts b/src/utils/sale/utils.test.ts similarity index 99% rename from src/utils/sale/util.test.ts rename to src/utils/sale/utils.test.ts index 0e869f67..1c256c60 100644 --- a/src/utils/sale/util.test.ts +++ b/src/utils/sale/utils.test.ts @@ -6,7 +6,7 @@ import { getSaleEndInBlocks, getSaleProgress, getSaleStartInBlocks, -} from './util'; +} from './utils'; describe('Purchase page', () => { const mockSaleInfo: SaleInfo = { diff --git a/src/utils/sale/util.ts b/src/utils/sale/utils.ts similarity index 100% rename from src/utils/sale/util.ts rename to src/utils/sale/utils.ts