generated from stacks-network/.github
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: nakamoto epoch 3.0 blocklist
- Loading branch information
Showing
111 changed files
with
4,319 additions
and
601 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 1 addition & 5 deletions
6
src/app/_components/BlockList/AnimatedBlockAndMicroblocksItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
.../_components/BlockList/LayoutA/context.ts → ..._components/BlockList/BlockListContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
src/app/_components/BlockList/BlocksPage/BlocksPageBlockList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
'use client'; | ||
|
||
import { useCallback, useRef } from 'react'; | ||
|
||
import { Section } from '../../../../common/components/Section'; | ||
import { Stack } from '../../../../ui/Stack'; | ||
import { ExplorerErrorBoundary } from '../../ErrorBoundary'; | ||
import { useBlockListContext } from '../BlockListContext'; | ||
import { BlockListProvider } from '../BlockListProvider'; | ||
import { Controls } from '../Controls'; | ||
import { BlocksPageBlockListGrouped } from './BlocksPageBlockListGrouped'; | ||
import { BlocksPageBlockListUngrouped } from './BlocksPageBlockListUngrouped'; | ||
|
||
function BlocksPageBlockListBase() { | ||
const { groupedByBtc, setGroupedByBtc, liveUpdates, setLiveUpdates } = useBlockListContext(); | ||
|
||
const lastClickTimeRef = useRef(0); | ||
const toggleLiveUpdates = useCallback(() => { | ||
const now = Date.now(); | ||
if (now - lastClickTimeRef.current > 2000) { | ||
lastClickTimeRef.current = now; | ||
setLiveUpdates(!liveUpdates); | ||
} | ||
}, [liveUpdates, setLiveUpdates]); | ||
|
||
return ( | ||
<Section> | ||
<Stack | ||
marginX={-6} | ||
px={6} | ||
borderBottom={liveUpdates ? '1px solid var(--stacks-colors-borderPrimary)' : 'none'} | ||
> | ||
<Controls | ||
groupByBtc={{ | ||
onChange: () => { | ||
setGroupedByBtc(!groupedByBtc); | ||
}, | ||
isChecked: groupedByBtc, | ||
}} | ||
liveUpdates={{ | ||
onChange: toggleLiveUpdates, | ||
isChecked: liveUpdates, | ||
}} | ||
horizontal={true} | ||
/> | ||
</Stack> | ||
{groupedByBtc ? <BlocksPageBlockListGrouped /> : <BlocksPageBlockListUngrouped />} | ||
</Section> | ||
); | ||
} | ||
|
||
export function BlocksPageBlockList() { | ||
return ( | ||
<ExplorerErrorBoundary | ||
Wrapper={Section} | ||
wrapperProps={{ | ||
gridColumnStart: ['1', '1', '2'], | ||
gridColumnEnd: ['2', '2', '3'], | ||
minWidth: 0, | ||
}} | ||
tryAgainButton | ||
> | ||
<BlockListProvider> | ||
<BlocksPageBlockListBase /> | ||
</BlockListProvider> | ||
</ExplorerErrorBoundary> | ||
); | ||
} |
57 changes: 57 additions & 0 deletions
57
src/app/_components/BlockList/BlocksPage/BlocksPageBlockListGrouped.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
'use client'; | ||
|
||
import { Suspense } from 'react'; | ||
|
||
import { ListFooter } from '../../../../common/components/ListFooter'; | ||
import { Section } from '../../../../common/components/Section'; | ||
import { Box } from '../../../../ui/Box'; | ||
import { Flex } from '../../../../ui/Flex'; | ||
import { ExplorerErrorBoundary } from '../../ErrorBoundary'; | ||
import { useBlockListContext } from '../BlockListContext'; | ||
import { BlockListGrouped } from '../Grouped/BlockListGrouped'; | ||
import { BlocksPageBlockListGroupedSkeleton } from '../Grouped/skeleton'; | ||
import { UpdateBar } from '../UpdateBar'; | ||
import { useBlocksPageBlockListGrouped } from '../data/useBlocksPageBlockListGrouped'; | ||
|
||
function BlocksPageBlockListGroupedBase() { | ||
const { liveUpdates } = useBlockListContext(); | ||
const { blockList, updateBlockList, isFetchingNextPage, hasNextPage, fetchNextPage } = | ||
useBlocksPageBlockListGrouped(); | ||
|
||
return ( | ||
<> | ||
{!liveUpdates && <UpdateBar blockList={blockList} onClick={updateBlockList} />} | ||
<Flex flexDirection="column" gap={4} pt={4}> | ||
<BlockListGrouped blockList={blockList} minimized={false} stxBlocksLimit={10} /> | ||
</Flex> | ||
<Box pt={5} pb={5}> | ||
{!liveUpdates && ( | ||
<ListFooter | ||
isLoading={isFetchingNextPage} | ||
hasNextPage={hasNextPage} | ||
fetchNextPage={fetchNextPage} | ||
label={'blocks'} | ||
/> | ||
)} | ||
</Box> | ||
</> | ||
); | ||
} | ||
|
||
export function BlocksPageBlockListGrouped() { | ||
return ( | ||
<ExplorerErrorBoundary | ||
Wrapper={Section} | ||
wrapperProps={{ | ||
gridColumnStart: ['1', '1', '2'], | ||
gridColumnEnd: ['2', '2', '3'], | ||
minWidth: 0, | ||
}} | ||
tryAgainButton | ||
> | ||
<Suspense fallback={<BlocksPageBlockListGroupedSkeleton />}> | ||
<BlocksPageBlockListGroupedBase /> | ||
</Suspense> | ||
</ExplorerErrorBoundary> | ||
); | ||
} |
Oops, something went wrong.