|
@ -72,7 +72,6 @@ export class CommitDetailsApp extends App> { |
|
|
DOM.on<FileChangeListItem, FileChangeListItemDetail>('file-change-list-item', 'file-more-actions', e => |
|
|
DOM.on<FileChangeListItem, FileChangeListItemDetail>('file-change-list-item', 'file-more-actions', e => |
|
|
this.onFileMoreActions(e.detail), |
|
|
this.onFileMoreActions(e.detail), |
|
|
), |
|
|
), |
|
|
DOM.on('[data-action="dismiss-banner"]', 'click', e => this.onDismissBanner(e)), |
|
|
|
|
|
DOM.on('[data-action="commit-actions"]', 'click', e => this.onCommitActions(e)), |
|
|
DOM.on('[data-action="commit-actions"]', 'click', e => this.onCommitActions(e)), |
|
|
DOM.on('[data-action="pick-commit"]', 'click', e => this.onPickCommit(e)), |
|
|
DOM.on('[data-action="pick-commit"]', 'click', e => this.onPickCommit(e)), |
|
|
DOM.on('[data-action="search-commit"]', 'click', e => this.onSearchCommit(e)), |
|
|
DOM.on('[data-action="search-commit"]', 'click', e => this.onSearchCommit(e)), |
|
@ -181,19 +180,6 @@ export class CommitDetailsApp extends App> { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
onDismissBanner(e: MouseEvent) { |
|
|
|
|
|
const dismissed = this.state.preferences?.dismissed ?? []; |
|
|
|
|
|
if (dismissed.includes('sidebar')) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
dismissed.push('sidebar'); |
|
|
|
|
|
this.state.preferences = { ...this.state.preferences, dismissed: dismissed }; |
|
|
|
|
|
const parent = (e.target as HTMLElement)?.closest<HTMLElement>('[data-region="sidebar-banner"]') ?? undefined; |
|
|
|
|
|
this.renderBanner(this.state as CommitState, parent); |
|
|
|
|
|
|
|
|
|
|
|
this.sendCommand(PreferencesCommandType, { dismissed: dismissed }); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private onToggleFilesLayout(e: MouseEvent) { |
|
|
private onToggleFilesLayout(e: MouseEvent) { |
|
|
const layout = ((e.target as HTMLElement)?.dataset.switchList as ViewFilesLayout) ?? undefined; |
|
|
const layout = ((e.target as HTMLElement)?.dataset.switchList as ViewFilesLayout) ?? undefined; |
|
|
if (layout === this.state.preferences?.files?.layout) return; |
|
|
if (layout === this.state.preferences?.files?.layout) return; |
|
@ -301,7 +287,6 @@ export class CommitDetailsApp extends App> { |
|
|
renderContent() { |
|
|
renderContent() { |
|
|
if (!this.renderCommit(this.state)) return; |
|
|
if (!this.renderCommit(this.state)) return; |
|
|
|
|
|
|
|
|
this.renderBanner(this.state); |
|
|
|
|
|
this.renderActions(this.state); |
|
|
this.renderActions(this.state); |
|
|
this.renderNavigation(this.state); |
|
|
this.renderNavigation(this.state); |
|
|
this.renderPin(this.state); |
|
|
this.renderPin(this.state); |
|
@ -326,17 +311,6 @@ export class CommitDetailsApp extends App> { |
|
|
$explanation.innerHTML = ''; |
|
|
$explanation.innerHTML = ''; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
renderBanner(state: CommitState, target?: HTMLElement) { |
|
|
|
|
|
if (!state.preferences?.dismissed?.includes('sidebar')) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!target) { |
|
|
|
|
|
target = document.querySelector<HTMLElement>('[data-region="sidebar-banner"]') ?? undefined; |
|
|
|
|
|
} |
|
|
|
|
|
target?.remove(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
renderActions(state: CommitState) { |
|
|
renderActions(state: CommitState) { |
|
|
const isUncommitted = state.selected?.sha === uncommittedSha; |
|
|
const isUncommitted = state.selected?.sha === uncommittedSha; |
|
|
const isHiddenForUncommitted = isUncommitted.toString(); |
|
|
const isHiddenForUncommitted = isUncommitted.toString(); |
|
|