import { InfinityMintProjectPath } from 'infinitymint/dist/app/interfaces'; import React, { useContext, useEffect, useState } from 'react'; import { Alert, Button, Card, Col, Container, ListGroup, Row, Toast, } from 'react-bootstrap'; import { Project } from '../../../core/project'; import { ClientContext } from '../../../contexts/clientProvider'; import Loading from '../../bootstrap/Loading'; import PathImage from '../../bootstrap/PathImage'; export default function View({ selectTab, path, project, }: { path?: InfinityMintProjectPath; project?: Project; selectTab: (tab: string, props?: any) => void; }) { const [currentPath, setCurrentPath] = useState(null); const [loaded, setLoaded] = useState(false); const client = useContext(ClientContext); useEffect(() => { if (!client.loaded) return; if (!path) return; let newProject = project || client.project; if (!newProject) return; setCurrentPath(path); setLoaded(true); }, [project, path, client]); let nextPath = project.deployedProject?.paths?.[path.pathId + 1]; let prevPath = project.deployedProject?.paths?.[path.pathId - 1]; return ( {!loaded ? ( ) : ( <> {prevPath ? (

{prevPath.name}


PathId{' '} {prevPath.pathId} Rarity{' '} {prevPath?.rarity || ( (project ?.deployedProject ?.paths ?.length || 1) / 100 ).toFixed(2)} %
) : null} {nextPath ? (

{nextPath.name}


PathId{' '} {nextPath.pathId} Rarity{' '} {nextPath?.rarity || ( (project ?.deployedProject ?.paths ?.length || 1) / 100 ).toFixed(2)} %
) : null}

Overview{' '} New Path ➕ Disable Path ➖

{currentPath.name}{' '} PathId {currentPath.pathId}

{currentPath.description || 'No description...'}

Path Information name {' '} {path.name} pathId {' '} {path.pathId} filename {' '} {path.fileName.toString()} rarity {' '} {path.rarity}% checksum {' '} {path.checksum} extension {' '} {path.source?.extension?.split( '.' )?.[1] || 'unknown'} {' '} Export Locations ipfs {' '} {path.export.external?.ipfs !== undefined ? 'yes' : 'no'} web2 {' '} {path.export.external?.web2 !== undefined ? 'yes' : 'no'} public {' '} {path.export.exported !== undefined ? 'yes' : 'no'} api {' '} {client.controller?.apiAccess ? 'yes' : 'no'}

Content{' '} New Content ➕

{Object.values(path.content).length === 0 ? ( No Content Available In Path ) : ( {Object.values(path.content).map( (content) => { return (

{content.name}

); } )}
)}

)}
); }