Browse Source

Splits title from message

main
Eric Amodio 1 year ago
parent
commit
62a21ad0f6
3 changed files with 16 additions and 35 deletions
  1. +1
    -1
      src/commands/patches.ts
  2. +9
    -34
      src/webviews/apps/plus/patchDetails/components/gl-draft-details.ts
  3. +6
    -0
      src/webviews/apps/plus/patchDetails/patchDetails.scss

+ 1
- 1
src/commands/patches.ts View File

@ -219,7 +219,7 @@ async function createDraft(
create.title = message;
} else {
create.title = message.substring(0, index);
create.description = message.substring(index + 1);
create.description = message.substring(index + 1).trim();
}
if (args.from == null) {

+ 9
- 34
src/webviews/apps/plus/patchDetails/components/gl-draft-details.ts View File

@ -144,26 +144,18 @@ export class GlDraftDetails extends GlTreeBase {
}
private renderPatchMessage() {
if (this.state?.draft?.title == null) {
return undefined;
}
if (this.state?.draft?.title == null) return undefined;
let description = this.state.draft.draftType === 'cloud' ? this.state.draft.description : undefined;
if (description == null) return undefined;
description = description.trim();
const title = this.state.draft.title;
const description = this.state.draft.draftType === 'cloud' ? this.state.draft.description : undefined;
return html`
<div class="section section--message">
<div class="message-block">
${when(
description == null,
() =>
html`<p class="message-block__text scrollable" data-region="message">
<strong>${unsafeHTML(title)}</strong>
</p>`,
() =>
html`<p class="message-block__text scrollable" data-region="message">
<strong>${unsafeHTML(title)}</strong><br /><span>${unsafeHTML(description)}</span>
</p>`,
)}
<p class="message-block__text scrollable" data-region="message">
<span>${unsafeHTML(description)}</span>
</p>
</div>
</div>
`;
@ -443,24 +435,7 @@ export class GlDraftDetails extends GlTreeBase {
)}
</div>
</div>
${when(
this.state.draft?.draftType === 'cloud' && this.state.draft?.author.name != null,
() => html`
<ul class="top-details__authors" aria-label="Authors">
<li class="top-details__author" data-region="author">
<commit-identity
name="${this.state.draft!.author!.name}"
email="${ifDefined(this.state.draft!.author!.email)}"
date="${this.state.draft!.createdAt!}"
dateFormat="${this.state.preferences.dateFormat}"
avatarUrl="${this.state.draft!.author!.avatar ?? ''}"
?showavatar=${this.state.preferences?.avatars ?? true}
.actionLabel=${'created'}
></commit-identity>
</li>
</ul>
`,
)}
<h1 class="title">${this.state.draft?.title}</h1>
</div>
</div>
${this.renderPatchMessage()}

+ 6
- 0
src/webviews/apps/plus/patchDetails/patchDetails.scss View File

@ -22,6 +22,12 @@ gk-menu-item {
}
}
.title {
font-size: 1.8rem;
font-weight: 600;
margin: 0;
}
.message-block__text strong:not(:only-child) {
display: inline-block;
margin-bottom: 0.52rem;

Loading…
Cancel
Save