Skip to content

Commit 7835149

Browse files
committed
feat: directory support (beta) + fix: small bug fix on graph
1 parent 9e48c77 commit 7835149

File tree

10 files changed

+59
-25
lines changed

10 files changed

+59
-25
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Quickly upload, create, open, read, modify and download files, on the fly.
44

55
Harmony also keep tracks of your changes or "workspaces" through git branches and git commits, all in-memory in your browser.
66

7-
<img src="https://i.ibb.co/brDw78C/Schermata-2022-10-08-alle-14-56-53.png" width=80% />
7+
<img src="https://i.ibb.co/pRbfJwT/Schermata-2022-10-09-alle-14-51-59-min.png" width=80% />
88

99
> Just me experimenting with WebAssembly.
1010
<br/>
-5 Bytes
Binary file not shown.

client/src/App.css

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@
2020
transition: all 0.3s ease;
2121
}
2222

23+
.virtual-file-wrapper svg path {
24+
stroke: #000;
25+
stroke-width: 5;
26+
}
27+
28+
.virtual-file-wrapper.dir svg path {
29+
fill: #ffca8e;
30+
}
31+
2332
.virtual-file-wrapper:hover {
2433
background-color: rgba(68, 214, 255, 0.3);
2534
border: 0.01em solid white;
@@ -84,14 +93,14 @@ input[type='file'] {
8493
}
8594

8695
.files-area.dir-open {
87-
position: relative;
88-
background-color: #1e1e1e;
89-
width: 70%;
90-
height: 70vh;
91-
position: absolute;
92-
top: 50%;
93-
left: 50%;
94-
transform: translate(-50%, -50%);
96+
position: relative;
97+
background-color: rgba(30, 30, 30, 0.9);
98+
width: 70%;
99+
height: 70vh;
100+
position: absolute;
101+
top: 50%;
102+
left: 50%;
103+
transform: translate(-50%, -50%);
95104
}
96105

97106
.files-area.dir-open .dir-menu {
@@ -101,7 +110,7 @@ input[type='file'] {
101110
top: 0;
102111
width: 100%;
103112
text-align: center;
104-
z-index: 1;
113+
z-index: 1;
105114
}
106115

107116
.files-area.dir-open .dir-menu svg {
@@ -111,12 +120,18 @@ input[type='file'] {
111120
cursor: pointer;
112121
}
113122

123+
.file {
124+
text-align: center;
125+
background-color: #1e1e1e;
126+
padding: 0.2em 0.5em;
127+
}
128+
114129
@media screen and (max-width: 768px) {
115130
.file-selectors p + div form {
116131
text-align: center;
117132
}
118133
.files-area.dir-open {
119134
background-color: #1e1e1e;
120135
width: 100%;
121-
}
136+
}
122137
}

client/src/App.tsx

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ function App() {
3030
const [prevOpenedFiles, setPrevOpenedFiles] = useState<Array<string>>([]);
3131
const [openDir, setOpenDir] = useState<string>('');
3232
const [oldVirtualFiles, setOldVirtualFiles] = useState<Array<never>>([]);
33-
33+
3434
const goBackInDirectories = () => {
3535
if (oldVirtualFiles.length > 0) {
3636
setVirtualFiles([...oldVirtualFiles]);
37-
return setOldVirtualFiles([])
37+
return setOldVirtualFiles([]);
3838
}
39-
}
39+
};
4040

4141
const clickOnFileHandler = (virtualFile: never, isDirectory: boolean = false) => {
4242
if (!isDirectory) {
@@ -73,10 +73,13 @@ function App() {
7373

7474
useEffect(() => {
7575
window.addEventListener('keydown', keyboardShortcut);
76+
if (localStorage.getItem('harmony-tutorial')) {
77+
localStorage.removeItem('harmony-tutorial');
78+
}
7679
// Show the tutorial
77-
if (!localStorage.getItem('harmony-tutorial')) {
80+
if (!localStorage.getItem('new-harmony-tutorial')) {
7881
setAction(HELP);
79-
localStorage.setItem('harmony-tutorial', 'true');
82+
localStorage.setItem('new-harmony-tutorial', 'true');
8083
}
8184

8285
return () => {
@@ -91,10 +94,12 @@ function App() {
9194
<Files />
9295
<div className="App">
9396
<div className={`files-area ${oldVirtualFiles.length > 0 ? 'dir-open' : ''}`} style={filesAreaStyle}>
94-
{oldVirtualFiles.length > 0 && <div className="dir-menu">
95-
{openDir}
96-
<BackArrowIcon onClick={goBackInDirectories}/>
97-
</div>}
97+
{oldVirtualFiles.length > 0 && (
98+
<div className="dir-menu">
99+
{openDir}
100+
<BackArrowIcon onClick={goBackInDirectories} />
101+
</div>
102+
)}
98103
{virtualFiles.map((virtualFile, index) => {
99104
// Check if directory
100105
const isDirectory = isDirectoryWrapper(virtualFile);
@@ -109,10 +114,10 @@ function App() {
109114
onDoubleClick={() => {
110115
clickOnFileHandler(virtualFile, isDirectory);
111116
}}
112-
className={`virtual-file-wrapper ${prevOpened}`}
117+
className={`virtual-file-wrapper ${prevOpened} ${isDirectory ? 'dir' : ''}`}
113118
>
114-
{isDirectory ? <FolderIcon size={60} /> : <DocumentIcon size={60} />}
115-
<div key={index} className="file">
119+
{isDirectory ? <FolderIcon size={60} /> : <DocumentIcon size={60} />}
120+
<div key={index} className={`file`}>
116121
{virtualFileName}
117122
</div>
118123
</div>

client/src/components/Git/GitGraph.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@ const GitGraph = () => {
4848
});
4949

5050
gitFootPrints.forEach((footPrint: gitFootPrintType, index: number) => {
51+
const branchName: string = footPrint.branch;
52+
5153
gitgraph.branch(footPrint.branch).commit({
5254
hash: footPrint.commit?.hash ?? '',
53-
subject: footPrint.commit?.message ?? index === 0 ? '' : `Checkout to ${footPrint.branch}`,
55+
subject: index === 0 ? branchName : footPrint.commit?.message ?? `Checkout to ${footPrint.branch}`,
5456
onClick: () => clickOnCommitHandler(footPrint.commit.hash),
5557
onMessageClick: () => clickOnCommitHandler(footPrint.commit.hash),
5658
style: {

client/src/components/Menu/Help.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,16 @@ const Help = () => {
8585
<br />
8686
Harmony keeps track of the branches and commits you create allowing you to go back to a specific commit.
8787
<video width="100%" src="https://user-images.githubusercontent.com/78874117/194714002-f6ec20c5-c7cc-4144-85e1-0bdb65097b7d.mov" controls autoPlay></video>
88+
<br />
89+
Click on the commits with the Hash (not the Checkout commits) to visit that particular commit.
90+
<br />
91+
<br />
92+
<br />
93+
<strong>Harmony also has a basic support for Folders</strong> (does not support nested folders yet)
94+
<video width="100%" src="https://user-images.githubusercontent.com/78874117/194757713-771d1df7-3272-497b-9973-2e253da13e20.mp4" controls autoPlay></video>
95+
<br />
96+
Create one by simply creating a new file with this format: <strong>"DIRECTORY_NAME/FILE_NAME"</strong>.
97+
<br />
8898
{(action === HELP || open) && (
8999
<Button
90100
sx={{

client/src/img/desktop.jpg

-775 KB
Loading

client/src/img/desktopp.jpg

2.62 MB
Loading

client/src/utils/goFunctions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const goToCommitWrapper = (hash: string) => goToCommit(hash);
4848

4949
export const exploreDirectoryWrapper = (filename: string) => {
5050
// @ts-ignore
51-
const filepath = `./${filename}/`+ exploreDirectory(filename);
51+
const filepath = `./${filename}/` + exploreDirectory(filename);
5252
return filepath.split(' ');
5353
};
5454

nova/virtual/virtualSystem.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ type StoreInterface interface {
2424
Screenshot(store billy.Filesystem, wt *git.Worktree, msg string) string
2525
GotoBranch(repo *git.Repository, branchName string) error
2626
GoToCommit(repo *git.Repository, commitHash string) error
27+
IsDirectory(store billy.Filesystem, dir string, filename string) bool
28+
ExploreDirectory(store billy.Filesystem, dir string, filename string) []string
2729
}
2830
type NovaStore struct {
2931
Watcher map[string]string

0 commit comments

Comments
 (0)