Get things working a little tiny bit more

This commit is contained in:
Caleb Owens 2024-07-01 21:07:07 +02:00
parent b1b390ce72
commit 4d29cd0723
No known key found for this signature in database
12 changed files with 60 additions and 76 deletions

View File

@ -8,8 +8,7 @@
},
"packageManager": "pnpm@9.2.0",
"scripts": {
"dev": "tauri dev",
"vite:dev": "vite dev",
"dev": "vite --clearScreen false --debug hmr",
"test": "vitest run --mode development",
"test:watch": "vitest --watch --mode development",
"test:e2e": "playwright test -c ./playwright.config.ts",

View File

@ -8,7 +8,7 @@
"type": "module",
"packageManager": "pnpm@9.2.0",
"scripts": {
"dev": "turbo run dev",
"dev": "turbo watch --filter @gitbutler/app dev",
"dev:ui": "pnpm --filter @gitbutler/ui dev",
"dev:tauri": "pnpm tauri dev",
"test": "pnpm --filter @gitbutler/app run test",

View File

@ -43,23 +43,19 @@
"svelte": "^4.0.0 || ^5.0.0-0"
},
"exports": {
"./CommitLines/*": {
"svelte": "./dist/CommitLines/*",
"import": "./dist/CommitLines/*",
"types": "./dist/CommitLines/*.d.ts"
}
},
"typesVersions": {
">4.0": {
"./*": [
"./dist/components/*.d.ts"
]
"./*.svelte": {
"svelte": "./dist/*.svelte",
"types": "./dist/*.svelte.d.ts"
},
"./*": {
"import": "./dist/*.js",
"types": "./dist/*.d.ts"
}
},
"files": [
"./dist/**/*.svelte",
"./dist/**/*.js",
"./dist/**/*.d.ts",
"!./dist/**/*.test.*"
"./dist/*.svelte",
"./dist/*.js",
"./dist/*.d.ts",
"!./dist/*.test.*"
]
}

View File

@ -1,7 +1,7 @@
<script lang="ts">
import type { BaseNode, Color } from './types';
import type { BaseNodeData, Color } from './types';
interface Props {
baseNode: BaseNode;
baseNode: BaseNodeData;
color: Color;
}

View File

@ -1,10 +1,10 @@
<script lang="ts">
import Fork from './Cell/Fork.svelte';
import Straight from './Cell/Straight.svelte';
import type { Cell } from './types';
import type { CellData } from './types';
interface Props {
cell: Cell;
cell: CellData;
isBottom?: boolean;
}

View File

@ -1,10 +1,10 @@
<script lang="ts">
import { tooltip } from '../../utils/tooltip';
import { isDefined } from '../../utils/typeguards';
import type { CommitNode, Color } from './types';
import { tooltip } from '../utils/tooltip';
import { isDefined } from '../utils/typeguards';
import type { CommitNodeData, Color } from './types';
interface Props {
commitNode: CommitNode;
commitNode: CommitNodeData;
color: Color;
}

View File

@ -2,11 +2,12 @@
import BaseNode from './BaseNode.svelte';
import Cell from './Cell.svelte';
import CommitNode from './CommitNode.svelte';
import { pxToRem } from '../../utils/pxToRem';
import type { Line } from './types';
import { pxToRem } from '../utils/pxToRem';
import type { LineData } from './types';
console.log('hello world!! :D');
interface Props {
line: Line;
line: LineData;
topHeightPx?: number;
}
@ -39,6 +40,7 @@
align-items: flex-end;
width: 24px;
margin-right: -2px;
background-color: green;
}
.line-top {

View File

@ -1,9 +1,9 @@
<script lang="ts">
import Line from './Line.svelte';
import type { LineGroup } from './types';
import type { LineGroupData } from './types';
interface Props {
lineGroup: LineGroup;
lineGroup: LineGroupData;
topHeightPx?: number;
}

View File

@ -1,4 +1,4 @@
import type { CommitData, LineGroup, Line, Color } from './types';
import type { CommitData, LineGroupData, LineData, Color } from './types';
interface Commits {
remoteCommits: CommitData[];
@ -173,12 +173,12 @@ function generateSameForkpoint({
base.lines[LEFT_COLUMN_INDEX].baseNode = undefined;
}
const data = new Map<string, LineGroup>([
const data = new Map<string, LineGroupData>([
...remoteBranchGroups.map(({ commit, lineGroup }) => [commit.id, lineGroup]),
...localBranchGroups.map(({ commit, lineGroup }) => [commit.id, lineGroup]),
...localAndRemoteBranchGroups.map(({ commit, lineGroup }) => [commit.id, lineGroup]),
...integratedBranchGroups.map(({ commit, lineGroup }) => [commit.id, lineGroup])
] as [string, LineGroup][]);
] as [string, LineGroupData][]);
return { data, base };
}
@ -416,11 +416,11 @@ function generateDifferentForkpoint({
removeRightMostColumn();
}
const data = new Map<string, LineGroup>([
const data = new Map<string, LineGroupData>([
...remoteBranchGroups.map(({ commit, lineGroup }) => [commit.id, lineGroup]),
...localBranchGroups.map(({ commit, lineGroup }) => [commit.id, lineGroup]),
...integratedBranchGroups.map(({ commit, lineGroup }) => [commit.id, lineGroup])
] as [string, LineGroup][]);
] as [string, LineGroupData][]);
return { data, base };
}
@ -434,11 +434,11 @@ function mapToCommitLineGroupPair(commits: CommitData[], groupSize: number) {
return groupings;
}
function blankLineGroup(lineCount: number): LineGroup {
function blankLineGroup(lineCount: number): LineGroupData {
const lines = Array(lineCount)
.fill(undefined)
.map(
(): Line => ({
(): LineData => ({
top: { type: 'straight', color: 'none' },
bottom: { type: 'straight', color: 'none' }
})
@ -457,8 +457,8 @@ function blankLineGroup(lineCount: number): LineGroup {
* 4. Integrated Commits (Commits that exist locally and perhaps on the remote that are in the trunk)
*/
export class LineManager {
private data: Map<string, LineGroup>;
base: LineGroup;
private data: Map<string, LineGroupData>;
base: LineGroupData;
constructor(commits: Commits, sameForkpoint: boolean) {
// We should never have local and remote commits with a different forkpoint

View File

@ -1,29 +1,29 @@
export type Color = 'local' | 'localAndRemote' | 'remote' | 'integrated' | 'shadow' | 'none';
export type Style = 'dashed';
export interface Cell {
export interface CellData {
type: 'straight' | 'fork';
color: Color;
style?: Style;
}
export interface CommitNode {
export interface CommitNodeData {
type: 'small' | 'large';
commit?: CommitData;
}
export interface BaseNode {}
export interface BaseNodeData {}
export interface Line {
top: Cell;
bottom: Cell;
commitNode?: CommitNode;
baseNode?: BaseNode;
export interface LineData {
top: CellData;
bottom: CellData;
commitNode?: CommitNodeData;
baseNode?: BaseNodeData;
}
export interface LineGroup {
export interface LineGroupData {
// A tuple of two, three, or four lines
lines: Line[];
lines: LineData[];
}
export interface Author {

View File

@ -11,7 +11,7 @@
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"experimentalDecorators": true,
"types": ["vitest/importMeta"]
"experimentalDecorators": true
// "types": ["vitest/importMeta"]
}
}

View File

@ -1,26 +1,13 @@
{
"$schema": "https://turborepo.org/schema.json",
"tasks": {
"dev": {
"dependsOn": [
"@gitbutler/app#dev",
"@gitbutler/ui#package"
],
"outputs": ["package/ui/dist/*"],
"cache": false
},
"prepare": {
"cache": false
},
"build": {
"dependsOn": ["@gitbutler/ui#build"],
"outputs": ["build/**"]
},
"preview": {
"cache": false
},
"lint": {
"outputs": []
}
}
"$schema": "https://turborepo.org/schema.json",
"tasks": {
"package": {
"cache": false
},
"dev": {
"dependsOn": ["@gitbutler/ui#package"],
"cache": false,
"persistent": true
}
}
}