main
Sam Hatfield 2022-07-05 23:19:35 -05:00
parent e5d1885af4
commit 1aa2c7c74e
11 changed files with 8 additions and 73 deletions

View File

@ -1,5 +1,3 @@
use nix
dotenv .env
dotenv ../.env

View File

@ -1,12 +0,0 @@
.PHONY: build
build: format
PUBLIC_URL=/ yarn build
.PHONY: format
format:
npx prettier --write .
.PHONY: clean
clean:
if [ -d "node_modules" ]; then rm -fr node_modules; fi
if [ -d "build" ]; then rm -fr build; fi

View File

@ -1,40 +0,0 @@
let
attrsToUrl = { scheme ? null, domain ? null, subdir ? "" }:
with builtins;
let
protocol = if isNull scheme then "" else "${scheme}://";
maybeLocalhost = if isNull domain then "" else domain;
in "${protocol}${maybeLocalhost}${subdir}";
in { pkgs ? import <nixpkgs> { }, webAttrs ? { }, apiAttrs ? { }, ... }:
pkgs.yarn2nix-moretea.mkYarnPackage {
pname = "pea-app";
version = "0.1.0";
src = ./.;
buildPhase = ''
export PUBLIC_URL=${attrsToUrl webAttrs}
export REACT_APP_API_URL=${attrsToUrl apiAttrs}
export REACT_APP_SUBDIR=${
if (webAttrs ? subdir) then webAttrs.subdir else "/"
}
yarn --offline run build
'';
installPhase = ''
cp -r deps/pea-app/build $out
'';
distPhase = "true";
pkgConfig = {
node-sass = {
buildInputs = with pkgs; [ python3 libsass pkg-config ];
postInstall = ''
LIBSASS_EXT=auto yarn --offline run build
rm build/config.gypi
'';
};
};
yarnPreBuild = with pkgs; ''
mkdir -p $HOME/.node-gyp/${nodejs.version}
echo 9 > $HOME/.node-gyp/${nodejs.version}/installVersion
ln -sfv ${nodejs}/include $HOME/.node-gyp/${nodejs.version}
export npm_config_nodedir=${nodejs}
'';
}

View File

@ -1,9 +0,0 @@
{ pkgs ? import <nixpkgs> { } }:
pkgs.mkShell {
buildInputs = with pkgs; [
gnumake
nodejs_latest
python
yarn
];
}

View File

@ -1,10 +1,10 @@
import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react";
const { REACT_APP_API_URL } = process.env;
const { PEA_APP_API_URL } = process.env;
export const apiSlice = createApi({
baseQuery: fetchBaseQuery({
baseUrl: REACT_APP_API_URL,
baseUrl: PEA_APP_API_URL,
prepareHeaders: (headers, { getState }) => {
const token = getState().auth.token;
if (token) {

View File

@ -3,7 +3,7 @@ import { Children, cloneElement } from "react";
const ClassyMixin = ({ children, className }) => {
const classes = className.split(" ");
return Children.map(children, (child) => {
if(!child.hasOwnProperty('props')) return child
if (!child.hasOwnProperty("props")) return child;
const oldClassName = child?.props?.className ?? "";
return cloneElement(child, {
className: [...classes, oldClassName].join(" "),

View File

@ -5,7 +5,6 @@ import {
} from "@reduxjs/toolkit";
import { apiSlice } from "../../data/apiSlice";
export const extendedApiSlice = apiSlice.injectEndpoints({
endpoints: (builder) => ({
// CRUD order

View File

@ -5,7 +5,6 @@ import {
} from "@reduxjs/toolkit";
import { apiSlice } from "../../data/apiSlice";
export const extendedApiSlice = apiSlice.injectEndpoints({
endpoints: (builder) => ({
createTask: builder.mutation({

View File

@ -57,6 +57,6 @@ export const selectCurrentUser = createSelector(
);
export const selectPreferences = createSelector(
(state) => state.user.preferences,
(preferences) => preferences
(state) => state.user.preferences,
(preferences) => preferences
);

View File

@ -8,12 +8,12 @@ import "./index.scss";
import App from "./App";
import reportWebVitals from "./reportWebVitals";
const { REACT_APP_SUBDIR } = process.env;
const { PEA_APP_SUBDIR } = process.env;
ReactDOM.render(
<React.StrictMode>
<Provider store={store}>
<BrowserRouter basename={REACT_APP_SUBDIR}>
<BrowserRouter basename={PEA_APP_SUBDIR}>
<App />
</BrowserRouter>{" "}
</Provider>{" "}

View File

@ -1,7 +1,7 @@
@font-face {
font-family: "Open Sans";
src: local("Open Sans"),
url(./fonts/Open_Sans/OpenSans-VariableFont_wdth,wght.ttf) format("truetype");
url(./fonts/Open_Sans/OpenSans-VariableFont_wdthwght.ttf) format("truetype");
}
@font-face {