Skip to content

Commit aad9958

Browse files
Merge branch 'zleyyij:main' into main
2 parents bc7af6a + 90b46f8 commit aad9958

File tree

7 files changed

+71
-106
lines changed

7 files changed

+71
-106
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
target/
22
.DS_Store
3-
src/config.js

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ FROM alpine:3.20 as builder
55
RUN apk add --no-cache \
66
build-base rustup
77
RUN rustup-init -y
8-
RUN /root/.cargo/bin/cargo install wasm-pack wasm-bindgen-cli
8+
RUN /root/.cargo/bin/cargo install wasm-pack
99

1010
# create the app directory and copy in source
1111
RUN mkdir -p /app

src/index.html

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -24,40 +24,40 @@
2424
<span class="material-symbols-outlined minimize-icon">close</span>
2525
<span class="material-symbols-outlined maximize_icon">menu</span>
2626
<div class="sidebar">
27-
<div id="sidebar-container">
28-
<div style="flex-direction:row;">
29-
<img id="logo" src="assets/logo.png">
30-
<div id="sidebarControls">
31-
32-
<label for="multiPointGraphCheckbox" style="color:#FFFFFF">
33-
<input type="checkbox" id="multiPointGraphCheckbox" name="multiPointGraphCheckbox">
34-
Select Multiple Datapoints to Graph
35-
</label>
36-
<div id="multiPointUI" style="display: none;">
37-
<input type="checkbox" id="remapCheckbox" name="remapCheckbox">
38-
<label for="remapCheckbox" style="color:#FFFFFF">Normalize Datapoints</label>
39-
<div class="custom-file">
40-
<input
41-
type="button"
42-
id="createMultiPointGraph"
43-
value="Create Graph"
44-
name="createMultiPointGraph"
45-
class="custom-file-input"
46-
/>
47-
<label for="createMultiPointGraph" class="custom-file-label">Create Graph</label>
48-
</div>
27+
<div style="flex-direction:row;">
28+
<img id="logo" src="assets/logo.png">
29+
<div class="custom-file" id="fileUpload">
30+
<input type="file" id="uploadedFile" class="custom-file-input" accept=".csv"/>
31+
<label class="custom-file-label" for="uploadedFile">Choose file</label>
32+
<label for="multiPointGraphCheckbox" style="color:#FFFFFF">
33+
<input type="checkbox" id="multiPointGraphCheckbox" name="multiPointGraphCheckbox">
34+
Select Multiple Datapoints to Graph
35+
</label>
36+
<div id="multiPointUI" style="display: none;">
37+
<input type="checkbox" id="remapCheckbox" name="remapCheckbox">
38+
<label for="remapCheckbox" style="color:#FFFFFF">Normalize Datapoints</label>
39+
<div class="custom-file">
40+
<input
41+
type="button"
42+
id="createMultiPointGraph"
43+
value="Create Graph"
44+
name="createMultiPointGraph"
45+
class="custom-file-input"
46+
/>
47+
<label for="createMultiPointGraph" class="custom-file-label">Create Graph</label>
4948
</div>
5049
</div>
51-
<div id="searchDiv" class="form-control">
52-
<input
53-
type="text"
54-
id="graphSearch"
55-
class="searchbar"
56-
placeholder="Add graph"
57-
/>
58-
</div>
59-
<ul class="scrollbar scrollbar-frozen-dreams" id="searchResults" style="list-style: none"></ul>
6050
</div>
51+
52+
<div id="searchDiv" class="form-control">
53+
<input
54+
type="text"
55+
id="graphSearch"
56+
class="searchbar"
57+
placeholder="Add graph"
58+
/>
59+
</div>
60+
<ul class="scrollbar scrollbar-frozen-dreams" id="searchResults" style="list-style: none"></ul>
6161
</div>
6262
</div>
6363

@@ -67,9 +67,7 @@
6767
<div class="loading_icon" id="loadingIcon" style="display: none"></div>
6868
<div id="welcomeMessage">
6969
<h2>Welcome to HWGV!</h2>
70-
<p>Drag and drop a HWinfo .csv file, select <strong>Choose file</strong> or paste a link to the file you wish to view.</p>
71-
<input type="file" id="uploadedFile" class="custom-file-input" accept=".csv"/>
72-
<label class="custom-file-label" for="uploadedFile">Choose file</label>
70+
<p>Drag and drop a HWinfo .csv file or select <strong>Choose file</strong> to upload. You can also paste a link to the file below.</p>
7371
<input type="url" id="urlInput" placeholder="Paste link here" pattern="/http.*csv/gi"></input>
7472
</div>
7573
</div>

