fix: art selector

This commit is contained in:
bartosz-lipinski 2021-04-26 17:05:45 -05:00
parent f8c5458d48
commit 127eeb03cf
3 changed files with 32 additions and 26 deletions

View File

@ -242,8 +242,6 @@ export const mintNFT = async (
updateSigners,
);
debugger;
notify({
message: 'Art created on Solana',
description: (

View File

@ -46,11 +46,13 @@ export const ArtSelector = (props: ArtSelectorProps) => {
};
const confirm = () => {
let list = items.filter(item =>
selectedItems.has(item.metadata.pubkey.toBase58()),
);
setSelected(list);
close();
setTimeout(() => {
let list = items.filter(item =>
selectedItems.has(item.metadata.pubkey.toBase58()),
);
setSelected(list);
close();
}, 200);
};
const breakpointColumnsObj = {
@ -131,9 +133,11 @@ export const ArtSelector = (props: ArtSelectorProps) => {
list = [];
}
isSelected
? setSelectedItems(new Set(list.filter(item => item !== id)))
: setSelectedItems(new Set([...list, id]));
const newSet = isSelected
? new Set(list.filter(item => item !== id))
: new Set([...list, id]);
setSelectedItems(newSet);
if (!allowMultiple) {
confirm();

View File

@ -57,6 +57,7 @@ import {
SafetyDepositDraft,
} from '../../actions/createAuctionManager';
import BN from 'bn.js';
import { ZERO } from '@oyster/common/dist/lib/constants';
const { Step } = Steps;
const { Option } = Select;
@ -110,6 +111,8 @@ export interface AuctionState {
spots?: number;
tiers?: Array<Tier>;
winnersCount: number;
}
export const AuctionCreateView = () => {
@ -128,6 +131,7 @@ export const AuctionCreateView = () => {
items: [],
category: AuctionCategory.Open,
saleType: 'auction',
winnersCount: 1,
});
useEffect(() => {
@ -154,28 +158,27 @@ export const AuctionCreateView = () => {
winnerLimit = new WinnerLimit({
type: WinnerLimitType.Unlimited,
usize: new BN(0),
usize: ZERO,
});
} else if (attributes.category == AuctionCategory.Single) {
settings = new AuctionManagerSettings({
openEditionWinnerConstraint: WinningConstraint.NoOpenEdition,
openEditionNonWinningConstraint: NonWinningConstraint.NoOpenEdition,
winningConfigs: [
{
safetyDepositBoxIndex: 0,
amount: 1,
hasAuthority: false,
editionType: items[0].masterEdition
? EditionType.MasterEdition
: EditionType.NA,
},
],
winningConfigs: attributes.items.map((item, index) => ({
// TODO: check index
safetyDepositBoxIndex: index,
amount: 1,
hasAuthority: false,
editionType: item.masterEdition
? EditionType.MasterEdition
: EditionType.NA,
})),
openEditionConfig: null,
openEditionFixedPrice: null,
});
winnerLimit = new WinnerLimit({
type: WinnerLimitType.Capped,
usize: new BN(1),
usize: new BN(attributes.winnersCount),
});
} else {
throw new Error('Not supported');
@ -188,7 +191,8 @@ export const AuctionCreateView = () => {
winnerLimit,
new BN((attributes.auctionDuration || 1) * 60),
new BN((attributes.gapTime || 1) * 60),
[items[0]],
attributes.items,
// TODO: move to config
new PublicKey('4XEUcBjLyBHuMDKTARycf4VXqpsAsDcThMbhWgFuDGsC'),
);
};
@ -356,7 +360,7 @@ export const AuctionCreateView = () => {
)}
<Col {...(saving ? { xl: 24 } : { xl: 16, md: 17 })}>
{stepsByCategory[attributes.category][step][1]}
{0 < step && step < stepsByCategory[attributes.category].length && (
{0 < step && step < (stepsByCategory[attributes.category].length -1) && (
<Button
style={{ width: '100%' }}
onClick={() => gotoNextStep(step - 1)}
@ -489,7 +493,7 @@ const CopiesStep = (props: {
>
Select NFT
</ArtSelector>
<label className="action-field">
{props.attributes.category !== AuctionCategory.Open && <label className="action-field">
<span className="field-title">
How many copies do you want to create?
</span>
@ -507,7 +511,7 @@ const CopiesStep = (props: {
})
}
/>
</label>
</label>}
</Col>
</Row>
<Row>