You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.1 KiB
42 lines
1.1 KiB
import React, { useCallback, useState } from 'react';
|
|
import Link from 'Components/Link/Link';
|
|
import IndexerInfoModal from './Info/IndexerInfoModal';
|
|
import styles from './IndexerTitleLink.css';
|
|
|
|
interface IndexerTitleLinkProps {
|
|
indexerId: number;
|
|
title: string;
|
|
onCloneIndexerPress(id: number): void;
|
|
}
|
|
|
|
function IndexerTitleLink(props: IndexerTitleLinkProps) {
|
|
const { title, indexerId, onCloneIndexerPress } = props;
|
|
|
|
const [isIndexerInfoModalOpen, setIsIndexerInfoModalOpen] = useState(false);
|
|
|
|
const onIndexerInfoPress = useCallback(() => {
|
|
setIsIndexerInfoModalOpen(true);
|
|
}, [setIsIndexerInfoModalOpen]);
|
|
|
|
const onIndexerInfoModalClose = useCallback(() => {
|
|
setIsIndexerInfoModalOpen(false);
|
|
}, [setIsIndexerInfoModalOpen]);
|
|
|
|
return (
|
|
<div>
|
|
<Link className={styles.link} onPress={onIndexerInfoPress}>
|
|
{title}
|
|
</Link>
|
|
|
|
<IndexerInfoModal
|
|
indexerId={indexerId}
|
|
isOpen={isIndexerInfoModalOpen}
|
|
onModalClose={onIndexerInfoModalClose}
|
|
onCloneIndexerPress={onCloneIndexerPress}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default IndexerTitleLink;
|