Skip to content

Commit

Permalink
Merge in upstream/main
Browse files Browse the repository at this point in the history
  • Loading branch information
CannonLock committed Dec 14, 2023
2 parents 2a5528a + 107655c commit be8eb7d
Show file tree
Hide file tree
Showing 142 changed files with 345 additions and 654 deletions.
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2018 John J Czaplewski
Copyright (c) 2018-2023 John J Czaplewski and others

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -16,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@
"use-debounce": "^9.0.4",
"use-react-router-breadcrumbs": "^3.2.1",
"use-resize-observer": "^9.1.0",
"vike": "^0.4.150",
"vite": "^4.4.9",
"vite-plugin-cesium": "^1.2.22",
"vite-plugin-ssr": "^0.4.139"
"vite-plugin-cesium": "^1.2.22"
},
"resolutions": {
"react": "^18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/data-sheet-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dependencies": {
"@blueprintjs/core": "^4",
"@blueprintjs/table": "^4",
"@macrostrat/data-sheet": "workspace:^2.0.0-a1",
"@macrostrat/data-sheet": "workspace:*",
"@macrostrat/hyper": "^2.2.1",
"@macrostrat/ui-components": "workspace:^3.0.0",
"chroma-js": "^2.4.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/globe-dev/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import Map from "./map-comparison";
import {
getMapPositionForHash,
applyMapPositionToHash,
} from "~/map-interface/app-state/reducers/hash-string";
} from "/Users/Daven/Projects/Macrostrat/Software/web/src/pages/map/map-interface/app-state/reducers/hash-string";

function VisControl({ show, setShown, name }) {
const className = show ? "active" : "";
Expand Down
71 changes: 37 additions & 34 deletions server/index.js
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
// This file isn't processed by Vite, see https://github.com/brillout/vite-plugin-ssr/issues/562
// This file isn't processed by Vite, see https://github.com/brillout/vike/issues/562
// Consequently:
// - When changing this file, you needed to manually restart your server for your changes to take effect.
// - To use your environment variables defined in your .env files, you need to install dotenv, see https://vite-plugin-ssr.com/env
// - To use your path aliases defined in your vite.config.js, you need to tell Node.js about them, see https://vite-plugin-ssr.com/path-aliases
// - To use your environment variables defined in your .env files, you need to install dotenv, see https://vike.dev/env
// - To use your path aliases defined in your vite.config.js, you need to tell Node.js about them, see https://vike.dev/path-aliases

import express from 'express'
import compression from 'compression'
import { renderPage } from 'vite-plugin-ssr/server'
import { root } from './root.js'
import express from "express"
import compression from "compression"
import { renderPage } from "vite-plugin-ssr/server"
import { root } from "./root.js"

// Auth imports
import cookieParser from 'cookie-parser'
import * as jose from 'jose'
import cookieParser from "cookie-parser"
import * as jose from "jose"

const isProduction = process.env.NODE_ENV === 'production'
const isProduction = process.env.NODE_ENV === "production"

startServer()
startServer();

async function startServer() {
const app = express()
const app = express();

app.use(compression())
app.use(cookieParser())
app.use(compression());
app.use(cookieParser());

// Vite integration
if (isProduction) {
// In production, we need to serve our static assets ourselves.
// (In dev, Vite's middleware serves our static assets.)
const sirv = (await import('sirv')).default
app.use(sirv(`${root}/dist/client`))
const sirv = (await import("sirv")).default;
app.use(sirv(`${root}/dist/client`));
} else {
// We instantiate Vite's development server and integrate its middleware to our server.
// ⚠️ We instantiate it only in development. (It isn't needed in production and it
// would unnecessarily bloat our production server.)
const vite = await import('vite')
const vite = await import("vite");
const viteDevMiddleware = (
await vite.createServer({
root,
server: { middlewareMode: true },
})
).middlewares
app.use(viteDevMiddleware)
).middlewares;
app.use(viteDevMiddleware);
}

// ...
// Other middlewares (e.g. some RPC middleware such as Telefunc)
// ...

// Vite-plugin-ssr middleware. It should always be our last middleware (because it's a
// vike middleware. It should always be our last middleware (because it's a
// catch-all middleware superseding any middleware placed after it).
app.get('*', async (req, res, next) => {

Expand All @@ -70,25 +70,28 @@ async function startServer() {
const pageContextInit = {
urlOriginal: req.originalUrl,
user: user
}
};

const pageContext = await renderPage(pageContextInit)
const pageContext = await renderPage(pageContextInit);

const { httpResponse } = pageContext
const { httpResponse } = pageContext;
if (!httpResponse) {
return next()
return next();
} else {
const { body, statusCode, headers, earlyHints } = httpResponse
const { body, statusCode, headers, earlyHints } = httpResponse;
// if (res.writeEarlyHints) res.writeEarlyHints({ link: earlyHints.map((e) => e.earlyHintLink) })
headers.forEach(([name, value]) => res.setHeader(name, value))
res.status(statusCode)
if (!res.hasHeader('Content-Type')) res.setHeader('Content-Type', 'text/html');
// For HTTP streams use httpResponse.pipe() instead, see https://vite-plugin-ssr.com/stream
res.send(body)
headers.forEach(([name, value]) => res.setHeader(name, value));
res.status(statusCode);
if (!res.hasHeader("Content-Type"))
res.setHeader("Content-Type", "text/html");
// For HTTP streams use httpResponse.pipe() instead, see https://vike.dev/stream
res.send(body);
}
})
});

