Skip to content

Commit cdd7b51

Browse files
thelostone-mcKweissdependabot[bot]octavioamugdixon
authored
feat: GR11 (#9421)
* Clean up verbiage (#9309) Clean up verbiage on footer * Bump moment from 2.17.1 to 2.19.3 (#9307) Bumps [moment](https://github.com/moment/moment) from 2.17.1 to 2.19.3. - [Release notes](https://github.com/moment/moment/releases) - [Changelog](https://github.com/moment/moment/blob/develop/CHANGELOG.md) - [Commits](moment/moment@2.17.1...2.19.3) --- updated-dependencies: - dependency-name: moment dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * GITC-223: ignore squelched profiles in clr (#9312) * chore: improve grants search using vector_column * add custom migration * tags/1: add new model + port data * tags/2: remove GrantCategory * fix alert css * add /v1/api/tags endpoint * feat: tweak get_grants to support chain and tagv * re-introduce removed fields * ensure filters work as expected * chore : update old API * add grants layout structure * add clr router * chore: wire in grant tags in create + edit * introduce old filter * backend query applied and basic query * fix tenant query * add filters and parameters logic changes * sort * add grant_region filter * fix broken sort * filters ux * tags router search and filters * collections backend and cache * tab system and collections * chore: move me=true * filter by collection * collections paginatination * remove extra request * update styles * GITC-239: Introduces global nav-cart to replace grants side-cart (#9418) * fix get_hackathons4 * GITC-321: Sets featured grant to 'grant_id = 1' (#9367) * feat: introduce steward endpoint (#9377) * GITC-276 purge: gitcoin faucet (#9333) * fixes bounty fulfillment data (#9368) * GITC-245: Implements the CLR calc in SQL (#9348) * GITC-245: Implements the CLR calc in SQL * GITC-245: Adds trust_bonus to profiles as_dict to optimise clr query * GITC-245: Inner joins * GITC-245: Fixes update_trust_bonus * GITC-245: Adds prints to clr to enable comparisons * GITC-245: Refactors --call-now version of update to happen inline * GITC-245: Refactors clr2 to avoid checking grants with no contribs and to account for grant.defer_clr_to * GITC-245: Adds a hybrid sql/python version of the calc (need to check both in production setting) * GITC-245: Adds 'defer_clr_to' to grants admin page * GITC-245: Adds to print statement to maintain consistency * Moves the id clause outside of the right join * feat: trust-bonus api (#9349) * chore: made defer_clr_to readonly * stale nav (#9382) * GITC-294: show clear cart on loading screen (#9369) * DoingGud interview * Update API.md * GITC-315: Fixes sms verify (#9390) * GITC-368: Adds skip_cleanup to retain build artefacts (#9409) * Fix small bug when click to slack link (#9416) * Updates db.py to always read from replicas (#9403) * GITC-239: Introduces gc-cart-content component Co-authored-by: octavioamu <octavioamuchastegui@gmail.com> Co-authored-by: Aditya Anand M C <aditya.anandmc@gmail.com> Co-authored-by: Kevin Owocki <ksowocki@gmail.com> Co-authored-by: Kyle Weiss <Kweiss@users.noreply.github.com> Co-authored-by: Thien Tran <fcduythien@gmail.com> * feat: polygon l2 checkout (#9372) * fix get_hackathons4 * GITC-321: Sets featured grant to 'grant_id = 1' (#9367) * rough commit * setup polygon: connect/switch/add chain * feat: introduce steward endpoint (#9377) * GITC-276 purge: gitcoin faucet (#9333) * fixes bounty fulfillment data (#9368) * GITC-245: Implements the CLR calc in SQL (#9348) * GITC-245: Implements the CLR calc in SQL * GITC-245: Adds trust_bonus to profiles as_dict to optimise clr query * GITC-245: Inner joins * GITC-245: Fixes update_trust_bonus * GITC-245: Adds prints to clr to enable comparisons * GITC-245: Refactors --call-now version of update to happen inline * GITC-245: Refactors clr2 to avoid checking grants with no contribs and to account for grant.defer_clr_to * GITC-245: Adds a hybrid sql/python version of the calc (need to check both in production setting) * GITC-245: Adds 'defer_clr_to' to grants admin page * GITC-245: Adds to print statement to maintain consistency * Moves the id clause outside of the right join * feat: trust-bonus api (#9349) * chore: made defer_clr_to readonly * more utils * upload svg * stale nav (#9382) * GITC-294: show clear cart on loading screen (#9369) * DoingGud interview * Update API.md * implement modal design * checkout recommendation, estimate gas, rootToChildToken * finish checkout + handle unsupported tokens etc. * handle balance check + amount to deposit * GITC-315: Fixes sms verify (#9390) * GITC-368: Adds skip_cleanup to retain build artefacts (#9409) * gas cost estimation * bug fix checkout recommendation * some fixes * Fix small bug when click to slack link (#9416) * Updates db.py to always read from replicas (#9403) * address review comments @thelostone-mc * Add test env to bundle (#9374) * Allow test environment to upload assets to hosted space * Updating pip requirements to deconflict * Fixing issues from PR comments * Fixing issues from PR comments * Changing environment for travis testing to 'travis' * Updating the variable references to be easier to understand. * more review fixes @PixelantDesign * review fix @willsputra * indicate metamask popup * no metamask popup with insufficient balance Co-authored-by: octavioamu <octavioamuchastegui@gmail.com> Co-authored-by: Graham Dixon <graham@gitcoin.co> Co-authored-by: Graham Dixon <graham@gdixon.co.uk> Co-authored-by: Aditya Anand M C <aditya.anandmc@gmail.com> Co-authored-by: Kevin Owocki <ksowocki@gmail.com> Co-authored-by: Kyle Weiss <Kweiss@users.noreply.github.com> Co-authored-by: Thien Tran <fcduythien@gmail.com> Co-authored-by: Zack Schiller <81022539+zacheryschiller@users.noreply.github.com> * GITC-131: Adds Discover Grants section to grants landing (#9386) * GITC-131: Adds Discover Grants section to grants landing * GITC-131: Replaces svgs * lint fixes + URL * fix default value * Fixes border mixin * Corrects discover section query strings * Adds count to checkout button * reset page when filtering * fix following not removing filter * reset pagination on clr filter * filters dropdown styles * me filter * tweak more filter font-size * disable auto-flip based on viewport * chore: reset page on changing filter + fix pre-filling vue store from URL * show idle grants in collections * merge conflict * change clr banner to black * Purges sidecart and ensures interactions with nav-cart are reflected everywhere * introduce my_collections=true * Switches categories for tags on grant details page * update text color to blak * Adds validation for provided eth address on create grant form * fix filters and load tab by url * Adds nav-cart to sticky filter bar, fixes some filtering behaviour and links/layout * Wrap intersection observer to ensure the ref is present * Ensures static url appending is clean * changing sort change page to 1 * remove add all to cart * fix navbar css * Center align the number of grants * move filters to top * add label to tenant * fix filter styles * hide cats if not options * admin bar to top * fix keyboard navigation filter * fix clr links * fix collections links * collections on landingpage * fix placeholder urls * clean dead code * reset page when switching from collections * add link polygon support * GITC-370: polygon gas cost estimation (#9430) * improve gas cost estimation + add mainnet address * check use has sufficient matic for gas * bug fix * remove log * show neglible currency values * fix align on list view * GITC-358: Reintroduces sort methods * Enables history navigation on filter change * Removes random_shuffle from the available sorts * Ensures params are cleared when filter data is empty * Fixes back button/text on grant details * add reverse pagination * remove blank for grants details * Fixes back button for after user follows an external link to a grants details page * fix zksync errors * polygon behind staff flag * GITC-247: Fixes the stats tab for team_members * Fixes button alignment Co-authored-by: Kyle Weiss <Kweiss@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: octavioamu <octavioamuchastegui@gmail.com> Co-authored-by: Graham Dixon <graham@gitcoin.co> Co-authored-by: Kevin Owocki <ksowocki@gmail.com> Co-authored-by: Thien Tran <fcduythien@gmail.com> Co-authored-by: Chibuotu Amadi <chibuotu@gmail.com> Co-authored-by: Graham Dixon <graham@gdixon.co.uk> Co-authored-by: Zack Schiller <81022539+zacheryschiller@users.noreply.github.com>
1 parent 78667f4 commit cdd7b51

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2655
-2374
lines changed
Lines changed: 9 additions & 0 deletions
Loading

app/assets/v2/js/base.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ document.addEventListener('DOMContentLoaded', function() {
1818
});
1919
}
2020

21-
// TODO: MOVE TO GRANTS shared
22-
if (typeof CartData != 'undefined') {
23-
applyCartMenuStyles();
24-
}
25-
2621
$('body').on('click', '.copy_me', function() {
2722
$(this).focus();
2823
$(this).select();
@@ -425,20 +420,6 @@ this.gitcoinUpdates = () => {
425420

426421
};
427422

428-
this.applyCartMenuStyles = function() {
429-
let dot = $('#cart-notification-dot');
430-
431-
if (CartData.hasItems()) {
432-
dot.addClass('notification__dot_active');
433-
dot.text(CartData.length());
434-
} else {
435-
dot.removeClass('notification__dot_active');
436-
if (document.location.href.indexOf('/grants') == -1) {
437-
$('#cart-nav').addClass('hidden');
438-
}
439-
}
440-
};
441-
442423
// Turn form data pulled form page into a JS object
443424
this.objectifySerialized = function(data) {
444425
let objectData = {};

app/assets/v2/js/cart-data.js

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ this.CartData = class CartData {
5252
return bulk_add_cart;
5353
}
5454

55-
static addToCart(grantData, no_report) {
55+
static addToCart(grantData, no_report, skipEmit) {
5656
if (this.cartContainsGrantWithId(grantData.grant_id)) {
5757
return;
5858
}
@@ -164,7 +164,8 @@ this.CartData = class CartData {
164164
let cartList = this.loadCart();
165165

166166
cartList.push(grantData);
167-
this.setCart(cartList);
167+
168+
this.setCart(cartList, skipEmit);
168169

169170
if (!no_report) {
170171
fetchData(`/grants/${grantData.grant_id}/activity`, 'POST', {
@@ -174,7 +175,7 @@ this.CartData = class CartData {
174175
}
175176
}
176177

177-
static removeIdFromCart(grantId) {
178+
static removeIdFromCart(grantId, skipEmit) {
178179
grantId = String(grantId);
179180

180181
let cartList = this.loadCart();
@@ -186,10 +187,10 @@ this.CartData = class CartData {
186187
metadata: JSON.stringify(newList)
187188
}, { 'X-CSRFToken': $("input[name='csrfmiddlewaretoken']").val() });
188189

189-
this.setCart(newList);
190+
this.setCart(newList, skipEmit);
190191
}
191192

192-
static updateCartItem(grantId, field, value) {
193+
static updateCartItem(grantId, field, value, skipEmit) {
193194
let cartList = this.loadCart();
194195

195196
let grant = null;
@@ -209,20 +210,24 @@ this.CartData = class CartData {
209210

210211
grant[field] = value;
211212

212-
this.setCart(cartList);
213+
this.setCart(cartList, skipEmit);
213214
}
214-
215-
static clearCart() {
215+
216+
static clearCart(skipEmit) {
216217
let cartList = this.loadCart();
217218

219+
if (!skipEmit) {
220+
this.emitDataUpdate([]);
221+
}
222+
218223
fetchData('/grants/0/activity', 'POST', {
219224
action: 'CLEAR_CART',
220225
metadata: JSON.stringify(cartList),
221226
bulk: true
222227
}, { 'X-CSRFToken': $("input[name='csrfmiddlewaretoken']").val() });
223228

224229
localStorage.setItem('grants_cart', JSON.stringify([]));
225-
applyCartMenuStyles();
230+
226231
}
227232

228233
static loadCart() {
@@ -241,9 +246,19 @@ this.CartData = class CartData {
241246
return parsedCart;
242247
}
243248

244-
static setCart(list) {
249+
static setCart(list, skipEmit) {
250+
if (!skipEmit) {
251+
this.emitDataUpdate(list);
252+
}
245253
localStorage.setItem('grants_cart', JSON.stringify(list));
246-
applyCartMenuStyles();
254+
}
255+
256+
static emitDataUpdate(list) {
257+
window.dispatchEvent(new CustomEvent('cartDataUpdated', {
258+
detail: {
259+
list: list
260+
}
261+
}));
247262
}
248263

249264
static loadCheckedOut() {

0 commit comments

Comments
 (0)