Skip to content

Commit ac9a57d

Browse files
committed
Revert "Fixed/Cleaned up feat(undoMerge/undoCommit)"
This reverts commit 5dd86e3.
1 parent 5dd86e3 commit ac9a57d

File tree

3 files changed

+78
-7
lines changed

3 files changed

+78
-7
lines changed

components/DropDownOther.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const { execSync, exec } = require("child_process");
66
const importJsx = require("import-jsx");
77
const TreeTab = importJsx('./TreeTab')
88
const Stash = importJsx('./Stash')
9-
const CommitRevert = importJsx('./CommitRevert')
9+
const MergeRevert = importJsx('./MergeRevert')
1010

1111
const popStash = require('../actions/undoStash')
1212

@@ -35,8 +35,8 @@ const dropDown = ({ refreshTab, accentColor, defaultColor }) => {
3535
value: 'undoStash'
3636
},
3737
{
38-
label: 'Undo Commit',
39-
value: 'undoCommit'
38+
label: 'Undo Merge',
39+
value: 'undoMerge'
4040
}
4141
]
4242
switch (currentDrop) {
@@ -61,11 +61,11 @@ const dropDown = ({ refreshTab, accentColor, defaultColor }) => {
6161
<popStash refreshTab={refreshTab} />
6262
</Box>
6363
)
64-
case 'undoCommit':
64+
case 'undoMerge':
6565
return (
6666
<Box flexDirection='column' marginLeft='109'>
6767
<SelectInput items={items} isFocused={false} displayDirection='column' defaultColor={defaultColor} accentColor={accentColor}/>
68-
<CommitRevert refreshTab={refreshTab} />
68+
<MergeRevert refreshTab={refreshTab} />
6969
</Box>
7070
)
7171
default:
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
const React = require("react");
2+
const { useEffect, useState, useRef } = require("react");
3+
const { Text, Box, Newline } = require("ink");
4+
const SelectInput = require("ink-select-input-horizontal").default;
5+
const { execSync, exec } = require("child_process");
6+
const importJsx = require("import-jsx");
7+
const TreeTab = importJsx('./TreeTab')
8+
const Stash = importJsx('./Stash')
9+
const MergeRevert = importJsx('./MergeRevert')
10+
11+
//Creates the switch case for the 'Other' Tab.
12+
13+
const dropDown = ({ refreshTab, accentColor, defaultColor }) => {
14+
const [currentDrop, setCurrentDrop] = useState('')
15+
16+
const handleSelect = (item) => {
17+
setCurrentDrop(item.value)
18+
}
19+
const items = [
20+
{
21+
label: 'Access Full Log Tree',
22+
value: 'fullLogTree'
23+
},
24+
{
25+
label: 'Stash Changes',
26+
value: 'stashChanges'
27+
},
28+
{
29+
label: 'Undo Stash',
30+
value: 'undoStash'
31+
},
32+
{
33+
label: 'Undo Merge',
34+
value: 'undoMerge'
35+
}
36+
]
37+
switch (currentDrop) {
38+
case 'fullLogTree':
39+
return (
40+
<Box flexDirection='column'>
41+
<SelectInput items={items} isFocused={false} displayDirection='column' defaultColor={defaultColor} accentColor={accentColor}/>
42+
<TreeTab refreshTab={refreshTab} />
43+
</Box>
44+
)
45+
case 'stashChanges':
46+
return (
47+
<Box flexDirection='column'>
48+
<SelectInput items={items} isFocused={false} displayDirection='column' defaultColor={defaultColor} accentColor={accentColor}/>
49+
<Stash refreshTab={refreshTab} />
50+
</Box>
51+
)
52+
case 'undoMerge':
53+
return (
54+
<Box flexDirection='column'>
55+
<SelectInput items={items} isFocused={false} displayDirection='column' defaultColor={defaultColor} accentColor={accentColor}/>
56+
<MergeRevert refreshTab={refreshTab} />
57+
</Box>
58+
)
59+
default:
60+
return (
61+
// Replace "marginLeft='109'" for optimized solution later down the line.
62+
<Box flexDirection="column" marginLeft='109' >
63+
<SelectInput items={items} onSelect={handleSelect} displayDirection='column' defaultColor={defaultColor} accentColor={accentColor}/>
64+
<Newline />
65+
<Text color='gray'>Press ESC to go back</Text>
66+
</Box>
67+
)//teste
68+
}
69+
};
70+
71+
module.exports = dropDown

components/CommitRevert.js renamed to components/MergeRevert.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { Box, Text, NewLine } = require('ink')
44
const { execSync, exec } =require("child_process")
55
const TextInput = require("ink-text-input").default;
66

7-
const CommitRevert = (props) => {
7+
const MergeRevert = (props) => {
88
const [commitId, setCommitId] = useState("");
99

1010
let { refreshTab } = props;
@@ -43,4 +43,4 @@ const CommitRevert = (props) => {
4343
)
4444
}
4545

46-
module.exports = CommitRevert
46+
module.exports = MergeRevert

0 commit comments

Comments
 (0)