src/scripts/index.js

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// TODO; get rid of jquery
22
import hwgv_parser, { parse_csv } from "./parser/pkg/hwgv_parser.js";
33
import { buildGraphs, makeSearchResults } from "./ui.js";
4-
import { API_URL } from '../config.js';
54

65
// initialize the wasm import
76
// this should be preloaded
@@ -229,26 +228,16 @@ export async function parseCSV(
229228

230229
// if a file is uploaded using the upload button, do the thing
231230
let upCheck = document.getElementById("uploadedFile");
232-
const apiUrl = `${API_URL}`;
233-
234-
// This is a very hacky way to extract a URL and manually encode the &
235-
// You must operate on the raw string rather than using the URL property
236-
// because `urlParams.get("url")` will terminate at the first &
237231
const urlParams = new URLSearchParams(window.location.search);
238-
let ampersandUrl = urlParams.toString().replace('url=', '');
239-
let csvUrl = ampersandUrl.replace(/&/g, '%26');
240-
241-
console.log(`Raw URL: ${urlParams}`);
242-
console.log(`Clean URL: ${csvUrl}`);
243-
244232
if (urlParams.get("url") == null) {
245-
upCheck.onchange = function () {
246-
document.getElementById("loadingIcon").style.display = "";
247-
document.getElementById("welcomeMessage").style.display = "none";
233+
upCheck.onchange = function () {
234+
document.getElementById("loadingIcon").style.display = "";
235+
document.getElementById("welcomeMessage").style.display = "none";
248236
parseCSV(document.getElementById("uploadedFile").files[0]);
249-
};
237+
};
250238
} else {
251-
fetch(`${apiUrl}/?url=${csvUrl}`).then(file =>
239+
// TODO: make it so that this whole schtick isn't hardcoded
240+
fetch(`https://api.47c.in/hw/?url=${urlParams.get("url")}`).then(file =>
252241
file.blob().then(blb => parseCSV(blb))
253242
);
254243
}

src/scripts/parser/.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/target
22
/Cargo.lock
33
/pkg
4-
.DS_Store
5-
/src/config.js
4+
.DS_Store

src/styles/charttheme.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
@import 'https://code.highcharts.com/css/highcharts.css';
33

44
.highcharts-background {
5-
fill: var(--dark00);
5+
fill: #3B4252;
66
}
77

88
.highcharts-title, .highcharts-subtitle, .highcharts-yaxis .highcharts-axis-title {

src/styles/style.css

Lines changed: 30 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,15 @@ File organization:
1616
1717
*/
1818

19-
:root {
20-
--dark00: #191C24;
21-
--dark0: #222630;
22-
--dark1: #333948;
23-
--dark2: #3B4254;
24-
--dim: #AAAAAA;
25-
--white0: #F3F4F7;
26-
--pink: #fdcbf1;
27-
--purple: #B48EAD;
28-
--blue: #AEE2FE;
29-
}
19+
3020

3121
:root {
3222
--sidebar-width: 14rem;
3323
}
3424

3525
body {
3626
display: flex;
37-
background-color: var(--dark00);
27+
background-color: #3B4252;
3828
min-height: 100%;
3929
min-width: 100%;
4030
margin: 0;
@@ -52,43 +42,40 @@ html {
5242
display: flex;
5343
}
5444

55-
#sidebarControls {
45+
#fileUpload {
5646
margin-top: 20px;
5747
}
5848

59-
#sidebar-container {
60-
padding-right: 1rem;
61-
}
62-
6349
.scrollbar-frozen-dreams::-webkit-scrollbar-track {
6450
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.1);
65-
background-color: var(--white0);
51+
background-color: #F5F5F5;
6652
border-radius: 10px;
6753
}
6854

6955
.scrollbar-frozen-dreams::-webkit-scrollbar {
7056
width: 12px;
71-
background-color: var(--white0);
57+
background-color: #F5F5F5;
7258
}
7359

7460
.scrollbar-frozen-dreams::-webkit-scrollbar-thumb {
7561
border-radius: 10px;
7662
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.1);
77-
background-image: -webkit-gradient(linear, left bottom, left top, from(var(--pink)), color-stop(1%, var(--pink)),
63+
background-image: -webkit-gradient(linear, left bottom, left top, from(#fdcbf1), color-stop(1%, #fdcbf1),
7864
to(#e6dee9));
79-
background-image: -webkit-linear-gradient(bottom, var(--pink) 0%, var(--pink) 1%, #e6dee9 100%);
80-
background-image: linear-gradient(to top, var(--pink) 0%, var(--pink) 1%, #e6dee9 100%);
65+
background-image: -webkit-linear-gradient(bottom, #fdcbf1 0%, #fdcbf1 1%, #e6dee9 100%);
66+
background-image: linear-gradient(to top, #fdcbf1 0%, #fdcbf1 1%, #e6dee9 100%);
8167
}
8268

8369

8470
/* Sidebar*/
8571
.button:hover {
86-
background-color: var(--dark1);
72+
background-color: #3B4252;
8773
}
8874

8975
.button {
90-
background-color: var(--purple);
91-
color: var(--white0);
76+
background-color: #B48EAD;
77+
border: none;
78+
color: white;
9279
/*padding: 10px 10px;*/
9380
text-align: center;
9481
text-decoration: none;
@@ -107,7 +94,7 @@ input[type="checkbox"] {
10794
}
10895

10996
.sidebar {
110-
background-color: var(--dark0);
97+
background-color: #2E3440;
11198
position: fixed;
11299
flex-direction: column;
113100
width: var(--sidebar-width);
@@ -124,7 +111,7 @@ input[type="checkbox"] {
124111
}
125112

126113
.material-symbols-outlined {
127-
color: var(--white0);
114+
color: #F5F5F5;
128115
-webkit-user-select: none; /* Safari */
129116
-moz-user-select: none; /* Firefox */
130117
-ms-user-select: none; /* IE10+/Edge */
@@ -153,7 +140,7 @@ input[type="checkbox"] {
153140

154141
.minimize-icon:hover, .maximize_icon:hover {
155142
cursor: pointer;
156-
color: var(--dim);
143+
color: #AAAAAA;
157144
}
158145

159146

@@ -173,21 +160,14 @@ input[type="checkbox"] {
173160
margin: 0;
174161
}
175162

176-
#uploadedFile.custom-file-input {
163+
#uploadedFile::file-selector-button, #uploadedFile::-webkit-file-upload-button {
177164
display: none;
178165
}
179166

180-
.custom-file-label::after {
167+
.custom-file .custom-file-label::after {
181168
display: none;
182169
}
183170

184-
.custom-file-label {
185-
position: relative;
186-
color: var(--dark00);
187-
background-color: var(--white0);
188-
border: inherit;
189-
}
190-
191171
#searchResults {
192172
list-style-type: none;
193173
width: 100%;
@@ -196,17 +176,16 @@ input[type="checkbox"] {
196176
padding: 0;
197177
margin-top: 2%;
198178
overflow-y: scroll;
179+
position: absolute;
199180
z-index: 200;
200181
}
201182

202183
#searchResults li button {
203184
display: inline-block;
204185
width: 100%;
205-
background-color: inherit;
206-
border-top: none;
207-
border-left: none;
208-
border-right: none;
209-
color: var(--white0);
186+
background-color: #4c566a;
187+
border: 1px solid #F5F5F5;
188+
color: white;
210189
padding: 5px 8px;
211190
text-align: center;
212191
text-decoration: none;
@@ -220,13 +199,12 @@ input[type="checkbox"] {
220199
}
221200

222201
#searchResults li button:hover {
223-
background-color: var(--dark1);
202+
background-color: #3B4252;
224203
}
225204

226205
#searchDiv {
227206
margin-top: 10%;
228-
border: none;
229-
background-color: inherit;
207+
border-radius: 0;
230208
width: 100%;
231209
position: relative;
232210
top: 0;
@@ -245,16 +223,16 @@ input[type="checkbox"] {
245223
}
246224

247225
.overlay input[type="url"] {
248-
background-color: inherit;
249-
border-color: var(--white0);
250-
border-radius: .25rem;
226+
background-color: #00000000;
227+
border-color: #ffffff;
251228
border-style: solid;
252-
color: var(--dim);
229+
color: #aaaaaa;
253230
}
254231
.overlay ::placeholder {
255232
color: #999999;
256233
}
257234

235+
258236
.loading_icon {
259237
position: absolute;
260238
left: calc(50% + var(--sidebar-width));
@@ -265,7 +243,7 @@ input[type="checkbox"] {
265243
margin: -30px 0 0 -76px;
266244
border: 5px solid rgba(0, 0, 0, 0);
267245
border-radius: 50%;
268-
border-top: 5px solid var(--blue);
246+
border-top: 5px solid #b5def8;
269247
-webkit-animation: spin 2s linear infinite;
270248
animation: spin 1.5s linear infinite;
271249
}
@@ -293,6 +271,8 @@ input[type="checkbox"] {
293271
width: 100%;
294272
}
295273

274+
275+
296276
/*Charts*/
297277
.charts {
298278
padding-top: 10px;

0 commit comments

Comments
 (0)