Skip to content

Commit

Permalink
Merge pull request #43 from fabmob/adrien_ui_rework
Browse files Browse the repository at this point in the history
V2.1 - Community edition
  • Loading branch information
TTalex authored Oct 31, 2023
2 parents 72b2f5c + c009b9a commit 89b1ef9
Show file tree
Hide file tree
Showing 164 changed files with 4,832 additions and 2,787 deletions.
Binary file added .DS_Store
Binary file not shown.
20 changes: 14 additions & 6 deletions backend/dbwrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function createProject(project: types.Project, owner: string): [string |
])
return [null, res]
} catch (error: any) {
return [error?.code, null]
return [error?.code, null]
}
}

Expand Down Expand Up @@ -266,14 +266,22 @@ export function updateProject(id: number, owner: string, project: types.Project,
}
}
export function deleteProject(id: number, owner: string, isAdmin: boolean) {
let updateProjectStatusStmt
let deleteProjectStmt
let res
if (isAdmin) {
updateProjectStatusStmt = db.prepare("DELETE FROM Projects where id = ?")
res = updateProjectStatusStmt.run([id])
deleteProjectStmt = db.prepare("DELETE FROM ProjectSteps where projectId = ?")
res = deleteProjectStmt.run([id])
deleteProjectStmt = db.prepare("DELETE FROM ProjectSources where projectId = ?")
res = deleteProjectStmt.run([id])
deleteProjectStmt = db.prepare("DELETE FROM Projects where id = ?")
res = deleteProjectStmt.run([id])
} else {
updateProjectStatusStmt = db.prepare("DELETE FROM Projects where id = ? and owner = ?")
res = updateProjectStatusStmt.run([id, owner])
deleteProjectStmt = db.prepare("DELETE FROM ProjectSteps where projectId = ? and owner = ?")
res = deleteProjectStmt.run([id, owner])
deleteProjectStmt = db.prepare("DELETE FROM ProjectSources where projectId = ? and owner = ?")
res = deleteProjectStmt.run([id, owner])
deleteProjectStmt = db.prepare("DELETE FROM Projects where id = ? and owner = ?")
res = deleteProjectStmt.run([id, owner])
}
return res
}
Expand Down
2 changes: 1 addition & 1 deletion backend/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ app.get('/api/project/:projectId/viz', keycloak.protect(), (req: Request, res: R
});
});

