Skip to content

Commit

Permalink
Merge pull request #184 from SigwoTechnologies/fix/change-collection-…
Browse files Browse the repository at this point in the history
…information

Fix/change collection information
  • Loading branch information
AlefrankM authored Jan 16, 2023
2 parents a3a38fc + 77d0c0f commit 60802be
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 28 deletions.
3 changes: 1 addition & 2 deletions src/components/author/login-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import { useState } from 'react';
import Modal from 'react-bootstrap/Modal';
import constants from '../../common/configuration/constants';
import useMetamask from '../../features/auth/hooks/useMetamask';
import { selectAuthState } from '../../features/auth/store/auth.slice';

export const LoginModal = () => {
const { isAuthenticated } = useAppSelector(selectAuthState);
const { isAuthenticated } = useAppSelector((state) => state.auth);
const { sign } = useMetamask();

const [isModalOpen, setIsModalOpen] = useState(false);
Expand Down
22 changes: 12 additions & 10 deletions src/components/author/options-dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,19 @@ export const OptionsDropdown = () => {
visibility={visibilityModalEdit}
handleEditModalVisibility={handleEditModalVisibility}
/>
<ul className="list-inner">
<li>
<Anchor path="/author">My Profile</Anchor>
</li>
{isAuthenticated && (
<ul className="list-inner">
<li>
<Anchor path="/author">My Profile</Anchor>
</li>

<li>
<Anchor path="#" onClick={handleEditModalVisibility}>
Edit <MdEdit style={{ cursor: 'pointer' }} />
</Anchor>
</li>
</ul>
<li>
<Anchor path="#" onClick={handleEditModalVisibility}>
Edit <MdEdit style={{ cursor: 'pointer' }} />
</Anchor>
</li>
</ul>
)}
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,21 @@ import { EditCollectionModal } from './edit-collection-modal';

const CollectionIntroductionComponent = () => {
const dispatch = useAppDispatch();
const {
account: { address },
} = useAppSelector((state) => state.auth);
const { selectedCollection, isUploadingImage } = useAppSelector((state) => state.marketplace);
const [uploadPhoto, setUploadPhoto] = useState(false);
const [visibilityModalEdit, setVisibilityModalEdit] = useState(false);

const lastUpdateDate = new Date(selectedCollection.updatedAt).toLocaleDateString();

const handleSelectFile = async ([file]: [File]) => {
if (address !== selectedCollection.owner.address) {
dispatch(openToastError('You don"t have permission to change this picture'));
return;
}

if (!file) return;
dispatch(openToastInfo('Uploading image, please wait'));
dispatch(changePictureCollection({ file }));
Expand Down Expand Up @@ -78,27 +86,32 @@ const CollectionIntroductionComponent = () => {
onMouseEnter={() => setUploadPhoto(true)}
onMouseLeave={() => setUploadPhoto(false)}
/>
<MdAddAPhoto
style={{
position: 'absolute',
fontSize: '10rem',
backgroundColor: 'rgb(0,0,0,0.8)',
width: '100%',
height: '100%',
display: uploadPhoto ? 'flex' : 'none',
cursor: 'pointer',
}}
onMouseEnter={() => setUploadPhoto(true)}
onMouseLeave={() => setUploadPhoto(false)}
/>

{address === selectedCollection.owner.address && (
<MdAddAPhoto
style={{
position: 'absolute',
fontSize: '10rem',
backgroundColor: 'rgb(0,0,0,0.8)',
width: '100%',
height: '100%',
display: uploadPhoto ? 'flex' : 'none',
cursor: 'pointer',
}}
onMouseEnter={() => setUploadPhoto(true)}
onMouseLeave={() => setUploadPhoto(false)}
/>
)}
</Files>
</SpinnerContainer>
</div>

<div className="rn-author-info-content" style={{ textAlign: 'left' }}>
<h2 className="title-s">
{selectedCollection.name}{' '}
<MdEdit onClick={handleEditModalVisibility} style={{ cursor: 'pointer' }} />
{address === selectedCollection.owner.address && (
<MdEdit onClick={handleEditModalVisibility} style={{ cursor: 'pointer' }} />
)}
</h2>
<OverlayTrigger
placement="right"
Expand Down
5 changes: 3 additions & 2 deletions src/components/ui/spinner-container/spinner-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import ClipLoader from 'react-spinners/ClipLoader';
type Props = {
children: React.ReactNode;
isLoading: boolean;
style?: any;
};
export const SpinnerContainer: React.FC<Props> = ({ children, isLoading }) => (
<div className="spinner-container">
export const SpinnerContainer: React.FC<Props> = ({ children, isLoading, style }) => (
<div className="spinner-container" style={style}>
{children}
{isLoading && (
<div className="spinner-child">
Expand Down

0 comments on commit 60802be

Please sign in to comment.