Skip to content

Commit 052a991

Browse files
committed
Removes unused CSS from the graph
1 parent e77b074 commit 052a991

File tree

7 files changed

+1007
-668
lines changed

7 files changed

+1007
-668
lines changed

src/webviews/apps/plus/graph-next/actions/gitActionsButtons.ts

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { html, LitElement, nothing } from 'lit';
1+
import { css, html, LitElement, nothing } from 'lit';
22
import { customElement, property, state } from 'lit/decorators.js';
33
import { fromNow } from '../../../../../system/date';
44
import { pluralize } from '../../../../../system/string';
55
import { createWebviewCommandLink } from '../../../../../system/webview';
66
import type { BranchState, State } from '../../../../plus/graph/protocol';
77
import { inlineCode } from '../../../shared/components/styles/lit/base.css';
8-
import { actionButton, linkBase, ruleBase } from '../graph.css';
8+
import { actionButton, linkBase, ruleBase } from '../styles/graph.css';
99
import '../../../shared/components/code-icon';
1010
import '../../../shared/components/overlays/tooltip';
1111

@@ -23,7 +23,6 @@ export class GitActionsButtons extends LitElement {
2323
@property({ type: Object })
2424
state!: State;
2525

26-
@state()
2726
private get fetchedText() {
2827
if (!this.lastFetched) return undefined;
2928

@@ -105,7 +104,29 @@ export class GlFetchButton extends LitElement {
105104

106105
@customElement('gl-push-pull-button')
107106
export class PushPullButton extends LitElement {
108-
static override styles = [linkBase, inlineCode, actionButton, ruleBase];
107+
static override styles = [
108+
linkBase,
109+
inlineCode,
110+
actionButton,
111+
ruleBase,
112+
css`
113+
.pill {
114+
display: inline-block;
115+
padding: 0.2rem 0.5rem;
116+
border-radius: 0.5rem;
117+
font-size: 1rem;
118+
font-weight: 500;
119+
line-height: 1.2;
120+
text-transform: uppercase;
121+
color: var(--vscode-foreground);
122+
background-color: var(--vscode-editorWidget-background);
123+
}
124+
.pill code-icon {
125+
font-size: inherit !important;
126+
line-height: inherit !important;
127+
}
128+
`,
129+
];
109130

110131
@property({ type: Object })
111132
branchState?: BranchState;

src/webviews/apps/plus/graph-next/gate.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { consume } from '@lit/context';
2-
import { html } from 'lit';
2+
import { css, html } from 'lit';
33
import { customElement, state } from 'lit/decorators.js';
44
import { ifDefined } from 'lit/directives/if-defined.js';
55
import { createWebviewCommandLink } from '../../../../system/webview';
@@ -11,7 +11,13 @@ import '../../shared/components/feature-gate';
1111

1212
@customElement('gl-graph-gate')
1313
export class GlGraphGate extends GlElement {
14-
static override styles = [];
14+
static override styles = css`
15+
gl-feature-gate gl-feature-badge {
16+
vertical-align: super;
17+
margin-left: 0.4rem;
18+
margin-right: 0.4rem;
19+
}
20+
`;
1521

1622
@consume({ context: stateContext, subscribe: true })
1723
@state()

src/webviews/apps/plus/graph-next/graph-header.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,15 @@ import type { CustomEventType } from '../../shared/components/element';
4242
import type { RadioGroup } from '../../shared/components/radio/radio-group';
4343
import type { GlSearchBox } from '../../shared/components/search/search-box';
4444
import type { SearchNavigationEventDetail } from '../../shared/components/search/search-input';
45+
import { inlineCode } from '../../shared/components/styles/lit/base.css';
4546
import { ipcContext } from '../../shared/contexts/ipc';
4647
import type { TelemetryContext } from '../../shared/contexts/telemetry';
4748
import { telemetryContext } from '../../shared/contexts/telemetry';
4849
import { emitTelemetrySentEvent } from '../../shared/telemetry';
4950
import { stateContext } from './context';
5051
import { graphStateContext } from './stateProvider';
52+
import { actionButton, linkBase, ruleBase } from './styles/graph.css';
53+
import { graphHeaderControlStyles, progressStyles, repoHeaderStyles, titlebarStyles } from './styles/header.css';
5154
import '@shoelace-style/shoelace/dist/components/option/option.js';
5255
import '@shoelace-style/shoelace/dist/components/select/select.js';
5356
import '../../shared/components/button';
@@ -100,10 +103,21 @@ function getSearchResultIdByIndex(results: GraphSearchResults, index: number): s
100103

101104
@customElement('gl-graph-header')
102105
export class GlGraphHeader extends SignalWatcher(LitElement) {
106+
static override styles = [
107+
inlineCode,
108+
linkBase,
109+
ruleBase,
110+
actionButton,
111+
titlebarStyles,
112+
repoHeaderStyles,
113+
graphHeaderControlStyles,
114+
progressStyles,
115+
];
116+
103117
// FIXME: remove light DOM
104-
protected override createRenderRoot(): HTMLElement | DocumentFragment {
105-
return this;
106-
}
118+
// protected override createRenderRoot(): HTMLElement | DocumentFragment {
119+
// return this;
120+
// }
107121

108122
@consume({ context: ipcContext })
109123
_ipc!: typeof ipcContext.__context__;
@@ -711,7 +725,7 @@ export class GlGraphHeader extends SignalWatcher(LitElement) {
711725
Switch to Another Branch...
712726
<hr />
713727
<code-icon icon="git-branch" aria-hidden="true"></code-icon>
714-
<span class="md-code">${this.hostState.branch?.name}</span>${when(
728+
<span class="inline-code">${this.hostState.branch?.name}</span>${when(
715729
this.hostState.branchState?.worktree,
716730
() => html`<i> (in a worktree)</i> `,
717731
)}
@@ -756,7 +770,7 @@ export class GlGraphHeader extends SignalWatcher(LitElement) {
756770
<span slot="content">
757771
Create New Branch from
758772
<code-icon icon="git-branch"></code-icon>
759-
<span class="md-code">${this.hostState.branch?.name}</span>
773+
<span class="inline-code">${this.hostState.branch?.name}</span>
760774
</span>
761775
</gl-tooltip>
762776
<gl-tooltip placement="bottom">

src/webviews/apps/plus/graph-next/graph-next.html

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,11 @@
2020
</head>
2121

2222
<body
23-
class="graph-app scrollable"
23+
class="scrollable"
2424
data-placement="#{placement}"
2525
data-vscode-context='{ "preventDefaultContextMenuItems": true, "webview": "#{webviewId}", "webviewInstance": "#{webviewInstanceId}" }'
2626
>
27-
<gl-graph-app
28-
class="graph-app__container"
29-
name="GraphView"
30-
placement="#{placement}"
31-
bootstrap="#{state}"
32-
></gl-graph-app>
27+
<gl-graph-app name="GraphView" placement="#{placement}" bootstrap="#{state}"></gl-graph-app>
3328
#{endOfBody}
3429
</body>
3530
</html>

0 commit comments

Comments
 (0)