1
Fork 0
mirror of https://github.com/Steffo99/unisteffo.git synced 2024-11-26 18:04:20 +00:00
triennale-appunti-steffo/src/index.js

115 lines
4.6 KiB
JavaScript
Raw Normal View History

2020-05-27 16:31:11 +00:00
let Sentry = null;
2020-08-21 16:33:22 +00:00
if (process.env.NODE_ENV === "development") {
2020-05-27 16:31:11 +00:00
console.debug("Initializing Preact Debugger...")
require("preact/debug");
2020-08-21 16:33:22 +00:00
} else if (process.env.NODE_ENV === "production") {
2020-05-27 16:31:11 +00:00
console.debug("Initializing Sentry...")
Sentry = require("@sentry/browser");
2020-05-28 00:26:20 +00:00
// noinspection JSUnresolvedVariable
Sentry.init({
dsn: "https://9f5089346fd14e04a6f412638474dfec@o40131.ingest.sentry.io/5255500",
2020-05-28 13:19:33 +00:00
release: process.env.RELEASE,
2020-05-28 14:02:00 +00:00
environment: "production",
2020-05-28 14:32:33 +00:00
beforeSend(event, hint) {
if (event.exception) {
2020-08-21 16:33:22 +00:00
Sentry.showReportDialog({eventId: event.event_id});
2020-05-28 14:32:33 +00:00
}
return event;
}
2020-05-28 00:26:20 +00:00
});
2020-05-28 15:09:52 +00:00
}
2020-03-01 21:18:41 +00:00
2020-08-21 16:33:22 +00:00
// Import debugging tools
2020-03-01 20:25:46 +00:00
// noinspection ES6UnusedImports
2020-06-18 17:46:40 +00:00
import "bluelib/dist/index.css";
2020-06-29 13:45:09 +00:00
import './meta/manifest.json';
import './meta/CNAME';
import './meta/.nojekyll';
import './meta/favicon.ico';
2020-03-01 21:18:41 +00:00
import Router from 'preact-router';
2020-03-01 20:25:46 +00:00
import {createHashHistory} from "history";
2020-08-21 16:33:22 +00:00
import {BasicContainer, Bluelib, BoxColors, CurrentPage, LatexRenderColor, Panel} from "bluelib";
2020-05-28 16:07:00 +00:00
import Home from './routes/Home';
import Fisica from './routes/Fisica';
import VlDiGeometria from './routes/VlDiGeometria';
import MingwInstall from './routes/MingwInstall';
2020-06-18 15:23:31 +00:00
import Footer from './components/Footer';
2020-05-28 16:07:00 +00:00
import Statistica from './routes/Statistica';
2020-05-27 13:15:02 +00:00
import OttimizzazioneLineare from "./routes/OttimizzazioneLineare";
2020-05-28 16:07:00 +00:00
import BasiDiDati from './routes/BasiDiDati';
import CalcoloNumerico from './routes/CalcoloNumerico';
import ApprendimentoSistemiArtificiali from "./routes/ApprendimentoSistemiArtificiali";
import NetLogo from "./routes/NetLogo";
import AlgoritmiEStruttureDati from "./routes/AlgoritmiEStruttureDati";
2020-06-28 17:05:08 +00:00
import {useState} from "preact/hooks";
import Link from "./components/Link";
2020-08-21 16:33:22 +00:00
import RipassoDiAlgebraLineare from "./routes/RipassoDiAlgebraLineare";
2019-11-07 10:22:09 +00:00
2019-12-09 15:29:44 +00:00
// noinspection JSUnusedGlobalSymbols
2020-08-21 16:33:22 +00:00
export default function (props) {
let [currentPage, setCurrentPage] = useState(window.location.hash.substr(1));
const onPageChange = (event) => {
setCurrentPage(event.url);
};
let [latexColor, _setLatexColor] = useState("White");
function setLatexColor(color) {
return function () {
_setLatexColor(color);
}
}
function stampa() {
return function () {
print();
}
}
2020-06-28 17:05:08 +00:00
2020-08-21 16:33:22 +00:00
return (
<CurrentPage.Provider value={currentPage}>
<LatexRenderColor.Provider value={latexColor}>
2020-06-28 17:05:08 +00:00
2020-08-21 16:33:22 +00:00
<Bluelib>
<h1>
<Link href={"/"} icon={false}>Appuntiweb</Link> di <Link
href={"https://steffo.eu"}>Steffo</Link>
</h1>
<BasicContainer>
<Panel color={BoxColors.LIME} title={"NOVITÀ: Stampa pagina"}>
<ul>
<li>
Per stampare la pagina, <button onClick={setLatexColor("Black")}>cambia colore delle
formule a Nero</button>, poi clicca <button onClick={stampa()}>Stampa</button>.
</li>
<li>
Per riportare la pagina alla normalità, <button
onClick={setLatexColor("White")}>cambia colore delle formule a Bianco</button>.
</li>
</ul>
</Panel>
<Router history={createHashHistory()} onChange={onPageChange}>
<Home path="/"/>
<Fisica path="/fisica"/>
<VlDiGeometria path="/vldigeometria"/>
<MingwInstall path="/mingwinstall"/>
<Statistica path="/statistica"/>
<OttimizzazioneLineare path="/ottimizzazionelineare"/>
<BasiDiDati path="/basididati"/>
<CalcoloNumerico path="/calcolonumerico"/>
<RipassoDiAlgebraLineare path="/calcolonumerico/ripassodialgebralineare"/>
<ApprendimentoSistemiArtificiali path="/apprendimento"/>
<NetLogo path="/apprendimento/netlogo"/>
<AlgoritmiEStruttureDati path="/algoritmiestrutturedati"/>
<Panel default color={BoxColors.RED} title={"Errore"}>Pagina non trovata.</Panel>
</Router>
</BasicContainer>
<Footer/>
</Bluelib>
2020-06-28 17:05:08 +00:00
2020-08-21 16:33:22 +00:00
</LatexRenderColor.Provider>
</CurrentPage.Provider>
);
2019-11-07 10:22:09 +00:00
}