const port = process.env.PORT || 3000
app.listen(port)
console.log(`Server (${process.env.NODE_ENV}) running at http://localhost:${port}`)
const port = process.env.PORT || 3000;
app.listen(port);
console.log(
`Server (${process.env.NODE_ENV}) running at http://localhost:${port}`
);
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/dev/index.ts → src/_legacy/map-dev/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import { loadableElement } from "~/_utils";
import styles from "./main.module.styl";
import { MapColorsInspector } from "./color-schemes";
import { WeaverPage } from "../weaver";
import { WeaverPage } from "../../weaver";
const h = hyper.styled(styles);

export default function DevIndex() {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Routes, Route, Link, useParams } from "react-router-dom";
import styles from "../main.module.styl";
import { useAPIResult, ErrorBoundary } from "@macrostrat/ui-components";
import { ParentRouteButton } from "~/components/map-navbar";
import { SETTINGS } from "~/map-interface/settings";
import { SETTINGS } from "~/settings";
import { Spinner } from "@blueprintjs/core";
import { BasicLayerInspectorPage } from ".";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import {
import { useStoredState, useDarkMode } from "@macrostrat/ui-components";
import mapboxgl from "mapbox-gl";
import { useCallback, useEffect, useState, useMemo } from "react";
import { SETTINGS } from "~/map-interface/settings";
import { SETTINGS } from "~/settings";
import { FloatingNavbar } from "@macrostrat/map-interface";
import { useAppActions } from "../../map-interface/app-state";
import { useAppActions } from "../../../pages/map/map-interface/app-state";
import { LocationPanel } from "@macrostrat/map-interface";
import { MapAreaContainer } from "../../map-interface/map-page";
import { PanelCard } from "../../map-interface/map-page/menu";
import { getBaseMapStyle } from "../../map-interface/map-page/map-view";
import { MapAreaContainer } from "../../../pages/map/map-interface/map-page";
import { PanelCard } from "../../../pages/map/map-interface/map-page/menu";
import { getBaseMapStyle } from "../../../pages/map/map-interface/map-page/map-view";
import { MapLoadingButton } from "@macrostrat/map-interface";
import {
toggleLineSymbols,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ import { FormGroup, Label, Slider, Spinner } from "@blueprintjs/core";
import { useDarkMode } from "@macrostrat/ui-components";
import { useEffect, useState, useMemo } from "react";
import { useSelector } from "react-redux";
import { useAppActions, useAppState } from "~/map-interface/app-state";
import { MapAreaContainer } from "~/map-interface/map-page";
import { PanelCard } from "~/map-interface/map-page/menu";
import { getBaseMapStyle } from "~/map-interface/map-page/map-view";
import {
useAppActions,
useAppState,
} from "~/pages/map/map-interface/app-state";
import { MapAreaContainer } from "~/pages/map/map-interface/map-page";
import { PanelCard } from "~/pages/map/map-interface/map-page/menu";
import { getBaseMapStyle } from "~/pages/map/map-interface/map-page/map-view";
import { MacrostratRasterTileset, buildRasterStyle, h } from ".";
import { FloatingNavbar, MapLoadingButton } from "@macrostrat/map-interface";
import { useMapStyle } from "./utils";
Expand Down
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.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect } from "react";
import { useBurwellActions } from "~/burwell-sources/app-state";
import { useBurwellActions } from "~/_legacy/map-sources/app-state";
import hyper from "@macrostrat/hyper";
import IndexMapContainer from "./map";
import { InfoDrawer } from "./info-drawer";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { NavLink } from "react-router-dom";
import { useBurwellActions } from "~/burwell-sources/app-state";
import { useBurwellActions } from "~/_legacy/map-sources/app-state";
import { ExpansionPanel } from "@macrostrat/map-interface";
import h from "@macrostrat/hyper";
import { settings, zoomMap } from "../app-state/utils";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
useBurwellActions,
useBurwellState,
flyToData,
} from "~/burwell-sources/app-state";
} from "~/_legacy/map-sources/app-state";
import { initializeMap } from "./initialize-map";
import { mapSources } from "./map-sources";
import h from "@macrostrat/hyper";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import {
useBurwellActions,
useBurwellState,
} from "~/burwell-sources/app-state";
} from "~/_legacy/map-sources/app-state";
import h from "@macrostrat/hyper";

const capitalizeWord = (word) => {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/components/map-navbar/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LinkButton } from "~/map-interface/components/buttons";
import { LinkButton } from "~/pages/map/map-interface/components/buttons";
import { AnchorButton } from "@blueprintjs/core";
import { FloatingNavbar, MapLoadingButton } from "@macrostrat/map-interface";
import { useMapStatus } from "@macrostrat/mapbox-react";
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import "./styles/padding.css";
import { FocusStyleManager } from "@blueprintjs/core";

import h from "@macrostrat/hyper";
import { Page } from "./pages/map/map";
import { Page } from "./pages/map/map-interface";

FocusStyleManager.onlyShowFocusOnTabs();

Expand Down
1 change: 0 additions & 1 deletion src/map-interface/index.ts

This file was deleted.

8 changes: 4 additions & 4 deletions src/pages/about/index.page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import './code.css'
import "./code.css";

export { Page }
export { Page };

function Page() {
return (
<>
<h1>About</h1>
<p>
Example of using <code>vite-plugin-ssr</code>.
Example of using <code>vike</code>.
</p>
</>
)
);
}
2 changes: 1 addition & 1 deletion src/pages/column/@id.page.server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fetch from "node-fetch";
import { SETTINGS } from "~/map-interface/settings";
import { SETTINGS } from "~/settings";

const apiAddress = SETTINGS.apiDomain + "/api/v2/units";

Expand Down
Loading

0 comments on commit be8eb7d

Please sign in to comment.