Commit 283772d0 authored by Phil Hughes's avatar Phil Hughes

Improve responsiveness of notes header content

Closes https://gitlab.com/gitlab-org/gitlab/-/issues/214732
parent 8a2e578e
...@@ -47,6 +47,11 @@ export default { ...@@ -47,6 +47,11 @@ export default {
required: false, required: false,
default: '', default: '',
}, },
isOverviewTab: {
type: Boolean,
required: false,
default: false,
},
}, },
computed: { computed: {
...mapGetters(['userCanReply']), ...mapGetters(['userCanReply']),
...@@ -127,6 +132,7 @@ export default { ...@@ -127,6 +132,7 @@ export default {
:show-reply-button="userCanReply" :show-reply-button="userCanReply"
:discussion-root="true" :discussion-root="true"
:discussion-resolve-path="discussion.resolve_path" :discussion-resolve-path="discussion.resolve_path"
:is-overview-tab="isOverviewTab"
@handleDeleteNote="$emit('deleteNote')" @handleDeleteNote="$emit('deleteNote')"
@startReplying="$emit('startReplying')" @startReplying="$emit('startReplying')"
> >
...@@ -176,6 +182,7 @@ export default { ...@@ -176,6 +182,7 @@ export default {
:line="diffLine" :line="diffLine"
:discussion-root="index === 0" :discussion-root="index === 0"
:discussion-resolve-path="discussion.resolve_path" :discussion-resolve-path="discussion.resolve_path"
:is-overview-tab="isOverviewTab"
@handleDeleteNote="$emit('deleteNote')" @handleDeleteNote="$emit('deleteNote')"
> >
<template #avatar-badge> <template #avatar-badge>
......
...@@ -66,6 +66,11 @@ export default { ...@@ -66,6 +66,11 @@ export default {
required: false, required: false,
default: '', default: '',
}, },
isOverviewTab: {
type: Boolean,
required: false,
default: false,
},
}, },
data() { data() {
return { return {
...@@ -263,6 +268,7 @@ export default { ...@@ -263,6 +268,7 @@ export default {
:is-expanded="isExpanded" :is-expanded="isExpanded"
:line="line" :line="line"
:should-group-replies="shouldGroupReplies" :should-group-replies="shouldGroupReplies"
:is-overview-tab="isOverviewTab"
@startReplying="showReplyForm" @startReplying="showReplyForm"
@deleteNote="deleteNoteHandler" @deleteNote="deleteNoteHandler"
> >
......
...@@ -84,6 +84,11 @@ export default { ...@@ -84,6 +84,11 @@ export default {
required: false, required: false,
default: '', default: '',
}, },
isOverviewTab: {
type: Boolean,
required: false,
default: false,
},
}, },
data() { data() {
return { return {
...@@ -186,6 +191,14 @@ export default { ...@@ -186,6 +191,14 @@ export default {
return fileResolvedFromAvailableSource || null; return fileResolvedFromAvailableSource || null;
}, },
avatarSize() {
// Use a different size if shown on a Merge Request Diff
if (this.line && !this.isOverviewTab) {
return 24;
}
return 40;
},
}, },
created() { created() {
const line = this.note.position?.line_range?.start || this.line; const line = this.note.position?.line_range?.start || this.line;
...@@ -391,7 +404,7 @@ export default { ...@@ -391,7 +404,7 @@ export default {
:link-href="author.path" :link-href="author.path"
:img-src="author.avatar_url" :img-src="author.avatar_url"
:img-alt="author.name" :img-alt="author.name"
:img-size="40" :img-size="avatarSize"
lazy lazy
> >
<template #avatar-badge> <template #avatar-badge>
......
...@@ -317,6 +317,7 @@ export default { ...@@ -317,6 +317,7 @@ export default {
:key="discussion.id" :key="discussion.id"
:discussion="discussion" :discussion="discussion"
:render-diff-file="true" :render-diff-file="true"
is-overview-tab
:help-page-path="helpPagePath" :help-page-path="helpPagePath"
/> />
</template> </template>
......
...@@ -34,12 +34,23 @@ export default { ...@@ -34,12 +34,23 @@ export default {
type: Object, type: Object,
required: true, required: true,
}, },
line: {
type: Object,
required: false,
default: null,
},
}, },
computed: { computed: {
...mapGetters(['getUserData']), ...mapGetters(['getUserData']),
renderedNote() { renderedNote() {
return renderMarkdown(this.note.body); return renderMarkdown(this.note.body);
}, },
avatarSize() {
if (this.line) {
return 16;
}
return 40;
},
}, },
}; };
</script> </script>
...@@ -50,7 +61,7 @@ export default { ...@@ -50,7 +61,7 @@ export default {
<user-avatar-link <user-avatar-link
:link-href="getUserData.path" :link-href="getUserData.path"
:img-src="getUserData.avatar_url" :img-src="getUserData.avatar_url"
:img-size="40" :img-size="avatarSize"
/> />
</div> </div>
<div ref="note" :class="{ discussion: !note.individual_note }" class="timeline-content"> <div ref="note" :class="{ discussion: !note.individual_note }" class="timeline-content">
......
...@@ -1034,6 +1034,27 @@ table.code { ...@@ -1034,6 +1034,27 @@ table.code {
} }
} }
// Notes tweaks for the Changes tab ONLY
.diff-tr {
.timeline-discussion-body {
clear: left;
.note-body {
margin-top: 0 !important;
}
}
.timeline-entry img.avatar {
margin-top: -2px;
margin-right: $gl-padding-8;
}
// tiny adjustment to vertical align with the note header text
.discussion-collapsible .timeline-icon {
padding-top: 2px;
}
}
.files:not([data-can-create-note]) .frame { .files:not([data-can-create-note]) .frame {
cursor: auto; cursor: auto;
} }
...@@ -1152,7 +1173,7 @@ table.code { ...@@ -1152,7 +1173,7 @@ table.code {
} }
.discussion-collapsible { .discussion-collapsible {
margin: 0 $gl-padding $gl-padding 71px; margin: 0 $gl-padding $gl-padding;
.notes { .notes {
border-radius: $border-radius-default; border-radius: $border-radius-default;
......
...@@ -125,18 +125,17 @@ $system-note-svg-size: 16px; ...@@ -125,18 +125,17 @@ $system-note-svg-size: 16px;
} }
} }
.timeline-discussion-body {
margin-top: -$gl-padding-8;
}
.discussion { .discussion {
display: block; display: block;
position: relative; position: relative;
.timeline-discussion-body { .timeline-discussion-body {
margin-top: -$gl-padding-8;
overflow-x: auto; overflow-x: auto;
overflow-y: hidden; overflow-y: hidden;
.note-body {
margin-top: $gl-padding-8;
}
} }
.diff-content { .diff-content {
...@@ -586,17 +585,47 @@ $system-note-svg-size: 16px; ...@@ -586,17 +585,47 @@ $system-note-svg-size: 16px;
.note-header { .note-header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
flex-wrap: wrap;
> .note-header-info,
> .note-actions {
flex-grow: 1;
flex-shrink: 1;
}
}
.note {
@include notes-media('max', map-get($grid-breakpoints, sm) - 1) {
.note-header {
.note-actions {
flex-wrap: wrap;
margin-bottom: $gl-padding-12;
> :first-child {
margin-left: 0;
}
}
}
.note-header-author-name {
display: block;
}
}
} }
.note-header-info { .note-header-info {
min-width: 0; min-width: 0;
padding-bottom: $gl-padding-8;
&.discussion { &.discussion {
padding-bottom: 0; padding-bottom: 0;
} }
} }
.note-header-info,
.note-actions {
padding-bottom: $gl-padding-8;
}
.system-note .note-header-info { .system-note .note-header-info {
padding-bottom: 0; padding-bottom: 0;
} }
...@@ -667,7 +696,8 @@ $system-note-svg-size: 16px; ...@@ -667,7 +696,8 @@ $system-note-svg-size: 16px;
.note-actions { .note-actions {
align-self: flex-start; align-self: flex-start;
flex-shrink: 0; justify-content: flex-end;
flex-shrink: 1;
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
margin-left: 10px; margin-left: 10px;
......
...@@ -189,6 +189,27 @@ describe('issue_note', () => { ...@@ -189,6 +189,27 @@ describe('issue_note', () => {
createWrapper(); createWrapper();
}); });
describe('avatar sizes in diffs', () => {
const line = {
line_code: 'abc_1_1',
type: null,
old_line: '1',
new_line: '1',
};
it('should render 24px avatars', async () => {
wrapper.setProps({
note: { ...note },
discussionRoot: true,
line,
});
await wrapper.vm.$nextTick();
expect(wrapper.findComponent(UserAvatarLink).props('imgSize')).toBe(24);
});
});
it('should render user information', () => { it('should render user information', () => {
const { author } = note; const { author } = note;
const avatar = wrapper.findComponent(UserAvatarLink); const avatar = wrapper.findComponent(UserAvatarLink);
......
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