// emissions and energy computed for top down checking
// emissions and energy computed for top-down checking
app.get('/api/project/:projectId/Inventory/0/emissions', keycloak.protect(), (req: Request, res: Response) => {
const owner = (req as any).kauth.grant.access_token.content.email
const isAdmin = (req as any).kauth.grant.access_token.content.realm_access.roles.indexOf("app-admin") !== -1
Expand Down
2 changes: 1 addition & 1 deletion backend/keycloak-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let keycloak = <Keycloak.Keycloak><unknown>undefined
const keycloakConfig = {
"realm": "myc-convert",
"bearer-only": true,
"auth-server-url": "http://0.0.0.0:8080/",
"auth-server-url": "https://idpmyc.fabmob.io:8443/",
"ssl-required": "external",
"resource": "node-microservice",
"confidential-port": 0
Expand Down
Binary file added data.db
Binary file not shown.
Binary file added frontend/.DS_Store
Binary file not shown.
Binary file added frontend/public/.DS_Store
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file removed frontend/public/asi-approach-diagram.png
Diff not rendered.
Binary file removed frontend/public/asif-framework-diagram.png
Diff not rendered.
Binary file added frontend/public/fonts/.DS_Store
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
107 changes: 107 additions & 0 deletions frontend/public/icons.svg
2 changes: 1 addition & 1 deletion frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Mono:300,400,600,700&amp;lang=fr" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,600,700&amp;lang=fr" />
<title>Mobilise Your City GHG calculator</title>
<title>MYC GHG emissions calculator</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
Binary file added frontend/public/logos/logo-ADB.png
Binary file added frontend/public/logos/logo-ADEME.png
Binary file added frontend/public/logos/logo-AFD.png
Binary file added frontend/public/logos/logo-Cerema.png
Binary file added frontend/public/logos/logo-Codatu.png
Binary file added frontend/public/logos/logo-DTFA.png
Binary file added frontend/public/logos/logo-EB.png
Binary file added frontend/public/logos/logo-ECF.png
Binary file added frontend/public/logos/logo-EU.png
Binary file added frontend/public/logos/logo-Euroclima.png
Binary file added frontend/public/logos/logo-FFEM.png
Binary file added frontend/public/logos/logo-FMECD.png
Binary file added frontend/public/logos/logo-FMENCNSCP.png
Binary file added frontend/public/logos/logo-GIZ.png
Binary file added frontend/public/logos/logo-GPIT.png
File renamed without changes
Binary file added frontend/public/logos/logo-ITDP.png
Binary file added frontend/public/logos/logo-KFW.png
Binary file added frontend/public/logos/logo-MP.png
Binary file added frontend/public/logos/logo-MTE.png
File renamed without changes
Binary file added frontend/public/logos/logo-Platforma.png
Binary file added frontend/public/logos/logo-SMFA.png
Binary file added frontend/public/logos/logo-SSATP.png
Binary file added frontend/public/logos/logo-TRUFI.png
Binary file added frontend/public/logos/logo-TUMI.png
Binary file added frontend/public/logos/logo-UCLG.png
Binary file added frontend/public/logos/logo-UNH.png
Binary file added frontend/public/logos/logo-WI.png
File renamed without changes
10 changes: 10 additions & 0 deletions frontend/public/logos/logo-github.svg
7 changes: 7 additions & 0 deletions frontend/public/navbar-toggler-icon.svg
Binary file added frontend/public/pictures/.DS_Store
Binary file not shown.
Binary file added frontend/public/pictures/frame-364-1.png
Binary file added frontend/public/pictures/frame-364-2.png
Binary file added frontend/public/pictures/frame-364-3.png
3 changes: 3 additions & 0 deletions frontend/public/pictures/homepage-hero-bg.svg
Binary file added frontend/public/pictures/homepage-hero-illu-2.png
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
8 changes: 0 additions & 8 deletions frontend/src/App.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/* .App {
text-align: center;
} */

.App-logo {
height: 40vmin;
pointer-events: none;
Expand All @@ -26,8 +22,4 @@

.App-link {
color: #61dafb;
}

.nav-link {
margin: 0 10px 0 10px
}
21 changes: 13 additions & 8 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react'
import './App.css'
import Projects from './pages/Projects'
import CreateProject from './pages/CreateProject'
import WelcomePage from './pages/WelcomePage'
import InventoryIntro from './pages/Inventory/InventoryIntro'
import InventoryStep1 from './pages/Inventory/InventoryStep1'
Expand Down Expand Up @@ -38,23 +37,28 @@ import Nav from "./components/Nav"
import { BrowserRouter, Route, Routes } from "react-router-dom"
import { ReactKeycloakProvider } from "@react-keycloak/web"
import keycloak from "./Keycloak"
import ProjectSummary from './pages/ProjectSummary'
import ProjectCompare from './pages/ProjectCompare'
import Project from './pages/Project'
// import Footer from "./components/Footer"

// adrien test 231021 to reset scroll on every page change
import ScrollToTop from "./scrollToTop";


function App() {
return (
<div className="App">
<ReactKeycloakProvider authClient={keycloak} initOptions={{onLoad: 'check-sso', silentCheckSsoRedirectUri: window.location.origin + '/silent-check-sso.html'}}>
<BrowserRouter>
<ScrollToTop />
<Nav />
<Routes>
<Route path="/" element={<WelcomePage />} />
<Route path="/Projects" element={<Projects />} />
<Route path="/createProject" element={<CreateProject />} />
{/* config also using createproject page, as a way of editing project info */}
<Route path="/project/:projectId/config" element={<CreateProject />} />
<Route path="/project/:projectId/edit" element={<ProjectSummary />} />
<Route path="/project/:projectId/viz" element={<ProjectCompare />} />
<Route path="/createProject" element={<Project page="config" />} />
{/* config also using project config page, as a way of editing project info */}
<Route path="/project/:projectId/config" element={<Project page="config" />} />
<Route path="/project/:projectId/edit" element={<Project page="edit" />} />
<Route path="/project/:projectId/viz" element={<Project page="viz" />} />

<Route path="/project/:projectId/Inventory/intro" element={<InventoryIntro />} />
<Route path="/project/:projectId/Inventory/step/1" element={<InventoryStep1 />} />
Expand Down Expand Up @@ -87,6 +91,7 @@ function App() {
<Route path="/project/:projectId/Climate/:climateScenarioId/Without/step/6" element={<ClimateWithoutUpstreamStep6 />} />
<Route path="/project/:projectId/Climate/:climateScenarioId/Without/step/7" element={<ClimateWithoutUpstreamStep7 />} />
</Routes>
{/* <Footer /> */}
</BrowserRouter>
</ReactKeycloakProvider>
</div>
Expand Down
Loading

0 comments on commit 89b1ef9

Please sign in to comment.