Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/system/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -805,3 +805,11 @@ function _parseHexDigit(charCode: CharCode): number {
}
return 0;
}

export function getCssMixedColorValue(color1: string, color2: string, percent: number): string {
return `color-mix(in srgb, ${color1} ${percent}%, ${color2})`;
}

export function getCssOpacityColorValue(color: string, percent: number): string {
return getCssMixedColorValue(color, 'transparent', percent);
}
36 changes: 16 additions & 20 deletions src/webviews/apps/plus/graph/graph-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { ipcContext } from '../../shared/contexts/ipc';
import type { TelemetryContext } from '../../shared/contexts/telemetry';
import { telemetryContext } from '../../shared/contexts/telemetry';
import { emitTelemetrySentEvent } from '../../shared/telemetry';
import { stateContext } from './context';
import type { GlGraphWrapper } from './graph-wrapper/graph-wrapper';
import type { GlGraphHover } from './hover/graphHover';
import type { GraphMinimapDaySelectedEventDetail } from './minimap/minimap';
Expand All @@ -36,11 +35,8 @@ export class GraphApp extends SignalWatcher(LitElement) {
return this;
}

@consume({ context: stateContext, subscribe: true })
state!: typeof stateContext.__context__;

@consume({ context: graphStateContext, subscribe: true })
graphApp!: typeof graphStateContext.__context__;
graphState!: typeof graphStateContext.__context__;

@consume({ context: ipcContext })
private readonly _ipc!: typeof ipcContext.__context__;
Expand Down Expand Up @@ -76,27 +72,27 @@ export class GraphApp extends SignalWatcher(LitElement) {
@gl-select-commits=${this.handleHeaderSearchNavigation}
></gl-graph-header>
<div class="graph__workspace">
${when(!this.state.allowed, () => html`<gl-graph-gate class="graph__gate"></gl-graph-gate>`)}
${when(!this.graphState.allowed, () => html`<gl-graph-gate class="graph__gate"></gl-graph-gate>`)}
<main id="main" class="graph__panes">
<div class="graph__graph-pane">
${when(
this.state.config?.minimap !== false,
this.graphState.config?.minimap !== false,
() => html`
<gl-graph-minimap-container
.activeDay=${this.graphApp.activeDay}
.disabled=${!this.state.config?.minimap}
.rows=${this.state.rows ?? []}
.rowsStats=${this.state.rowsStats}
.dataType=${this.state.config?.minimapDataType ?? 'commits'}
.markerTypes=${this.state.config?.minimapMarkerTypes ?? []}
.refMetadata=${this.state.refsMetadata}
.searchResults=${this.graphApp.searchResults}
.visibleDays=${this.graphApp.visibleDays}
.activeDay=${this.graphState.activeDay}
.disabled=${!this.graphState.config?.minimap}
.rows=${this.graphState.rows ?? []}
.rowsStats=${this.graphState.rowsStats}
.dataType=${this.graphState.config?.minimapDataType ?? 'commits'}
.markerTypes=${this.graphState.config?.minimapMarkerTypes ?? []}
.refMetadata=${this.graphState.refsMetadata}
.searchResults=${this.graphState.searchResults}
.visibleDays=${this.graphState.visibleDays}
@gl-graph-minimap-selected=${this.handleMinimapDaySelected}
></gl-graph-minimap-container>
`,
)}
${when(this.state.config?.sidebar, () => html`<gl-graph-sidebar></gl-graph-sidebar>`)}
${when(this.graphState.config?.sidebar, () => html`<gl-graph-sidebar></gl-graph-sidebar>`)}
<gl-graph-hover id="commit-hover" distance=${0} skidding=${15}></gl-graph-hover>
<gl-graph-wrapper
@gl-graph-change-selection=${this.handleGraphSelectionChanged}
Expand All @@ -119,15 +115,15 @@ export class GraphApp extends SignalWatcher(LitElement) {
}

private handleMinimapDaySelected(e: CustomEvent<GraphMinimapDaySelectedEventDetail>) {
if (!this.state.rows) return;
if (!this.graphState.rows) return;

let { sha } = e.detail;
if (sha == null) {
const date = e.detail.date?.getTime();
if (date == null) return;

// Find closest row to the date
const closest = this.state.rows.reduce((prev, curr) => {
const closest = this.graphState.rows.reduce((prev, curr) => {
return Math.abs(curr.date - date) < Math.abs(prev.date - date) ? curr : prev;
});
sha = closest.sha;
Expand Down Expand Up @@ -161,7 +157,7 @@ export class GraphApp extends SignalWatcher(LitElement) {
}

private handleGraphVisibleDaysChanged({ detail }: CustomEventType<'gl-graph-change-visible-days'>) {
this.graphApp.visibleDays = detail;
this.graphState.visibleDays = detail;
}

private handleGraphRowContextMenu(_e: CustomEventType<'gl-graph-row-context-menu'>) {
Expand Down
Loading