Skip to content

Commit

Permalink
Removed unnessecary css rules, fixed variable casing, and implemented…
Browse files Browse the repository at this point in the history
… stricter css selector
  • Loading branch information
Harmit Goswami authored and Harmit Goswami committed Jun 14, 2024
1 parent db4ccad commit c36f78a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 29 deletions.
35 changes: 17 additions & 18 deletions pontoon/contributors/static/css/profile.css
Original file line number Diff line number Diff line change
Expand Up @@ -119,24 +119,6 @@ h2 {
width: 100%;
}

.right-column .button {
background: var(--dark-grey-1);
font-size: 16px;
font-weight: normal;
height: 32px;
padding: 8px 12px;
text-align: center;
text-transform: uppercase;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
gap: 8px;
border: none;
border-radius: 3px;
color: var(--light-grey-7);
margin-top: 5px;
}

h4 {
font-size: 14px;
Expand Down Expand Up @@ -465,6 +447,23 @@ svg.js-calendar-graph-svg {
float: right;
}

#show-more {
background: var(--dark-grey-1);
font-size: 16px;
font-weight: normal;
height: 32px;
text-transform: uppercase;
width: 100%;
border: none;
border-radius: 3px;
color: var(--light-grey-7);
margin-top: 5px;
}

#show-more:hover {
color: var(--white-1);
}

#account-status-form {
margin-top: 8px;
}
Expand Down
22 changes: 11 additions & 11 deletions pontoon/contributors/static/js/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ var Pontoon = (function (my) {

const type = $('#contributions .type-selector span').data('type');
const user = $('#server').data('user');
let months_shown = $(this).data('months_shown');
let monthsShown = $(this).data('months_shown');

// Update contribution graph
$.ajax({
Expand All @@ -313,8 +313,8 @@ var Pontoon = (function (my) {
success: function ({ contributions, title }) {
$('#contribution-graph').data('contributions', contributions);
$('#contributions .title').html(title);
months_shown = 1;
$('#show-more').data('months_shown', months_shown);
monthsShown = 1;
$('#show-more').data('months_shown', monthsShown);
Pontoon.profile.renderContributionGraph();
},
error: function () {
Expand Down Expand Up @@ -369,29 +369,29 @@ var Pontoon = (function (my) {
$('#show-more').click(function () {
const type = $('#contributions .type-selector span').data('type');
const user = $('#server').data('user');
let months_shown = $(this).data('months_shown');
const date_joined_obj = new Date($(this).data('date_joined'));
let monthsShown = $(this).data('months_shown');
const dateJoinedObj = new Date($(this).data('date_joined'));

// Limit the amount of months shown to when the user created their account
const start_date_obj = new Date();
start_date_obj.setMonth(start_date_obj.getMonth() - months_shown);
if (start_date_obj < date_joined_obj) {
const startDateObj = new Date();
startDateObj.setMonth(startDateObj.getMonth() - monthsShown);
if (startDateObj < dateJoinedObj) {
$('#show-more').hide();
}

// Update contribution timeline
$.ajax({
url: '/update-contribution-timeline/',
data: {
months_shown: months_shown,
months_shown: monthsShown,
contribution_type: type,
user: user,
},
success: function (data) {
$('#timeline').html(data);
// Re-render timeline with an extra month
months_shown += 1;
$('#show-more').data('months_shown', months_shown);
monthsShown += 1;
$('#show-more').data('months_shown', monthsShown);
},
error: function () {
Pontoon.endLoader('Oops, something went wrong.', 'error');
Expand Down

0 comments on commit c36f78a

Please sign in to comment.