Skip to content

Commit

Permalink
Merge pull request #186 from COS301-SE-2024/hotfix/build
Browse files Browse the repository at this point in the history
Hotfix/build
  • Loading branch information
Donatello-Carboni authored Sep 30, 2024
2 parents 3770245 + cdd4946 commit c61115c
Show file tree
Hide file tree
Showing 15 changed files with 415 additions and 454 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ ModelsVenv
.pnp.*
.yarnrc.yml
package-lock.json
dist

# Python specific
*.py[cod]
Expand Down
13 changes: 9 additions & 4 deletions Desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"name": "HighViz",
"version": "3.0.0",
"author": "Bitforge Team [email protected]",
"author": {
"email": "[email protected]"
},
"homepage": "206.189.188.197:8000/download",
"main": "src/electron.js",
"type": "commonjs",
Expand All @@ -13,7 +15,8 @@
"test:watch": "vitest",
"test:report": "vitest --ui & playwright show-report",
"playwright": "playwright test",
"playwright:report": "playwright show-report"
"playwright:report": "playwright show-report",
"postinstall": "electron-builder install-app-deps"
},
"dependencies": {
"@lottiefiles/dotlottie-svelte": "^0.3.14",
Expand All @@ -37,6 +40,7 @@
"bcryptjs": "^2.4.3",
"crypto-js": "^4.2.0",
"d3": "^7.9.0",
"dotenv": "^16.4.5",
"electron-reloader": "^1.2.3",
"electron-store": "^9.0.0",
"express": "^4.19.2",
Expand Down Expand Up @@ -81,7 +85,7 @@
"@vitest/ui": "^1.6.0",
"babel-jest": "^27.0.0",
"daisyui": "^4.12.10",
"electron": "^32.1.2",
"electron": "^31.0.0",
"electron-builder": "^24.13.3",
"electron-rebuild": "^3.2.9",
"ffmpeg": "^0.0.4",
Expand All @@ -97,7 +101,8 @@
"files": [
"public/build/**/*",
"src/**/*",
"public/index.html"
"public/index.html",
".env"
],
"win": {
"target": [
Expand Down
32 changes: 15 additions & 17 deletions Desktop/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
import Router from "svelte-spa-router";
import routes from "./routes/routes";
import { cuda, loadState } from "./stores/processing";
import { theme } from './stores/themeStore.js';
import { theme } from "./stores/themeStore.js";
import toast, { Toaster } from "svelte-french-toast";
import { onMount } from "svelte";
Expand Down Expand Up @@ -34,41 +33,40 @@
console.log("Cuda: ", isCuda);
cuda.set(isCuda);
});
let currentTheme;
$: {
theme.subscribe(value => {
theme.subscribe((value) => {
currentTheme = value;
});
}
function toggleTheme() {
if (currentTheme === 'highVizLight') {
theme.set('highVizDark');
if (currentTheme === "highVizLight") {
theme.set("highVizDark");
} else {
theme.set('highVizLight');
theme.set("highVizLight");
}
}
$: {
theme.subscribe(value => {
currentTheme = value;
// Change the body class when the theme changes
document.body.className = theme === 'theme' ? 'highVizLight' : 'highVizDark';
});
}
$: {
theme.subscribe((value) => {
currentTheme = value;
// Change the body class when the theme changes
document.body.className =
theme === "theme" ? "highVizLight" : "highVizDark";
});
}
</script>

<div style="height: inherit;">
<!-- class="mainContainer" -->
<Toaster />
<Router {routes} />


</div>

<style>
@import './global.css';
@import "./global.css";
/* .mainContainer {
background-image: linear-gradient(180deg, #001524, #181818);
width: 100% !important;
Expand Down
6 changes: 2 additions & 4 deletions Desktop/src/components/DriveCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@
import { onMount } from "svelte";
import { VideoURL, OriginalVideoURL } from "../stores/video";
import { originalVideoURL } from "../stores/processing";
import RingLoader from "./RingLoader.svelte";
import { push } from "svelte-spa-router";
import { mdiDownload, mdiPlayCircle } from "@mdi/js";
import { Icon, Tooltip } from "svelte-materialify";
import { Tooltip } from "svelte-materialify";
import {theme} from '../stores/themeStore';
export let videoSource;
export let videoName;
export let listType;
let isGalLoading = false;
let firstFrameURL = "";
let firstFrameURL = "https://www.solidbackgrounds.com/images/1920x1080/1920x1080-gray-solid-color-background.jpg";
let showTooltip = false;
let processed = false;
Expand Down
2 changes: 0 additions & 2 deletions Desktop/src/components/ModelsCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@
console.log("handleClick for " + Model.mName);
};
</script>

{#if $theme === 'highVizLight'}
Expand Down
8 changes: 4 additions & 4 deletions Desktop/src/components/ModelsCardContent.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
<div class="align-right font-bold text-black justify-right mt-2 text-lg "> Version: {Model.mVersion}</div>
</div>

<!-- Placeholder for Dashboard -->
<!-- Placeholder for Dashboard
<div class="text-primary bg-highVizLight-accent rounded-lg flex items-center justify-center col-span-1 row-span-2">
<span>placeholder for {Model.mName} dashboard </span>
</div>
</div> -->

<!-- Summary -->
<div class="text-black p-4 text-xl col-span-1 row-span-2">
Expand Down Expand Up @@ -70,10 +70,10 @@
<div class="align-right font-bold text-theme-dark-white justify-right mt-2 text-lg "> Version: {Model.mVersion}</div>
</div>

<!-- Placeholder for Dashboard -->
<!-- Placeholder for Dashboard
<div class="text-theme-dark bg-theme-dark-primary rounded-lg flex items-center justify-center col-span-1 row-span-2">
<span>placeholder for {Model.mName} dashboard </span>
</div>
</div> -->

<!-- Summary -->
<div class="text-white p-4 text-xl col-span-1 row-span-2">
Expand Down
10 changes: 5 additions & 5 deletions Desktop/src/components/SidebarV2.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@
route: "#/startCarla",
iconPath: mdiCar,
},
{
name: "Visualizer",
route: "#/visualize",
iconPath: mdiEyeRefresh,
},
// {
// name: "Visualizer",
// route: "#/visualize",
// iconPath: mdiEyeRefresh,
// },
{
id: "go-to-drive-gallery",
name: "Drive Gallery",
Expand Down
2 changes: 1 addition & 1 deletion Desktop/src/components/UploadModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@
response2.error,
);
}
console.log("TESTING SAVE BEFORE PUSHING SUPPOSED TO HAPPEN");
showModal = false;
push("/gallery");
} catch (error) {
console.error("Error occurred:", error);
Expand Down
22 changes: 11 additions & 11 deletions Desktop/src/database.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
const { app } = require('electron');
const { Sequelize, DataTypes } = require('sequelize');
const path = require('path');
const fs = require('fs');

// Determine the correct path for the SQLite database
const isPackaged = process.env.NODE_ENV === 'production' || process.argv.includes('--app');
const basePath = isPackaged ? process.resourcesPath : __dirname;
const databasePath = path.join(basePath, 'database.sqlite');
// Get the path for the SQLite database
const databasePath = path.join(app.getPath('userData'), 'database.sqlite');

// Ensure the directory exists in a writable location for the database file
if (!fs.existsSync(path.dirname(databasePath))) {
fs.mkdirSync(path.dirname(databasePath), { recursive: true });
const databaseDirectory = path.dirname(databasePath);
if (!fs.existsSync(databaseDirectory)) {
fs.mkdirSync(databaseDirectory, { recursive: true });
}

const sequelize = new Sequelize({
dialect: 'sqlite',
storage: path.join(__dirname, 'database.sqlite')
storage: databasePath,
});

const LookupTable = sequelize.define('LookupTable', {
Expand All @@ -38,7 +38,7 @@ const LookupTable = sequelize.define('LookupTable', {
},
uid: {
type: DataTypes.INTEGER,
allowNull:false
allowNull: false
}
});

Expand Down Expand Up @@ -147,14 +147,14 @@ sequelize.sync().then(async () => {
{
model_id: '4',
model_name: 'HV1',
model_description: 'HV1 is an advanced model under development, focused on high-velocity object detection and tracking.',
model_description: 'HV1 uses a YOLO architecture to segement lanes for the purpose of lane assistance.',
model_version: '1.0',
model_summary: 'Work in progress.',
model_summary: 'Lane segmentation model',
model_profileimg: 'https://images.unsplash.com/flagged/photo-1554042329-269abab49dc9?q=80&w=1170&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
model_img: 'https://media1.tenor.com/m/GqOoWCxt5DEAAAAC/fast-car.gif'
}
]);
}
});

module.exports = { sequelize, LookupTable, AIModels, VideoTable };
module.exports = { sequelize, LookupTable, AIModels, VideoTable, DataTypes };
Loading

0 comments on commit c61115c

Please sign in to comment.