diff --git a/app/assets/v2/js/grants/_detail-component.js b/app/assets/v2/js/grants/_detail-component.js index a57f4924153..d84a776c85c 100644 --- a/app/assets/v2/js/grants/_detail-component.js +++ b/app/assets/v2/js/grants/_detail-component.js @@ -1,8 +1,8 @@ -let isStaff = document.contxt.is_staff || false; +const isStaff = document.contxt.is_staff || false; -let userCode = typeof user_code !== 'undefined' ? user_code : undefined; -let verificationTweet = typeof verification_tweet !== 'undefined' ? verification_tweet : undefined; +const userCode = typeof user_code !== 'undefined' ? user_code : undefined; +const verificationTweet = typeof verification_tweet !== 'undefined' ? verification_tweet : undefined; Vue.component('v-select', VueSelect.VueSelect); Vue.use(VueQuillEditor); @@ -12,14 +12,14 @@ Quill.register('modules/ImageExtend', ImageExtend); Vue.mixin({ methods: { grantInCart: function() { - let vm = this; - let inCart = CartData.cartContainsGrantWithId(vm.grant.id); + const vm = this; + const inCart = CartData.cartContainsGrantWithId(vm.grant.id); vm.$set(vm.grant, 'isInCart', inCart); return vm.grant.isInCart; }, addToCart: async function() { - let vm = this; + const vm = this; const grantCartPayloadURL = `/grants/v1/api/${vm.grant.id}/cart_payload`; const response = await fetchData(grantCartPayloadURL, 'GET'); @@ -31,7 +31,7 @@ Vue.mixin({ }, removeFromCart: function() { - let vm = this; + const vm = this; vm.$set(vm.grant, 'isInCart', false); CartData.removeIdFromCart(vm.grant.id); @@ -41,7 +41,7 @@ Vue.mixin({ }, editGrantModal: function() { - let vm = this; + const vm = this; vm.logoPreview = vm.grant.logo_url; @@ -49,7 +49,7 @@ Vue.mixin({ }, saveGrant: function(event) { event.preventDefault(); - let vm = this; + const vm = this; if (!vm.checkForm(event)) return; @@ -59,7 +59,7 @@ Vue.mixin({ }; const apiUrlGrant = `/grants/v1/api/grant/edit/${vm.grant.id}/`; - let data = { + const data = { 'title': vm.grant.title, 'reference_url': vm.grant.reference_url, 'description': vm.$refs.myQuillEditor.quill.getText(), @@ -129,9 +129,9 @@ Vue.mixin({ cancelGrant: function(event) { event.preventDefault(); - let vm = this; + const vm = this; - let cancel = window.prompt('Please write "CONFIRM" to cancel the grant.'); + const cancel = window.prompt('Please write "CONFIRM" to cancel the grant.'); if (cancel !== 'CONFIRM') { return; @@ -153,10 +153,10 @@ Vue.mixin({ }, toggleFollowingGrant: async function(grantId) { - let vm = this; + const vm = this; const favoriteUrl = `/grants/${grantId}/favorite`; - let response = await fetchData(favoriteUrl, 'POST'); + const response = await fetchData(favoriteUrl, 'POST'); if (response.action === 'follow') { vm.grant.favorite = true; @@ -167,7 +167,7 @@ Vue.mixin({ return true; }, flag: function() { - let vm = this; + const vm = this; const comment = prompt('What is your reason for flagging this Grant?'); @@ -199,7 +199,7 @@ Vue.mixin({ }); }, userSearch(search, loading) { - let vm = this; + const vm = this; if (search.length < 3) { return; @@ -209,9 +209,9 @@ Vue.mixin({ }, getUser: async function(loading, search, selected) { - let vm = this; - let myHeaders = new Headers(); - let url = `/api/v0.1/users_search/?token=${currentProfile.githubToken}&term=${escape(search)}&suppress_non_gitcoiners=true`; + const vm = this; + const myHeaders = new Headers(); + const url = `/api/v0.1/users_search/?token=${currentProfile.githubToken}&term=${escape(search)}&suppress_non_gitcoiners=true`; myHeaders.append('X-Requested-With', 'XMLHttpRequest'); return new Promise(resolve => { @@ -235,12 +235,12 @@ Vue.mixin({ }); }, changeColor() { - let vm = this; + const vm = this; vm.grant.image_css = `background-color: ${vm.logoBackground};`; }, onFileChange(e) { - let vm = this; + const vm = this; if (!e.target) { return; @@ -252,7 +252,7 @@ Vue.mixin({ return; } vm.imgTransition = true; - let imgCompress = new Compressor(file, { + const imgCompress = new Compressor(file, { quality: 0.6, maxWidth: 2000, success(result) { @@ -267,7 +267,7 @@ Vue.mixin({ }); }, async twitterVerification() { - let vm = this; + const vm = this; if (!vm.grant.twitter_handle_1 || vm.grant.twitter_handle_1 == '') { _alert('Please add a twitter account to your grant!', 'error', 5000); @@ -320,13 +320,13 @@ Vue.mixin({ } }, tweetVerification() { - let vm = this; + const vm = this; const tweetContent = `https://twitter.com/intent/tweet?text=${encodeURIComponent(vm.verification_tweet)}%20${encodeURIComponent(vm.user_code)}`; window.open(tweetContent, '_blank'); }, checkForm: function(e) { - let vm = this; + const vm = this; vm.submitted = true; vm.errors = {}; @@ -405,7 +405,7 @@ Vue.mixin({ if (!user?.fields) { return user; } - let newTeam = {}; + const newTeam = {}; newTeam['id'] = user.pk; newTeam['avatar_url'] = `/dynamic/avatar/${user.fields.handle}`; @@ -425,7 +425,7 @@ Vue.mixin({ return this.$refs.myQuillEditor.quill; }, filteredMsg: function() { - let msgs = [ + const msgs = [ '💪 keep up the great work', '👍 i appreciate you', '🙌 Great Job', @@ -453,7 +453,7 @@ Vue.mixin({ ); }, isUserLogged() { - let vm = this; + const vm = this; if (document.contxt.github_handle) { return true; @@ -487,7 +487,6 @@ Vue.component('grant-details', { logo: null, logoPreview: null, logoBackground: null, - relatedGrants: [], rows: 0, perPage: 4, currentPage: 1, @@ -540,7 +539,7 @@ Vue.component('grant-details', { }; }, mounted: function() { - let vm = this; + const vm = this; vm.grant_twitter_handle_1 = vm.grant.twitter_handle_1; vm.grant.description_rich_edited = vm.grant.description_rich; @@ -553,7 +552,7 @@ Vue.component('grant-details', { grant: { deep: true, handler: function(newVal, oldVal) { - let vm = this; + const vm = this; if (this.dirty && this.submitted) { this.checkForm(); diff --git a/app/assets/v2/js/grants/_detail.js b/app/assets/v2/js/grants/_detail.js index 926c998bd03..74a9786d781 100644 --- a/app/assets/v2/js/grants/_detail.js +++ b/app/assets/v2/js/grants/_detail.js @@ -7,14 +7,14 @@ Quill.register('modules/ImageExtend', ImageExtend); Vue.mixin({ methods: { fetchGrantDetails: function(id) { - let vm = this; + const vm = this; vm.loading = true; if (!id) { id = grantDetails.grant_id; } - let url = `/grants/v1/api/grant/${id}/`; + const url = `/grants/v1/api/grant/${id}/`; return new Promise(resolve => { @@ -32,13 +32,14 @@ Vue.mixin({ resolve(); }).catch(console.error); }); - - + }, + paginate: function(array, page_size, page_number) { + return array.slice(page_number * page_size, page_number * page_size + page_size); }, fetchRelated: function() { - let vm = this; + const vm = this; + const size = 3; let ids; - let size = 6; if (!Object.keys(vm.grant.metadata).length || !vm.grant.metadata?.related?.length) { return; @@ -47,15 +48,20 @@ Vue.mixin({ ids = vm.grant.metadata.related.map(arr => { return arr[0]; }); + vm.relatedGrantsIds = vm.paginate(ids, size, vm.relatedGrantsPage); vm.relatedGrantsPage += 1; + vm.relatedGrantsHasNext = vm.relatedGrantsPage + 1 < ids.length / size; + if (!vm.relatedGrantsIds.length) { return; } + vm.loadingRelated = true; - let url = `/grants/v1/api/grants?pks=${vm.relatedGrantsIds}`; + + const url = `/grants/v1/api/grants?pks=${vm.relatedGrantsIds}`; fetch(url).then(function(res) { return res.json(); @@ -66,11 +72,8 @@ Vue.mixin({ vm.loadingRelated = false; }).catch(console.error); }, - paginate: function(array, page_size, page_number) { - return array.slice(page_number * page_size, page_number * page_size + page_size); - }, fetchTransactions: function() { - let vm = this; + const vm = this; page = vm.transactions.next_page_number; if (!page) { @@ -78,7 +81,7 @@ Vue.mixin({ } vm.loadingTx = true; - let url = `/grants/v1/api/grant/${vm.grant.id}/contributions?page=${page}`; + const url = `/grants/v1/api/grant/${vm.grant.id}/contributions?page=${page}`; fetch(url).then(function(res) { return res.json(); @@ -95,89 +98,21 @@ Vue.mixin({ }).catch(console.error); }, - fetchContributors: function() { - let vm = this; - - page = vm.contributors.next_page_number; - if (!page) { - return; - } - vm.loadingContributors = true; - - let url = `/grants/v1/api/grant/${vm.grant.id}/contributors?page=${page}`; - - fetch(url).then(function(res) { - return res.json(); - }).then(function(json) { - json.contributors.forEach(function(item) { - vm.contributors.grantContributors.push(item); - }); - - vm.contributors.num_pages = json.num_pages; - vm.contributors.has_next = json.has_next; - vm.contributors.next_page_number = json.next_page_number; - vm.contributors.count = json.count; - vm.loadingContributors = false; - - }).catch(console.error); - }, backNavigation: function() { - let vm = this; - var lgi = localStorage.getItem('last_grants_index'); - var lgt = localStorage.getItem('last_grants_title'); + const vm = this; + const lgi = localStorage.getItem('last_grants_index'); + const lgt = localStorage.getItem('last_grants_title'); if (lgi && lgt) { vm.$set(vm.backLink, 'url', lgi); vm.$set(vm.backLink, 'title', lgt); } }, - tabChange: function(input) { - - console.log(input); - window.location = `${this.grant.details_url}?tab=${input}`; - }, - enableTab: function() { - let vm = this; - let urlParams = new URLSearchParams(window.location.search); - - vm.tab = urlParams.get('tab'); - - switch (vm.tab) { - case 'sybil_profile': - vm.tabSelected = 4; - break; - case 'stats': - vm.tabSelected = 5; - break; - default: - vm.tabSelected = 0; - } - window.history.replaceState({}, document.title, `${window.location.pathname}`); - }, scrollToElement(element) { - let container = this.$refs[element]; + const container = this.$refs[element]; container.scrollIntoViewIfNeeded({behavior: 'smooth', block: 'start'}); } - }, - computed: { - // contributors() { - // let obj = this.transactions.grantTransactions.map((contributor) => { - // let newContributor = {}; - - // newContributor['id'] = contributor.subscription.id; - // newContributor['contributor_profile'] = contributor.subscription.contributor_profile; - // newContributor['avatar_url'] = `/dynamic/avatar/${contributor.subscription.contributor_profile}`; - // return newContributor; - // }) - - // return obj.reduce((user, current) => { - // return Object.assign(user, { - // [current.contributor_profile]: current - // }); - // }, {}); - - // } } }); @@ -190,25 +125,21 @@ if (document.getElementById('gc-grant-detail')) { }, data() { return { - loadingContributors: false, + loading: false, loadingTx: false, loadingRelated: false, - loading: false, - isStaff: isStaff, + relatedGrants: [], + relatedGrantsPage: 0, + relatedGrantsHasNext: false, + relatedGrantsIds: [], transactions: { grantTransactions: [], next_page_number: 1 }, - contributors: { - grantContributors: [], - next_page_number: 1 - }, + isStaff: isStaff, grant: {}, tabSelected: 0, tab: null, - relatedGrants: [], - relatedGrantsPage: 0, - relatedGrantsIds: [], backLink: { url: '/grants', title: 'Grants' @@ -216,7 +147,6 @@ if (document.getElementById('gc-grant-detail')) { }; }, mounted: function() { - this.enableTab(); this.backNavigation(); this.fetchGrantDetails(); } diff --git a/app/assets/v2/scss/gitcoin.scss b/app/assets/v2/scss/gitcoin.scss index f7938dc171e..c30611a3ee5 100644 --- a/app/assets/v2/scss/gitcoin.scss +++ b/app/assets/v2/scss/gitcoin.scss @@ -90,6 +90,14 @@ color: rgba(0, 0, 0, 0.7)!important; } +.text-grey-300 { + color: #A7A2B6; +} + +.text-grey-400 { + color: #757087; +} + .text-current { color: currentColor !important; } @@ -191,7 +199,6 @@ background-repeat: no-repeat; } - .bg-lightblue { background-color: var(--main-bg); } @@ -253,6 +260,10 @@ font-size: 0.55rem; } +.font-smaller-8 { + font-size: 0.5rem; +} + .font-smallest { font-size: 0.1rem; } diff --git a/app/assets/v2/scss/grants/grant.scss b/app/assets/v2/scss/grants/grant.scss index 87fe67096a7..107e22e7431 100644 --- a/app/assets/v2/scss/grants/grant.scss +++ b/app/assets/v2/scss/grants/grant.scss @@ -576,9 +576,9 @@ font-size: 1.3rem; } -.grant-description h3{ - font-size: 1.2rem; -} +// .grant-description h3{ +// font-size: 1.2rem; +// } .grant-description h4{ font-size: 1.1rem; diff --git a/app/assets/v2/scss/town_square.scss b/app/assets/v2/scss/town_square.scss index 9ccf212fa06..117ba61a4ad 100644 --- a/app/assets/v2/scss/town_square.scss +++ b/app/assets/v2/scss/town_square.scss @@ -938,7 +938,6 @@ body.green.offer_view .announce { background-color: var(--badge-blue-bg); color: var(--badge-blue-text); border: 1px solid transparent; - margin-bottom: 0.5rem !important; } #status .btn-group-toggle .btn-radio.active { diff --git a/app/dashboard/templates/profiles/status_box.html b/app/dashboard/templates/profiles/status_box.html index 5aea90b6d12..41f77a8b474 100644 --- a/app/dashboard/templates/profiles/status_box.html +++ b/app/dashboard/templates/profiles/status_box.html @@ -10,7 +10,15 @@ > - Press SHIFT + ENTER to send +
+ Press SHIFT + ENTER to send +
+ +
+
+
{% if is_alpha_tester %} @@ -39,10 +47,10 @@
-
+
{% if tags %} {% for tag in tags %} -