Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement v2 GUI #19

Merged
merged 17 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ dmypy.json

# Pyre type checker
.pyre/


*.code-workspace
5 changes: 5 additions & 0 deletions web/gui-v2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.cache/
node_modules/
public/

*.code-workspace
2 changes: 2 additions & 0 deletions web/gui-v2/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@eto:registry=https://us-east1-npm.pkg.dev/gcp-cset-projects/eto-nodejs-repo/
//us-east1-npm.pkg.dev/gcp-cset-projects/eto-nodejs-repo/:always-auth=true
1 change: 1 addition & 0 deletions web/gui-v2/__mocks__/file-mock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = "test-file-stub"
27 changes: 27 additions & 0 deletions web/gui-v2/__mocks__/gatsby.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const React = require("react")
const gatsby = jest.requireActual("gatsby")

module.exports = {
...gatsby,
graphql: jest.fn(),
Link: jest.fn().mockImplementation(
// these props are invalid for an `a` tag
({
activeClassName,
activeStyle,
getProps,
innerRef,
partiallyActive,
ref,
replace,
to,
...rest
}) =>
React.createElement("a", {
...rest,
href: to,
})
),
StaticQuery: jest.fn(),
useStaticQuery: jest.fn(),
}
2 changes: 2 additions & 0 deletions web/gui-v2/gatsby-browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import "./src/styles/app.css";
import "./src/styles/accessibility.css";
33 changes: 33 additions & 0 deletions web/gui-v2/gatsby-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* @type {import('gatsby').GatsbyConfig}
*/
module.exports = {
siteMetadata: {
title: `PARAT v2`,
siteUrl: `https://parat.eto.tech`
},
plugins: [
"gatsby-plugin-emotion",
{
resolve: 'gatsby-plugin-google-gtag',
options: {
trackingIds: ['UA-148144643-1'],
},
},
"gatsby-plugin-mdx",
{
resolve: 'gatsby-plugin-plausible',
options: {
domain: 'parat.eto.tech',
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
"name": "pages",
"path": "./src/pages/"
},
__key: "pages"
},
],
};
14 changes: 14 additions & 0 deletions web/gui-v2/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const path = require('path');

exports.onCreatePage = async ({ page, actions }) => {
const { createPage } = actions;

if ( page.path.match(/^\/company/) ) {
createPage({
...page,
path: "/company",
matchPath: "/company/:slug",
component: path.resolve("src/pages/company-detail.js"),
});
}
};
3 changes: 3 additions & 0 deletions web/gui-v2/jest-loadershim.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
global.___loader = {
enqueue: jest.fn(),
}
5 changes: 5 additions & 0 deletions web/gui-v2/jest-preprocess.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const babelOptions = {
presets: ["babel-preset-gatsby", "@emotion/babel-preset-css-prop"],
};

module.exports = require("babel-jest").default.createTransformer(babelOptions);
1 change: 1 addition & 0 deletions web/gui-v2/jest-setup-test-env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@testing-library/jest-dom'
35 changes: 35 additions & 0 deletions web/gui-v2/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module.exports = {
transform: {
"^.+\\.jsx?$": `<rootDir>/jest-preprocess.js`,
},
moduleNameMapper: {
".+\\.(css|styl|less|sass|scss)$": `identity-obj-proxy`,
".+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": `<rootDir>/__mocks__/file-mock.js`,
"^@components(.*)$": "<rootDir>/src/components$1",
"^@content(.*)$": "<rootDir>/src/content$1",
},
testPathIgnorePatterns: [
`node_modules`,
`\\.cache`,
`<rootDir>.*/public`,
],
transformIgnorePatterns: [
`node_modules/(?!(gatsby|gatsby-plugin-mdx|@eto|@mui|d3.*|internmap|delaunator|robust-predicates)/)`,
],
globals: {
__PATH_PREFIX__: ``,
},
setupFiles: [
`<rootDir>/jest-loadershim.js`,
],
setupFilesAfterEnv: [
'<rootDir>/jest-setup-test-env.js',
],
testEnvironment: 'jsdom',
collectCoverage: true,
collectCoverageFrom: [
'src/**/*.{js,jsx}',
'!**/*.test.*',
'!**/__tests__/**',
],
}
Loading