Skip to content

Commit e3b447d

Browse files
authored
Merge pull request #459 from HarperDB/stage
v4.8.15
2 parents cdecaec + 937a306 commit e3b447d

File tree

4 files changed

+96
-21
lines changed

4 files changed

+96
-21
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "harperdb-studio",
3-
"version": "4.8.14",
3+
"version": "4.8.15",
44
"description": "A UI for HarperDB",
55
"deploymentUrl": "studio.harperdb.io",
66
"private": true,

src/assets/styles/components/_web-ide.scss

Lines changed: 60 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
padding: 0 !important;
8282
padding-inline-start: 8px !important;
8383

84-
.folder-container {
84+
.file-container {
8585
button::before,
8686
i::before {
8787
background: transparent !important;
@@ -109,15 +109,6 @@
109109
text-align: left;
110110
white-space: nowrap;
111111

112-
.project-icon,
113-
.package-icon {
114-
color: $color-success;
115-
}
116-
117-
.folder-icon {
118-
color: $color-info;
119-
}
120-
121112
.filetype-js {
122113
color: $color-warning;
123114
}
@@ -130,6 +121,59 @@
130121
color: $color-lightgrey;
131122
}
132123

124+
&.file-selected {
125+
.filename-text {
126+
color: $color-white !important;
127+
128+
&::after {
129+
content: '\f35a' !important;
130+
font-family: 'Font Awesome 5 Free', sans-serif !important;
131+
font-size: 16px;
132+
position: absolute;
133+
right: 8px;
134+
}
135+
}
136+
}
137+
}
138+
}
139+
140+
.folder-container {
141+
button::before,
142+
i::before {
143+
background: transparent !important;
144+
border: 0;
145+
font-size: 16px !important;
146+
margin: 0;
147+
outline: none !important;
148+
padding: 0;
149+
}
150+
151+
.package-text,
152+
.filename-text {
153+
color: $color-grey !important;
154+
font-size: 14px !important;
155+
padding-left: 8px;
156+
}
157+
158+
.file,
159+
.package {
160+
background: transparent;
161+
border: 0;
162+
margin: 1px 0;
163+
outline: none !important; // TODO: fix this because it is not accessible; style differently
164+
padding: 3px;
165+
text-align: left;
166+
white-space: nowrap;
167+
168+
.project-icon,
169+
.package-icon {
170+
color: $color-success;
171+
}
172+
173+
.folder-icon {
174+
color: $color-info;
175+
}
176+
133177
&.folder-selected {
134178
.filename-text {
135179
color: $color-white !important;
@@ -158,6 +202,12 @@
158202
}
159203
}
160204
}
205+
.folder-open ~ li {
206+
display: block;
207+
}
208+
.folder-closed ~ li {
209+
display: none;
210+
}
161211
}
162212
}
163213
}

src/components/auth/AuthLayout.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Outlet } from 'react-router';
22
import { Col, Container, Row } from 'reactstrap';
33

4-
function AuthLayout({ children }) {
4+
function AuthLayout() {
55
return (
66
<Container fluid="xs" className="h-100">
77
<Row xs="1" sm="2" className="h-100">

src/components/instance/functions/manage/applicationsEditor/FileBrowser.js

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,34 @@ function directorySortComparator(a, b) {
4040

4141
const isFolder = (entry) => Boolean(entry.entries);
4242

43-
function ProjectIcon() {
44-
return <i className={cn(`project-icon fas fa-file-code`)} />;
43+
function ProjectIcon({ toggleClosed, isOpen }) {
44+
return (
45+
<i
46+
onClick={toggleClosed}
47+
onKeyDown={toggleClosed}
48+
className={cn(`project-icon fas fa-file-code`)}
49+
tabIndex={0}
50+
aria-expanded={isOpen}
51+
aria-controls="folder"
52+
aria-label={isOpen ? 'close project' : 'open project'}
53+
role="button"
54+
/>
55+
);
4556
}
46-
function FolderIcon({ toggleClosed }) {
47-
// eslint-disable-next-line
48-
return <i onClick={toggleClosed} onKeyDown={toggleClosed} className={cn(`folder-icon fas fa-folder-open`)} />;
57+
function FolderIcon({ toggleClosed, isOpen }) {
58+
return (
59+
// TODO: A11y on this is not good at all..... Need to refactor the file tree to make the file tree more accessible for ALL users.
60+
<i
61+
onClick={toggleClosed}
62+
onKeyDown={toggleClosed}
63+
className={cn(`folder-icon fas ${isOpen ? 'fa-folder-open' : 'fa-folder'}`)}
64+
tabIndex={0}
65+
aria-expanded={isOpen}
66+
aria-controls="folder"
67+
aria-label={isOpen ? 'close folder' : 'open folder'}
68+
role="button"
69+
/>
70+
);
4971
}
5072

5173
function FiletypeIcon({ extension }) {
@@ -99,7 +121,6 @@ function File({ directoryEntry, selectedFile, selectedFolder, onFileSelect, onFo
99121
const deployFileIconClass = 'deploy-project';
100122
const isFileSelected = directoryEntry.path === selectedFile;
101123
const isFolderSelected = directoryEntry.path === selectedFolder?.path;
102-
103124
// file receives open/close toggle func from
104125
// parent. if it's a dir, calls toggle func on click
105126
// if it's a flat file, calls onFileSelect so
@@ -119,7 +140,6 @@ function File({ directoryEntry, selectedFile, selectedFolder, onFileSelect, onFo
119140
// that we don't untoggle directory selection; leave selected if icon clicked.
120141
const iconWasClicked =
121142
e.target.classList.contains(renameFileIconClass) || e.target.classList.contains(deployFileIconClass);
122-
123143
// if icon's clicked, select, but don't unselect.
124144
// if (iconWasClicked) return;
125145

@@ -176,7 +196,7 @@ function Folder({
176196
// top-level dir === package
177197
// FolderIcon/PackageIcon is func so we can give it open args now, but instantiate it later.
178198
if (directoryEntry.path.split('/').length === 2) {
179-
Icon = () => ProjectIcon();
199+
Icon = () => ProjectIcon({ isOpen: open, toggleClosed: () => setOpen(!open) });
180200
} else if (directoryEntry.entries) {
181201
Icon = () => FolderIcon({ isOpen: open, toggleClosed: () => setOpen(!open) });
182202
} else {
@@ -188,7 +208,12 @@ function Folder({
188208
{
189209
// FIXME: don't hardcode 'components', get from root .name property of fileTree.
190210
directoryEntry.name !== 'components' ? (
191-
<li key={directoryEntry.key} className={cn('folder-container')}>
211+
<li
212+
key={directoryEntry.key}
213+
className={cn(
214+
`${directoryEntry.entries ? 'folder-container' : 'file-container'} ${open ? 'folder-open' : 'folder-closed'}`
215+
)}
216+
>
192217
{directoryEntry.package ? (
193218
<Package
194219
selectedPackage={selectedPackage}

0 commit comments

Comments
 (0)