Commit c9aa5cfa authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch '283924-user-profile' into 'master'

Refactor and UI-polish around activity calendar on user profile

See merge request gitlab-org/gitlab!47797
parents 34d2f392 6acc33d5
...@@ -5,7 +5,6 @@ import Activities from '~/activities'; ...@@ -5,7 +5,6 @@ import Activities from '~/activities';
import { localTimeAgo } from '~/lib/utils/datetime_utility'; import { localTimeAgo } from '~/lib/utils/datetime_utility';
import AjaxCache from '~/lib/utils/ajax_cache'; import AjaxCache from '~/lib/utils/ajax_cache';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { deprecatedCreateFlash as flash } from '~/flash';
import ActivityCalendar from './activity_calendar'; import ActivityCalendar from './activity_calendar';
import UserOverviewBlock from './user_overview_block'; import UserOverviewBlock from './user_overview_block';
...@@ -63,9 +62,9 @@ import UserOverviewBlock from './user_overview_block'; ...@@ -63,9 +62,9 @@ import UserOverviewBlock from './user_overview_block';
*/ */
const CALENDAR_TEMPLATE = ` const CALENDAR_TEMPLATE = `
<div class="clearfix calendar"> <div class="calendar">
<div class="js-contrib-calendar"></div> <div class="js-contrib-calendar"></div>
<div class="calendar-hint bottom-right"></div> <div class="calendar-hint"></div>
</div> </div>
`; `;
...@@ -214,7 +213,17 @@ export default class UserTabs { ...@@ -214,7 +213,17 @@ export default class UserTabs {
AjaxCache.retrieve(calendarPath) AjaxCache.retrieve(calendarPath)
.then(data => UserTabs.renderActivityCalendar(data, $calendarWrap)) .then(data => UserTabs.renderActivityCalendar(data, $calendarWrap))
.catch(() => flash(__('There was an error loading users activity calendar.'))); .catch(() => {
const cWrap = $calendarWrap[0];
cWrap.querySelector('.spinner').classList.add('invisible');
cWrap.querySelector('.user-calendar-error').classList.remove('invisible');
cWrap.querySelector('.user-calendar-error .js-retry-load').addEventListener('click', e => {
e.preventDefault();
cWrap.querySelector('.user-calendar-error').classList.add('invisible');
cWrap.querySelector('.spinner').classList.remove('invisible');
this.loadActivityCalendar();
});
});
} }
static renderActivityCalendar(data, $calendarWrap) { static renderActivityCalendar(data, $calendarWrap) {
......
...@@ -14,14 +14,11 @@ ...@@ -14,14 +14,11 @@
.str-truncated { .str-truncated {
max-width: 70%; max-width: 70%;
} }
.user-calendar-activities-loading {
font-size: 24px;
}
} }
.user-calendar { .user-calendar {
text-align: center; text-align: center;
min-height: 172px;
.calendar { .calendar {
display: inline-block; display: inline-block;
...@@ -42,12 +39,9 @@ ...@@ -42,12 +39,9 @@
.calendar-hint { .calendar-hint {
font-size: 12px; font-size: 12px;
direction: ltr;
&.bottom-right { margin-top: -23px;
direction: ltr; float: right;
margin-top: -23px;
float: right;
}
} }
.pika-single.gitlab-theme { .pika-single.gitlab-theme {
......
- activity_pane_class = Feature.enabled?(:security_auto_fix) && @user.bot? ? "col-12" : "col-md-12 col-lg-6" - activity_pane_class = Feature.enabled?(:security_auto_fix) && @user.bot? ? "col-12" : "col-md-12 col-lg-6"
.row .row.d-none.d-sm-flex
.col-12 .col-12.calendar-block.gl-my-3
.calendar-block.gl-mt-3.gl-mb-3 .user-calendar.light{ data: { calendar_path: user_calendar_path(@user, :json), calendar_activities_path: user_calendar_activities_path, utc_offset: Time.zone.utc_offset } }
.user-calendar.d-none.d-sm-block{ data: { calendar_path: user_calendar_path(@user, :json), calendar_activities_path: user_calendar_activities_path, utc_offset: Time.zone.utc_offset } } .spinner.spinner-md.gl-my-8
%h4.center.light .user-calendar-error.invisible
.spinner.spinner-md = _('There was an error loading users activity calendar.')
.user-calendar-activities.d-none.d-sm-block %a.js-retry-load{ href: '#' }
= s_('UserProfile|Retry')
.user-calendar-activities
.row .row
%div{ class: activity_pane_class } %div{ class: activity_pane_class }
- if can?(current_user, :read_cross_project) - if can?(current_user, :read_cross_project)
......
---
title: Refactor and UI-polish around activity calendar on user profile
merge_request: 47797
author: Takuya Noguchi
type: fixed
...@@ -29579,6 +29579,9 @@ msgstr "" ...@@ -29579,6 +29579,9 @@ msgstr ""
msgid "UserProfile|Report abuse" msgid "UserProfile|Report abuse"
msgstr "" msgstr ""
msgid "UserProfile|Retry"
msgstr ""
msgid "UserProfile|Snippets" msgid "UserProfile|Snippets"
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment