Skip to content

Commit 49e0606

Browse files
author
Ayaan Farooqui
committed
bug fixes
1 parent 773856a commit 49e0606

File tree

14 files changed

+397
-174
lines changed

14 files changed

+397
-174
lines changed

public/index.html

Lines changed: 51 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
4-
<head>
5-
<meta charset="utf-8" />
6-
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
7-
<meta name="viewport" content="width=device-width, initial-scale=1" />
8-
<meta name="theme-color" content="#000000" />
9-
<meta name="description" content="Web site created using create-react-app" />
10-
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
11-
<!--
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta name="theme-color" content="#000000" />
8+
<meta
9+
name="description"
10+
content="Web site created using create-react-app"
11+
/>
12+
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13+
<!--
1214
manifest.json provides metadata used when your web app is installed on a
1315
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
1416
-->
15-
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
16-
<!--
17+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18+
<!--
1719
Notice the use of %PUBLIC_URL% in the tags above.
1820
It will be replaced with the URL of the `public` folder during the build.
1921
Only files inside the `public` folder can be referenced from the HTML.
@@ -22,16 +24,19 @@
2224
work correctly both with client-side routing and a non-root public URL.
2325
Learn how to configure a non-root public URL by running `npm run build`.
2426
-->
25-
<link rel="preconnect" href="https://fonts.googleapis.com">
26-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
27-
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
28-
<title>React App</title>
29-
</head>
27+
<link rel="preconnect" href="https://fonts.googleapis.com" />
28+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
29+
<link
30+
href="https://fonts.googleapis.com/css2?family=Roboto&display=swap"
31+
rel="stylesheet"
32+
/>
33+
<title>React App</title>
34+
</head>
3035

31-
<body>
32-
<noscript>You need to enable JavaScript to run this app.</noscript>
33-
<div id="root"></div>
34-
<!--
36+
<body>
37+
<noscript>You need to enable JavaScript to run this app.</noscript>
38+
<div id="root"></div>
39+
<!--
3540
This HTML file is a template.
3641
If you open it directly in the browser, you will see an empty page.
3742
@@ -41,6 +46,29 @@
4146
To begin the development, run `npm start` or `yarn start`.
4247
To create a production bundle, use `npm run build` or `yarn build`.
4348
-->
44-
</body>
45-
46-
</html>
49+
<script>
50+
if ("serviceWorker" in navigator) {
51+
window.addEventListener("load", function () {
52+
navigator.serviceWorker
53+
.register("worker.js")
54+
.then(
55+
function (registration) {
56+
console.log(
57+
"Worker registration successful",
58+
registration.scope
59+
);
60+
},
61+
function (err) {
62+
console.log("Worker registration failed", err);
63+
}
64+
)
65+
.catch(function (err) {
66+
console.log(err);
67+
});
68+
});
69+
} else {
70+
console.log("Service Worker is not supported by browser.");
71+
}
72+
</script>
73+
</body>
74+
</html>
528 Bytes
Binary file not shown.

public/jsonmodel/model.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"format": "layers-model", "generatedBy": "keras v2.5.0", "convertedBy": "TensorFlow.js Converter v3.13.0", "modelTopology": {"keras_version": "2.5.0", "backend": "tensorflow", "model_config": {"class_name": "Sequential", "config": {"name": "sequential", "layers": [{"class_name": "InputLayer", "config": {"batch_input_shape": [null, 30, 1662], "dtype": "float32", "sparse": false, "ragged": false, "name": "lstm_input"}}, {"class_name": "LSTM", "config": {"name": "lstm", "trainable": true, "batch_input_shape": [null, 30, 1662], "dtype": "float32", "return_sequences": true, "return_state": false, "go_backwards": false, "stateful": false, "unroll": false, "time_major": false, "units": 64, "activation": "relu", "recurrent_activation": "sigmoid", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "recurrent_initializer": {"class_name": "Orthogonal", "config": {"gain": 1.0, "seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "unit_forget_bias": true, "kernel_regularizer": null, "recurrent_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "recurrent_constraint": null, "bias_constraint": null, "dropout": 0.0, "recurrent_dropout": 0.0, "implementation": 2}}, {"class_name": "LSTM", "config": {"name": "lstm_1", "trainable": true, "dtype": "float32", "return_sequences": true, "return_state": false, "go_backwards": false, "stateful": false, "unroll": false, "time_major": false, "units": 128, "activation": "relu", "recurrent_activation": "sigmoid", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "recurrent_initializer": {"class_name": "Orthogonal", "config": {"gain": 1.0, "seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "unit_forget_bias": true, "kernel_regularizer": null, "recurrent_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "recurrent_constraint": null, "bias_constraint": null, "dropout": 0.0, "recurrent_dropout": 0.0, "implementation": 2}}, {"class_name": "LSTM", "config": {"name": "lstm_2", "trainable": true, "dtype": "float32", "return_sequences": false, "return_state": false, "go_backwards": false, "stateful": false, "unroll": false, "time_major": false, "units": 64, "activation": "relu", "recurrent_activation": "sigmoid", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "recurrent_initializer": {"class_name": "Orthogonal", "config": {"gain": 1.0, "seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "unit_forget_bias": true, "kernel_regularizer": null, "recurrent_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "recurrent_constraint": null, "bias_constraint": null, "dropout": 0.0, "recurrent_dropout": 0.0, "implementation": 2}}, {"class_name": "Dense", "config": {"name": "dense", "trainable": true, "dtype": "float32", "units": 64, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "dense_1", "trainable": true, "dtype": "float32", "units": 32, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "dense_2", "trainable": true, "dtype": "float32", "units": 2, "activation": "softmax", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}]}}, "training_config": {"loss": "categorical_crossentropy", "metrics": [[{"class_name": "MeanMetricWrapper", "config": {"name": "categorical_accuracy", "dtype": "float32", "fn": "categorical_accuracy"}}]], "weighted_metrics": null, "loss_weights": null, "optimizer_config": {"class_name": "Adam", "config": {"name": "Adam", "learning_rate": 0.001, "decay": 0.0, "beta_1": 0.9, "beta_2": 0.999, "epsilon": 1e-07, "amsgrad": false}}}}, "weightsManifest": [{"paths": ["group1-shard1of1.bin"], "weights": [{"name": "dense/kernel", "shape": [64, 64], "dtype": "float32"}, {"name": "dense/bias", "shape": [64], "dtype": "float32"}, {"name": "dense_1/kernel", "shape": [64, 32], "dtype": "float32"}, {"name": "dense_1/bias", "shape": [32], "dtype": "float32"}, {"name": "dense_2/kernel", "shape": [32, 2], "dtype": "float32"}, {"name": "dense_2/bias", "shape": [2], "dtype": "float32"}, {"name": "lstm/lstm_cell/kernel", "shape": [1662, 256], "dtype": "float32"}, {"name": "lstm/lstm_cell/recurrent_kernel", "shape": [64, 256], "dtype": "float32"}, {"name": "lstm/lstm_cell/bias", "shape": [256], "dtype": "float32"}, {"name": "lstm_1/lstm_cell_1/kernel", "shape": [64, 512], "dtype": "float32"}, {"name": "lstm_1/lstm_cell_1/recurrent_kernel", "shape": [128, 512], "dtype": "float32"}, {"name": "lstm_1/lstm_cell_1/bias", "shape": [512], "dtype": "float32"}, {"name": "lstm_2/lstm_cell_2/kernel", "shape": [128, 256], "dtype": "float32"}, {"name": "lstm_2/lstm_cell_2/recurrent_kernel", "shape": [64, 256], "dtype": "float32"}, {"name": "lstm_2/lstm_cell_2/bias", "shape": [256], "dtype": "float32"}]}]}
1+
{"format": "layers-model", "generatedBy": "keras v2.5.0", "convertedBy": "TensorFlow.js Converter v3.13.0", "modelTopology": {"keras_version": "2.5.0", "backend": "tensorflow", "model_config": {"class_name": "Sequential", "config": {"name": "sequential", "layers": [{"class_name": "InputLayer", "config": {"batch_input_shape": [null, 20, 1662], "dtype": "float32", "sparse": false, "ragged": false, "name": "lstm_input"}}, {"class_name": "LSTM", "config": {"name": "lstm", "trainable": true, "batch_input_shape": [null, 20, 1662], "dtype": "float32", "return_sequences": true, "return_state": false, "go_backwards": false, "stateful": false, "unroll": false, "time_major": false, "units": 64, "activation": "relu", "recurrent_activation": "sigmoid", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "recurrent_initializer": {"class_name": "Orthogonal", "config": {"gain": 1.0, "seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "unit_forget_bias": true, "kernel_regularizer": null, "recurrent_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "recurrent_constraint": null, "bias_constraint": null, "dropout": 0.0, "recurrent_dropout": 0.0, "implementation": 2}}, {"class_name": "LSTM", "config": {"name": "lstm_1", "trainable": true, "dtype": "float32", "return_sequences": true, "return_state": false, "go_backwards": false, "stateful": false, "unroll": false, "time_major": false, "units": 128, "activation": "relu", "recurrent_activation": "sigmoid", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "recurrent_initializer": {"class_name": "Orthogonal", "config": {"gain": 1.0, "seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "unit_forget_bias": true, "kernel_regularizer": null, "recurrent_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "recurrent_constraint": null, "bias_constraint": null, "dropout": 0.0, "recurrent_dropout": 0.0, "implementation": 2}}, {"class_name": "LSTM", "config": {"name": "lstm_2", "trainable": true, "dtype": "float32", "return_sequences": false, "return_state": false, "go_backwards": false, "stateful": false, "unroll": false, "time_major": false, "units": 64, "activation": "relu", "recurrent_activation": "sigmoid", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "recurrent_initializer": {"class_name": "Orthogonal", "config": {"gain": 1.0, "seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "unit_forget_bias": true, "kernel_regularizer": null, "recurrent_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "recurrent_constraint": null, "bias_constraint": null, "dropout": 0.0, "recurrent_dropout": 0.0, "implementation": 2}}, {"class_name": "Dense", "config": {"name": "dense", "trainable": true, "dtype": "float32", "units": 64, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "dense_1", "trainable": true, "dtype": "float32", "units": 32, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "dense_2", "trainable": true, "dtype": "float32", "units": 6, "activation": "softmax", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}]}}, "training_config": {"loss": "categorical_crossentropy", "metrics": [[{"class_name": "MeanMetricWrapper", "config": {"name": "categorical_accuracy", "dtype": "float32", "fn": "categorical_accuracy"}}]], "weighted_metrics": null, "loss_weights": null, "optimizer_config": {"class_name": "Adam", "config": {"name": "Adam", "learning_rate": 0.0010000000474974513, "decay": 0.0, "beta_1": 0.8999999761581421, "beta_2": 0.9990000128746033, "epsilon": 1e-07, "amsgrad": false}}}}, "weightsManifest": [{"paths": ["group1-shard1of1.bin"], "weights": [{"name": "dense/kernel", "shape": [64, 64], "dtype": "float32"}, {"name": "dense/bias", "shape": [64], "dtype": "float32"}, {"name": "dense_1/kernel", "shape": [64, 32], "dtype": "float32"}, {"name": "dense_1/bias", "shape": [32], "dtype": "float32"}, {"name": "dense_2/kernel", "shape": [32, 6], "dtype": "float32"}, {"name": "dense_2/bias", "shape": [6], "dtype": "float32"}, {"name": "lstm/lstm_cell/kernel", "shape": [1662, 256], "dtype": "float32"}, {"name": "lstm/lstm_cell/recurrent_kernel", "shape": [64, 256], "dtype": "float32"}, {"name": "lstm/lstm_cell/bias", "shape": [256], "dtype": "float32"}, {"name": "lstm_1/lstm_cell_1/kernel", "shape": [64, 512], "dtype": "float32"}, {"name": "lstm_1/lstm_cell_1/recurrent_kernel", "shape": [128, 512], "dtype": "float32"}, {"name": "lstm_1/lstm_cell_1/bias", "shape": [512], "dtype": "float32"}, {"name": "lstm_2/lstm_cell_2/kernel", "shape": [128, 256], "dtype": "float32"}, {"name": "lstm_2/lstm_cell_2/recurrent_kernel", "shape": [64, 256], "dtype": "float32"}, {"name": "lstm_2/lstm_cell_2/bias", "shape": [256], "dtype": "float32"}]}]}

public/worker.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
var CACHE_NAME = "pwa-task-manager";
2+
var urlsToCache = ["/"];
3+
4+
// Install a service worker
5+
self.addEventListener("install", (event) => {
6+
// Perform install steps
7+
event.waitUntil(
8+
caches.open(CACHE_NAME).then(function (cache) {
9+
console.log("Opened cache");
10+
return cache.addAll(urlsToCache);
11+
})
12+
);
13+
});
14+
15+
// Cache and return requests
16+
self.addEventListener("fetch", (event) => {
17+
event.respondWith(
18+
caches.match(event.request).then(function (response) {
19+
// Cache hit - return response
20+
if (response) {
21+
return response;
22+
}
23+
return fetch(event.request);
24+
})
25+
);
26+
});
27+
28+
// Update a service worker
29+
self.addEventListener("activate", (event) => {
30+
var cacheWhitelist = ["pwa-task-manager"];
31+
event.waitUntil(
32+
caches.keys().then((cacheNames) => {
33+
return Promise.all(
34+
cacheNames.map((cacheName) => {
35+
if (cacheWhitelist.indexOf(cacheName) === -1) {
36+
return caches.delete(cacheName);
37+
}
38+
})
39+
);
40+
})
41+
);
42+
});

src/App.js

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,62 @@
11
import Detector from "./detector/Detector";
2-
import { useState, useLayoutEffect } from 'react';
3-
// import { getCookie } from "./helperFunctions";
2+
import { useState, useLayoutEffect } from "react";
3+
import { getCookie } from "./helperFunctions";
44
import OnBoardingScreen from "./onBoardingScreen/OnBoardingScreen";
55
import { theme } from "./Theme";
6-
import { ThemeProvider } from '@mui/material/styles';
7-
import './onBoardingScreen/transitionStyles.css';
6+
import { ThemeProvider } from "@mui/material/styles";
7+
import "./onBoardingScreen/transitionStyles.css";
88

99
const stepColors = {
1010
0: "#4abdac",
1111
1: "#7d94b5",
12-
2: "#eb6e80",
13-
}
12+
2: "#2653AF",
13+
};
1414

1515
function App() {
16-
17-
const [showOnboardingScreen, setShowOnboardingScreen] = useState(true)
16+
const [showOnboardingScreen, setShowOnboardingScreen] = useState(true);
1817
const [activeStep, setActiveStep] = useState(0);
1918

20-
const handleNext = () => setActiveStep((prevActiveStep) => prevActiveStep + 1);
19+
const handleNext = () =>
20+
setActiveStep((prevActiveStep) => prevActiveStep + 1);
2121

22-
const handleSkip = () => setShowOnboardingScreen(false)
22+
const handleSkip = () => setShowOnboardingScreen(false);
2323

2424
useLayoutEffect(() => {
25-
// let isUserOnboarded = getCookie("isUserOnboarded");
26-
// if (isUserOnboarded === "") {
27-
// document.cookie = "isUserOnboarded=true";
28-
// }
29-
// else {
30-
// setShowOnboardingScreen(false);
31-
// }
32-
33-
}, [])
25+
let isUserOnboarded = getCookie("isUserOnboarded");
26+
if (isUserOnboarded === "") {
27+
document.cookie = "isUserOnboarded=true";
28+
} else {
29+
setShowOnboardingScreen(false);
30+
}
31+
}, []);
3432

3533
return (
36-
3734
<ThemeProvider theme={theme}>
38-
<div className="App" style={{ display: "flex", justifyContent: "center", alignItems: "center", backgroundColor: showOnboardingScreen ? stepColors[activeStep] : "white", height: "100vh", width: "100%" }}>
39-
{
40-
showOnboardingScreen ?
41-
<OnBoardingScreen
42-
handleNext={handleNext}
43-
handleSkip={handleSkip}
44-
activeStep={activeStep}
45-
/>
46-
:
47-
<Detector />
48-
}
35+
<div
36+
className="App"
37+
style={{
38+
display: "flex",
39+
justifyContent: "center",
40+
alignItems: "center",
41+
backgroundColor: showOnboardingScreen
42+
? stepColors[activeStep]
43+
: "white",
44+
height: "100vh",
45+
width: "100%",
46+
}}
47+
>
48+
{showOnboardingScreen ? (
49+
<OnBoardingScreen
50+
handleNext={handleNext}
51+
handleSkip={handleSkip}
52+
activeStep={activeStep}
53+
/>
54+
) : (
55+
<Detector />
56+
)}
4957
</div>
5058
</ThemeProvider>
51-
)
52-
59+
);
5360
}
5461

5562
export default App;

0 commit comments

Comments
 (0)