-
-
Notifications
You must be signed in to change notification settings - Fork 775
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
Feat/collections #7446
Merged
Merged
Feat/collections #7446
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ede15ec
Create collections from cart view
zoek1 53f8787
Create grant collections
zoek1 20cd39c
Fix texts
zoek1 cb64697
Merge branch 'stable' into feat/collections
zoek1 6ecba4c
FIx integration error
zoek1 0881e89
Collection search and filtering
zoek1 dd4847e
Merge remote-tracking branch 'origin/stable' into feat/collections
zoek1 1d1c9c6
fix migration error
zoek1 334cdfc
Fix pagination
zoek1 2470b6a
Add add/delete grants and pagination for collection's grants
zoek1 89a60d2
Merge remote-tracking branch 'origin/stable' into feat/collections
zoek1 a6a876c
fix migration error
zoek1 1bf8672
QA round 2 for collections
zoek1 bd7ad47
Remove null state on when exists grants
zoek1 dcc871c
Save to existing collection
zoek1 bf97011
rename model name
thelostone-mc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
.collection-item { | ||
border-radius: 5px; | ||
display: flex; | ||
flex-direction: column; | ||
border: 1px solid #D3D3D3; | ||
background-color: var(--bg-shade-0); | ||
} | ||
|
||
.collection-item__content { | ||
margin-top: 1.0625rem; | ||
} | ||
|
||
.collection-item__title { | ||
line-height: 24px; | ||
overflow-y: hidden; | ||
font-weight: bold; | ||
margin-bottom: 15px; | ||
font-size: var(--fs-header); | ||
} | ||
|
||
.collection-item__title a { | ||
color: #454545; | ||
} | ||
|
||
.collection-item__pitch { | ||
color: #666666; | ||
height: 3.8rem; | ||
overflow: hidden; | ||
line-height: 22px; | ||
text-overflow: ellipsis; | ||
} | ||
|
||
.collection-item__owner { | ||
align-items: center; | ||
display: flex; | ||
} | ||
|
||
.collection-item__img--grid { | ||
display: grid; | ||
grid-template-columns: repeat(2, 1fr); | ||
} | ||
|
||
.collection-item__img { | ||
height: 11rem; | ||
background-color: #0D023B; | ||
overflow: hidden; | ||
padding: 10px 18px; | ||
} | ||
|
||
.collection-item__img__cover { | ||
background: linear-gradient(0deg, #FFFFFF, #FFFFFF), linear-gradient(0deg, #FFFFFF, #FFFFFF), linear-gradient(0deg, #FFFFFF, #FFFFFF), linear-gradient(0deg, #FFFFFF, #FFFFFF), #FFFFFF; | ||
border-radius: 2px; | ||
height: 75px; | ||
width: 96%; | ||
margin: 2px; | ||
} | ||
|
||
.collection-item__img img { | ||
width: 100%; | ||
object-fit: contain; | ||
height: 100%; | ||
} | ||
|
||
.collection-item__logo { | ||
background-color: white; | ||
border-radius: 10px; | ||
display: inline-block; | ||
margin-top: -35px; | ||
} | ||
|
||
.collection-item__logo img { | ||
width: 65px; | ||
height: 65px; | ||
object-fit: cover; | ||
border-radius: 50%; | ||
margin: 13px; | ||
} | ||
|
||
.collection-item__owner-image--cover { | ||
height: 60px; | ||
width: 60px; | ||
position: absolute; | ||
top: calc(50% - 30px); | ||
left: calc(50% - 30px); | ||
} | ||
|
||
.collection-item__owner-image { | ||
height: 20px; | ||
width: 20px; | ||
} | ||
|
||
.collection-item__owner-image img, .collection-item__owner-image--cover img { | ||
width: 100%; | ||
border-radius: 50%; | ||
} | ||
|
||
.grant-item__footer { | ||
margin-top: auto; | ||
background-color: rgba(156, 255, 213, 0.06); | ||
} | ||
|
||
.collection-item__info a { | ||
border-color: white; | ||
background-color: #6144FF; | ||
color: white; | ||
} | ||
|
||
.collection-item__info a:hover { | ||
color: white; | ||
text-decoration: underline; | ||
} | ||
|
||
|
||
.vertica-scroll { | ||
flex-direction: row; | ||
overflow-x: auto; | ||
flex-wrap: nowrap; | ||
margin-bottom: 25px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,7 @@ class CartData { | |
return bulk_add_cart; | ||
} | ||
|
||
static addToCart(grantData) { | ||
static addToCart(grantData, no_report) { | ||
if (this.cartContainsGrantWithId(grantData.grant_id)) { | ||
return; | ||
} | ||
|
@@ -57,7 +57,8 @@ class CartData { | |
if (!network) { | ||
network = 'mainnet'; | ||
} | ||
const acceptsAllTokens = (grantData.grant_token_address === '0x0000000000000000000000000000000000000000'); | ||
const acceptsAllTokens = (grantData.grant_token_address === '0x0000000000000000000000000000000000000000' || | ||
grantData.grant_token_address === '0x0'); | ||
|
||
let accptedTokenName; | ||
|
||
|
@@ -100,10 +101,12 @@ class CartData { | |
cartList.push(grantData); | ||
this.setCart(cartList); | ||
|
||
fetchData(`/grants/${grantData.grant_id}/activity`, 'POST', { | ||
action: 'ADD_ITEM', | ||
metadata: JSON.stringify(cartList) | ||
}, {'X-CSRFToken': $("input[name='csrfmiddlewaretoken']").val()}); | ||
if (!no_report) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the above comment, |
||
fetchData(`/grants/${grantData.grant_id}/activity`, 'POST', { | ||
action: 'ADD_ITEM', | ||
metadata: JSON.stringify(cartList) | ||
}, {'X-CSRFToken': $("input[name='csrfmiddlewaretoken']").val()}); | ||
} | ||
} | ||
|
||
static removeIdFromCart(grantId) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
Vue.component('grant-card', { | ||
delimiters: [ '[[', ']]' ], | ||
props: [ 'grant', 'cred', 'token', 'view', 'short', 'show_contributions', | ||
'contributions', 'toggle_following', 'collection', 'has_collections' | ||
], | ||
data: function() { | ||
return { | ||
collections: document.collections, | ||
currentUser: document.contxt.github_handle, | ||
isCurator: false | ||
}; | ||
}, | ||
methods: { | ||
checkIsCurator: function() { | ||
if (this.currentUser && this.collection && this.collection.curators.length) { | ||
const curators = this.collection.curators.map(collection => collection.handle); | ||
|
||
this.isCurator = curators.indexOf(this.currentUser) !== -1; | ||
} | ||
}, | ||
get_clr_prediction: function(indexA, indexB) { | ||
if (this.grant.clr_prediction_curve && this.grant.clr_prediction_curve.length) { | ||
return this.grant.clr_prediction_curve[indexA][indexB]; | ||
} | ||
}, | ||
getContributions: function(grantId) { | ||
return this.contributions[grantId] || []; | ||
}, | ||
toggleFollowingGrant: async function(grantId, event) { | ||
event.preventDefault(); | ||
|
||
const favorite_url = `/grants/${grantId}/favorite`; | ||
let response = await fetchData(favorite_url, 'POST'); | ||
|
||
if (response.action === 'follow') { | ||
this.grant.favorite = true; | ||
} else { | ||
this.grant.favorite = false; | ||
} | ||
|
||
return true; | ||
}, | ||
addToCart: async function(grant) { | ||
const grantCartPayloadURL = `v1/api/${grant.id}/cart_payload`; | ||
const response = await fetchData(grantCartPayloadURL, 'GET'); | ||
|
||
CartData.addToCart(response.grant); | ||
|
||
showSideCart(); | ||
}, | ||
addToCollection: async function({collection, grant}) { | ||
const collectionAddGrantURL = `v1/api/collections/${collection.id}/grants/add`; | ||
const response = await fetchData(collectionAddGrantURL, 'POST', { | ||
'grant': grant.id | ||
}); | ||
|
||
_alert('Grant added successfully', 'success', 1000); | ||
} | ||
}, | ||
mounted() { | ||
this.checkIsCurator(); | ||
} | ||
}); | ||
|
||
Vue.component('grant-collection', { | ||
delimiters: [ '[[', ']]' ], | ||
props: ['collection'], | ||
methods: { | ||
shareCollection: function() { | ||
let testingCodeToCopy = document.querySelector(`#collection-${this.collection.id}`); | ||
|
||
testingCodeToCopy.setAttribute('type', 'text'); | ||
testingCodeToCopy.select(); | ||
|
||
try { | ||
const successful = document.execCommand('copy'); | ||
const msg = successful ? 'successful' : 'unsuccessful'; | ||
|
||
alert(`Grant collection was copied ${msg}: ${testingCodeToCopy.value}`); | ||
} catch (err) { | ||
alert('Oops, unable to copy'); | ||
} | ||
|
||
/* unselect the range */ | ||
testingCodeToCopy.setAttribute('type', 'hidden'); | ||
window.getSelection().removeAllRanges(); | ||
}, | ||
addToCart: async function() { | ||
const collectionDetailsURL = `v1/api/collections/${this.collection.id}`; | ||
const collection = await fetchData(collectionDetailsURL, 'GET'); | ||
|
||
(collection.grants || []).forEach((grant) => { | ||
CartData.addToCart(grant); | ||
}); | ||
|
||
showSideCart(); | ||
}, | ||
getGrantLogo(index) { | ||
return this.collection.grants[index].logo; | ||
} | ||
} | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calls to this function don't pass the second input, so right now the
no_report
input is never used. This input should either be removed, or added to all calls toaddToCart
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, i missed this. i used the no_report on bulk operation
addAllToCart
.