Skip to content

Commit 1cc3c9c

Browse files
committed
handle added, deleted, modified name cases, space for large number
1 parent 0191185 commit 1cc3c9c

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

src/components/DiffSection/ChangedFileDetails.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ export default function ChangedFileDetails({ file }: Props) {
1414
// const path = file.filename.split("/").slice(0, -1).join("/") + "/";
1515
switch (file.status) {
1616
case "added":
17+
case "new":
18+
case "created":
1719
return (
1820
<li>
1921
<FiPlus className={css.added} />
@@ -22,6 +24,9 @@ export default function ChangedFileDetails({ file }: Props) {
2224
</li>
2325
);
2426
case "modified":
27+
case "changed":
28+
case "updated":
29+
case "edited":
2530
return (
2631
<li>
2732
<RiPencilFill className={css.modified} />
@@ -36,6 +41,8 @@ export default function ChangedFileDetails({ file }: Props) {
3641
</li>
3742
);
3843
case "deleted":
44+
case "removed":
45+
case "dropped":
3946
return (
4047
<li>
4148
<FiMinus className={css.deleted} />

src/components/DiffSection/index.module.css

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959
align-items: center;
6060
svg {
6161
flex-shrink: 0;
62+
width: 0.75rem;
63+
margin-right: 0.75rem;
6264
}
6365
}
6466
}
@@ -67,23 +69,23 @@
6769
color: #c5a15a;
6870
margin-right: 0.25rem;
6971
font-weight: 600;
70-
width: 0.75rem;
72+
width: 1.25rem;
7173
}
7274

7375
.deleted {
7476
color: #fa7978;
7577
margin-right: 0.25rem;
7678
font-weight: 600;
7779
stroke-width: 3px;
78-
width: 0.75rem;
80+
width: 1.25rem;
7981
}
8082

8183
.added {
8284
color: #29e3c1;
8385
margin-right: 0.25rem;
8486
font-weight: 600;
8587
stroke-width: 3px;
86-
width: 0.75rem;
88+
width: 1.25rem;
8789
}
8890

8991
.file {

src/components/DiffSection/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ export default function DiffSection({ commit, diff, forDolt, loading }: Props) {
4141
</div>
4242
<div className={css.message}>{commit.commit.message}</div>
4343
{loading && <SmallLoader loaded={!loading} className={css.loading} />}
44-
{/* {err && <div className={css.error}>{err}</div>} */}
4544
</div>
4645
{!!files?.length && (
4746
<>
@@ -89,12 +88,19 @@ function getChanged(files: ChangedItem[]): GetChangedReturnType {
8988
files.forEach(file => {
9089
switch (file.status) {
9190
case "added":
91+
case "new":
92+
case "created":
9293
added++;
9394
break;
9495
case "modified":
96+
case "changed":
97+
case "updated":
98+
case "edited":
9599
modified++;
96100
break;
97101
case "deleted":
102+
case "removed":
103+
case "dropped":
98104
deleted++;
99105
break;
100106
}

0 commit comments

Comments
 (0)