Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blockchains from homepage UI when syncing is disabled in server settings #123

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
80 changes: 41 additions & 39 deletions rair-front/src/components/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,50 +18,52 @@ const Dropdown = ({
const isChecked = !!selectedOptions?.find(
(selectedOption) => selectedOption?.optionId === option.optionId
);
return (
<li
key={idx + Math.random() * 1_000_000}
className={`dropdown-option`}>
{option?.dropDownImg && (
<div
key={idx + Math.random() * 1_000_000}
className={`dropdownn-chain-icons ${
isMobileDesign ? 'mobile-chain-icons' : ''
}`}>
<img
if(option?.display !== false) {
return (
<li
key={idx + Math.random() * 1_000_000}
className={`dropdown-option`}>
{option?.dropDownImg && (
<div
key={idx + Math.random() * 1_000_000}
className={`dropdownn-chain-icons ${
isMobileDesign ? 'mobile-chain-icons' : ''
}`}
src={`${
option?.chainId && chainData[option?.chainId]?.image
}`}
alt="blockchain-img"
}`}>
<img
className={`dropdownn-chain-icons ${
isMobileDesign ? 'mobile-chain-icons' : ''
}`}
src={`${
option?.chainId && chainData[option?.chainId]?.image
}`}
alt="blockchain-img"
key={idx + Math.random() * 1_000_000}
/>
</div>
)}
{dropdownIMG}
<div
className="dropdown-option-wrapper"
key={idx + Math.random() * 1_000_000}>
<span
key={idx + Math.random() * 1_000_000}
className="dropdown-option-text">
{option.name}
</span>
<input
className={`dropdown-option-checkbox ${
isMobileDesign ? 'mobile-checkbox' : ''
}`}
data-title={`${option?.chainId ? 'blockchain' : 'category'}`}
type="checkbox"
value={option.optionId}
onChange={onDropdownChange}
checked={isChecked}
/>
</div>
)}
{dropdownIMG}
<div
className="dropdown-option-wrapper"
key={idx + Math.random() * 1_000_000}>
<span
key={idx + Math.random() * 1_000_000}
className="dropdown-option-text">
{option.name}
</span>
<input
className={`dropdown-option-checkbox ${
isMobileDesign ? 'mobile-checkbox' : ''
}`}
data-title={`${option?.chainId ? 'blockchain' : 'category'}`}
type="checkbox"
value={option.optionId}
onChange={onDropdownChange}
checked={isChecked}
/>
</div>
</li>
);
</li>
);
}
})}
</ul>
</div>
Expand Down
1 change: 1 addition & 0 deletions rair-front/src/components/Dropdown/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export type TOption = {
clicked?: boolean;
dropDownImg?: boolean;
optionId?: number;
display?: boolean;
};
export type TDropdownProps = {
options: Array<TOption>;
Expand Down
53 changes: 24 additions & 29 deletions rair-front/src/components/GlobalModal/FilterModal/FilterModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import Dropdown from '../../Dropdown/Dropdown';
import { closeModal, openModal } from '../helpers/OnOpenModal';

import './styles.css';
import useServerSettings from '../../adminViews/useServerSettings';
export type THomePageFilterModalProps = {
isMobileDesign?: boolean;
className?: stirng;
Expand All @@ -56,32 +57,9 @@ const HomePageFilterModal: FC<THomePageFilterModalProps> = ({
};
});

// const categories = [
// {
// name: 'Music',
// clicked: false,
// optionId: 7,
// categoryId: '62b459f9a64260001c1e205e'
// },
// {
// name: 'Art',
// clicked: false,
// optionId: 8,
// categoryId: '62b459f9a64260001c1e205f'
// },
// {
// name: 'Conference',
// clicked: false,
// optionId: 9,
// categoryId: '62b459f9a64260001c1e2060'
// },
// {
// name: 'Science',
// clicked: false,
// optionId: 10,
// categoryId: '62b459f9a64260001c1e2061'
// }
// ];
const serverSettings = useServerSettings();

const [blockchainsArray, setBlockchainsArray] = useState(undefined);

const [categories, setCategories] = useState([]);
const { globalModalState, globalModaldispatch } =
Expand Down Expand Up @@ -163,6 +141,23 @@ const HomePageFilterModal: FC<THomePageFilterModalProps> = ({
}
}, [selectedBchItems, setFilterText, setIsShow]);

useEffect(() => {
if(serverSettings.blockchainSettings) {
const filteredblockchainSettings = serverSettings.blockchainSettings.filter((el) => {
if(Object.keys(blockchainData).includes(el.hash)) {
return el;
}
}).map((item) => {
const itemBlockchain = blockchains.find(element => element.chainId === item.hash);
return {
...itemBlockchain,
display: item.sync
}
})
setBlockchainsArray(filteredblockchainSettings);
}
}, [serverSettings.blockchainSettings]);

useEffect(() => {
if (selectedCatItems) {
setSelectedCategories(selectedCatItems);
Expand Down Expand Up @@ -563,13 +558,13 @@ const HomePageFilterModal: FC<THomePageFilterModalProps> = ({
primaryColor={primaryColor}
/>
}>
<Dropdown
{blockchainsArray && <Dropdown
onDropdownChange={onOptionChange}
options={blockchains}
options={blockchainsArray}
selectedOptions={selectedBchItems && selectedBchItems}
key={Math.random() * 1_000_000}
isMobileDesign={isMobileDesign && isMobileDesign}
/>
/>}
</AccordionItem>
</CustomAccordion>
<div className="filter-modal-btn-container ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ const PaginationBox: React.FC<IPaginationBox> = ({
(store) => store.nftDataStore.itemsPerPage
);

console.info(totalPageForPagination, 'totalPageForPagination');
console.info(itemsPerPageNotifications, 'itemsPerPageNotifications')

const { primaryColor, primaryButtonColor } = useSelector<
RootState,
ColorStoreType
Expand All @@ -30,8 +27,6 @@ const PaginationBox: React.FC<IPaginationBox> = ({
const [totalPage, setTotalPages] = useState<number>();
const [totalPageVideo, setTotalPagesVideo] = useState<number>();

console.info(totalPage, 'totalPage')

// const hotdropsVar = import.meta.env.VITE_TESTNET;

const pagesArray: number[] = [];
Expand Down
2 changes: 1 addition & 1 deletion rair-front/src/utils/blockchainData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ const chainData: TChainData = {
image: BaseLogo,
name: 'Base Mainnet',
chainId: '0x2105',
symbol: 'ETH',
symbol: 'bETH',
addChainData: {
chainId: '0x2105',
chainName: 'Base',
Expand Down