Browse Source

Handles no commits to rebase

main
Eric Amodio 4 years ago
parent
commit
7e5ce221b2
3 changed files with 46 additions and 15 deletions
  1. +18
    -1
      src/webviews/apps/rebase/rebase.ts
  2. +19
    -14
      src/webviews/apps/scss/buttons.scss
  3. +9
    -0
      src/webviews/apps/scss/rebase.scss

+ 18
- 1
src/webviews/apps/rebase/rebase.ts View File

@ -243,7 +243,24 @@ class RebaseEditor extends App {
} }
$container.innerHTML = ''; $container.innerHTML = '';
if (state.entries.length === 0) return;
if (state.entries.length === 0) {
$container.classList.add('entries--empty');
const $button = document.querySelector<HTMLButtonElement>('.button[name="start"]');
if ($button != null) {
$button.disabled = true;
}
const $entry = document.createElement('li');
const $el = document.createElement('h3');
$el.innerText = 'No commits to rebase';
$entry.appendChild($el);
$container.appendChild($entry);
return;
}
let squashing = false; let squashing = false;
let squashToHere = false; let squashToHere = false;

+ 19
- 14
src/webviews/apps/scss/buttons.scss View File

@ -16,6 +16,11 @@
&:focus { &:focus {
outline: none; outline: none;
} }
&[disabled] {
cursor: default !important;
opacity: 0.25 !important;
}
} }
.button--big { .button--big {
@ -29,21 +34,21 @@
} }
.vscode-dark & { .vscode-dark & {
border: 1px solid rgba(255, 255, 255, 0.6); border: 1px solid rgba(255, 255, 255, 0.6);
color: white !important;
color: white;
} }
transition: background-color 250ms, border-color 250ms, color 250ms; transition: background-color 250ms, border-color 250ms, color 250ms;
&:hover,
&:focus {
&:not([disabled]):hover,
&:not([disabled]):focus {
.vscode-light & { .vscode-light & {
background-color: var(--color-button-background--darken-30); background-color: var(--color-button-background--darken-30);
border-color: var(--color-button-background--darken-30); border-color: var(--color-button-background--darken-30);
color: white !important;
color: white;
} }
.vscode-dark & { .vscode-dark & {
background-color: white; background-color: white;
border-color: white; border-color: white;
color: black !important;
color: black;
} }
} }
@ -55,15 +60,15 @@
.button--flat-inverse { .button--flat-inverse {
background-color: white; background-color: white;
border: 1px solid white; border: 1px solid white;
color: black !important;
color: black;
font-weight: 600; font-weight: 600;
transition: background-color 250ms, border-color 250ms, color 250ms; transition: background-color 250ms, border-color 250ms, color 250ms;
&:hover,
&:focus {
&:not([disabled]):hover,
&:not([disabled]):focus {
background: rgba(0, 0, 0, 0.2); background: rgba(0, 0, 0, 0.2);
border-color: rgba(255, 255, 255, 0.6); border-color: rgba(255, 255, 255, 0.6);
color: white !important;
color: white;
} }
.preload & { .preload & {
@ -74,22 +79,22 @@
.button--flat-primary { .button--flat-primary {
background-color: var(--color-button-background); background-color: var(--color-button-background);
border: 1px solid var(--color-button-background); border: 1px solid var(--color-button-background);
color: var(--color-button-foreground) !important;
color: var(--color-button-foreground);
font-weight: 600; font-weight: 600;
transition: background-color 250ms, border-color 250ms, color 250ms; transition: background-color 250ms, border-color 250ms, color 250ms;
&:hover,
&:focus {
&:not([disabled]):hover,
&:not([disabled]):focus {
.vscode-dark & { .vscode-dark & {
background-color: white; background-color: white;
border-color: white; border-color: white;
color: black !important;
color: black;
} }
.vscode-light & { .vscode-light & {
background-color: var(--color-button-background--darken-30); background-color: var(--color-button-background--darken-30);
border-color: var(--color-button-background--darken-30); border-color: var(--color-button-background--darken-30);
color: white !important;
color: white;
} }
} }

+ 9
- 0
src/webviews/apps/scss/rebase.scss View File

@ -47,6 +47,15 @@ h4 {
} }
} }
.entries--empty {
border: none;
h3 {
margin: 1em auto;
width: fit-content;
}
}
.shortcuts { .shortcuts {
grid-area: shortcuts; grid-area: shortcuts;
margin: 0 auto; margin: 0 auto;

Loading…
Cancel
Save