-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor(web): create Option type for Dropdown options * chore(web): update changeset * refactor(web): use label in Dropdown selected option display * refactor(web): update Dropdown component main filename * refactor(web): remove nested /components folder in Dropdown * feat(web): render value when no label in Dropdown * feat(web): add prefix slot to Dropdown option * feat(web): add filter panel with rollup filter in PaginatedTable * chore(web): update changeset * refactor(web): rename main PaginedTable filename * refactor(web): rename main FilersPanel filename * refactor(web): update RollupFilter component to fetch rollups from API * feat(web): add filters to query params * fix(web): pages number calculation in PaginatedTable * fix(web): pages number calculation in PaginatedTable * refactor(web): simplify dropdowns options * feat(web): add clear button for filter * Separate Prisma enums to their own file (#523) * chore: add `@prisma/generator-helper` dep * chore(db): set up prisma enum generator * refactor: import prisma enums from generated file instead of prisma client * chore(db): add comment to enum generator referencing source * fix(web): rollback `StorageIcon` prop change * chore(vercel): run prisma generation and migrations within `db` package * fix(web): resolve rollup filtering issue * chore: add changeset * Abstract rollup addresses into its own package (#524) * chore: add `@prisma/generator-helper` dep * chore(db): set up prisma enum generator * refactor: import prisma enums from generated file instead of prisma client * chore(db): add comment to enum generator referencing source * fix(web): rollback `StorageIcon` prop change * chore(vercel): run prisma generation and migrations within `db` package * fix(web): resolve rollup filtering issue * chore: add changeset * feat: create rollups package * refactor: use `@blobscan/rollups` package * feat(rollups): add support for retrieving a rollup by its address * chore: add changeset * feat(rollups): add support for retrieving all chain's available rollups * chore: add changeset * test(rollups): add tests * test(rollups): add tests to verify correct behavior when retrieving non-existent values * chore(rollups): set ininitial version * feat(docs): list `rollups` package * chore: fix `@blobscan/rollups` version * refactor(web): display selected rollup icon on rollup dropdown * refactor(web): refactor `Filters` component * feat(web): add support for filtering by no rollup * feat(web): add clear button to dropdown + make rollup filter clearable * chore: add changeset * refactor(web): extract query parameter logic into a custom hook * fix(web): sync rollup filter dropdown with URL query parameter for consistent selection * feat(rollups): return rollup's address and name when fetching chain's rollups * chore: add changeset * fix(web): use rollup's address when filtering elements by rollup * chore: add changeset * fix(web): ensure rollup address query parameter stays consistent with rollup filter dropdown value --------- Co-authored-by: Luis Herasme <[email protected]> Co-authored-by: elessar.eth <[email protected]>
- Loading branch information
1 parent
04ae214
commit 16870e4
Showing
76 changed files
with
800 additions
and
374 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@blobscan/rollups": minor | ||
--- | ||
|
||
Updated the chain rollups retrieval to return both the rollup name and address for each rollup. |
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,5 @@ | ||
--- | ||
"@blobscan/web": minor | ||
--- | ||
|
||
Enhanced dropdowns with clearable option support |
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,5 @@ | ||
--- | ||
"@blobscan/rollups": minor | ||
--- | ||
|
||
Added support for retrieving rollups by their addresses |
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,5 @@ | ||
--- | ||
"@blobscan/rollups": minor | ||
--- | ||
|
||
Added support for retrieving all chain's available rollups |
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,5 @@ | ||
--- | ||
"@blobscan/web": patch | ||
--- | ||
|
||
Added support for clearing dropdown |
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,5 @@ | ||
--- | ||
"@blobscan/db": minor | ||
--- | ||
|
||
Exposed Prisma enums from a separated file |
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,5 @@ | ||
--- | ||
"@blobscan/web": minor | ||
--- | ||
|
||
Added rollup filter to blobs, blocks and transactions views |
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
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
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,49 @@ | ||
import type { FC } from "react"; | ||
|
||
import { getChainRollups } from "@blobscan/rollups"; | ||
|
||
import { Dropdown } from "~/components/Dropdown"; | ||
import type { DropdownProps, Option } from "~/components/Dropdown"; | ||
import { RollupIcon } from "~/components/RollupIcon"; | ||
import { env } from "~/env.mjs"; | ||
import type { Rollup } from "~/types"; | ||
import { capitalize, getChainIdByName } from "~/utils"; | ||
|
||
type RollupFilterProps = Pick<DropdownProps, "selected"> & { | ||
onChange(newRollup: Option | null): void; | ||
}; | ||
|
||
const chainId = getChainIdByName(env.NEXT_PUBLIC_NETWORK_NAME); | ||
const rollups = chainId ? getChainRollups(chainId) : []; | ||
|
||
export const ROLLUP_OPTIONS: Option[] = [ | ||
{ | ||
value: "null", | ||
label: "None", | ||
}, | ||
...rollups.map(([rollupAddress, rollupName]) => ({ | ||
value: rollupAddress, | ||
label: ( | ||
<div className="flex items-center gap-2"> | ||
<RollupIcon rollup={rollupName.toLowerCase() as Rollup} /> | ||
{capitalize(rollupName)} | ||
</div> | ||
), | ||
})), | ||
]; | ||
|
||
export const RollupFilter: FC<RollupFilterProps> = function ({ | ||
onChange, | ||
selected, | ||
}) { | ||
return ( | ||
<Dropdown | ||
selected={selected} | ||
options={ROLLUP_OPTIONS} | ||
onChange={onChange} | ||
placeholder="Rollup" | ||
width="w-40" | ||
clearable | ||
/> | ||
); | ||
}; |
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,67 @@ | ||
import { useEffect, useState } from "react"; | ||
import type { FC } from "react"; | ||
import { useRouter } from "next/router"; | ||
import type { UrlObject } from "url"; | ||
|
||
import { Button } from "~/components/Button"; | ||
import { useQueryParams } from "~/hooks/useQueryParams"; | ||
import type { Option } from "../Dropdown"; | ||
import { ROLLUP_OPTIONS, RollupFilter } from "./RollupFilter"; | ||
|
||
export const Filters: FC = function () { | ||
const router = useRouter(); | ||
const queryParams = useQueryParams(); | ||
const [selectedRollup, setSelectedRollup] = useState<Option | null>(null); | ||
const disableClear = !selectedRollup; | ||
|
||
const handleFilter = () => { | ||
const query: UrlObject["query"] = {}; | ||
|
||
if (selectedRollup) { | ||
if (selectedRollup.value === "null") { | ||
query.rollup = selectedRollup.value; | ||
} else { | ||
query.from = selectedRollup.value; | ||
} | ||
} | ||
|
||
router.push({ | ||
pathname: router.pathname, | ||
query, | ||
}); | ||
}; | ||
|
||
const handleClear = () => { | ||
setSelectedRollup(null); | ||
}; | ||
|
||
useEffect(() => { | ||
if (queryParams.rollup || queryParams.from) { | ||
const rollupOption = ROLLUP_OPTIONS.find( | ||
(opt) => | ||
opt.value === queryParams.rollup || opt.value === queryParams.from | ||
); | ||
|
||
if (rollupOption) { | ||
setSelectedRollup(rollupOption); | ||
} | ||
} | ||
}, [queryParams]); | ||
|
||
return ( | ||
<div className="flex flex-col justify-between gap-2 rounded-lg bg-slate-50 p-2 dark:bg-primary-900 sm:flex-row"> | ||
<RollupFilter | ||
selected={selectedRollup} | ||
onChange={(newRollup) => { | ||
setSelectedRollup(newRollup); | ||
}} | ||
/> | ||
<div className="flex flex-row gap-2"> | ||
<Button variant="outline" onClick={handleClear} disabled={disableClear}> | ||
Clear | ||
</Button> | ||
<Button onClick={handleFilter}>Filter</Button> | ||
</div> | ||
</div> | ||
); | ||
}; |
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
Oops, something went wrong.