Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
"pnpm": {
"patchedDependencies": {
"purify-ts": "patches/purify-ts.patch",
"@stakekit/rainbowkit@2.2.11": "patches/@stakekit__rainbowkit@2.2.11.patch",
"vite-plugin-node-polyfills@0.26.0": "patches/vite-plugin-node-polyfills@0.26.0.patch"
"@stakekit/rainbowkit@2.2.11": "patches/@stakekit__rainbowkit@2.2.11.patch"
}
}
}
44 changes: 43 additions & 1 deletion packages/examples/with-vite-bundled/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 17 additions & 1 deletion packages/examples/with-vite-bundled/src/typescript.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 23 additions & 5 deletions packages/widget/src/assets/images/porto.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type VirtualGroupListProps = {
estimateSize: VirtualizerOptions<Element, Element>["estimateSize"];
} & InfiniteScrollProps;

export const VirtualList = <ItemData = unknown>({
export const VirtualList = <ItemData,>({
data,
itemContent,
className,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,15 @@ export const SelectValidator = ({
onClose?.();
};

const viewMore = multiSelect || _viewMore || !!rest.searchValue;
const hasRequestedMoreValidators = _viewMore || !!rest.searchValue;
const showExpandedValidators = multiSelect || hasRequestedMoreValidators;

const data = useMemo<{
tableData: ValidatorDto[];
groupedItems: GroupedItem[];
groupCounts: number[];
}>(() => {
if (!validators.length && hasMore && !viewMore) {
if (!validators.length && hasMore && !hasRequestedMoreValidators) {
return {
tableData: [],
groupedItems: [{ items: [], label: "view_more" }],
Expand All @@ -97,7 +98,7 @@ export const SelectValidator = ({
(acc, val) => {
if (val.preferred) {
acc.preferred.items.push(val);
} else if (viewMore) {
} else if (showExpandedValidators) {
acc.other.items.push(val);
}

Expand All @@ -117,21 +118,26 @@ export const SelectValidator = ({

// If we do not have preferred validators, show all other
if (!groupedItems.preferred.items.length && validators.length) {
const canViewMore = !hasRequestedMoreValidators && !!hasMore;

return {
tableData: validators,
groupedItems: [
{
items: validators,
label: t("details.validators_other"),
},
...(canViewMore ? [{ items: [], label: "view_more" }] : []),
],
groupCounts: [validators.length],
groupCounts: [validators.length, ...(canViewMore ? [1] : [])],
};
}

const canViewMore =
!viewMore &&
(!!hasMore || groupedItems.preferred.items.length !== validators.length);
!hasRequestedMoreValidators &&
(!!hasMore ||
(!showExpandedValidators &&
groupedItems.preferred.items.length !== validators.length));

const groupedItemsValues = Object.values(groupedItems);

Expand All @@ -148,7 +154,13 @@ export const SelectValidator = ({
...(canViewMore ? [1] : []),
],
};
}, [hasMore, validators, t, viewMore]);
}, [
hasMore,
validators,
t,
hasRequestedMoreValidators,
showExpandedValidators,
]);

const searchProps = rest.onSearch
? {
Expand All @@ -157,7 +169,7 @@ export const SelectValidator = ({
}
: {};
const infiniteScrollProps =
viewMore && onLoadMore
hasRequestedMoreValidators && onLoadMore
? {
hasNextPage: !!hasMore,
isFetchingNextPage: !!isLoadingMore,
Expand Down
Loading