diff --git a/.prettierrc.json b/.prettierrc.json
new file mode 100644
index 0000000..174506b
--- /dev/null
+++ b/.prettierrc.json
@@ -0,0 +1,6 @@
+{
+ "bracketSameLine": true,
+ "tabWidth": 4,
+ "semi": false,
+ "singleQuote": true
+}
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index f31a1e7..41d8c1c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -12,7 +12,9 @@
"preact": "^10.3.2",
"preact-cli-tailwind": "^3.0.0",
"preact-render-to-string": "^5.1.4",
- "preact-router": "^3.2.1"
+ "preact-router": "^3.2.1",
+ "prettier": "^2.5.1",
+ "prettier-plugin-tailwindcss": "^0.1.5"
},
"devDependencies": {
"enzyme": "^3.10.0",
@@ -16065,6 +16067,28 @@
"node": ">=4"
}
},
+ "node_modules/prettier": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz",
+ "integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==",
+ "bin": {
+ "prettier": "bin-prettier.js"
+ },
+ "engines": {
+ "node": ">=10.13.0"
+ }
+ },
+ "node_modules/prettier-plugin-tailwindcss": {
+ "version": "0.1.5",
+ "resolved": "https://registry.npmjs.org/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.1.5.tgz",
+ "integrity": "sha512-e+jTxwiHL4I3Ot8OjV1LAiiaAx0Zgy71xTL7xNmJtNmhpja7GKzFSAoulqBDS1D57B7lbZDCvDEKIWIQSBUmBQ==",
+ "engines": {
+ "node": ">=12.17.0"
+ },
+ "peerDependencies": {
+ "prettier": ">=2.2.0"
+ }
+ },
"node_modules/pretty-bytes": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-4.0.2.tgz",
@@ -34427,6 +34451,17 @@
"integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=",
"dev": true
},
+ "prettier": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz",
+ "integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg=="
+ },
+ "prettier-plugin-tailwindcss": {
+ "version": "0.1.5",
+ "resolved": "https://registry.npmjs.org/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.1.5.tgz",
+ "integrity": "sha512-e+jTxwiHL4I3Ot8OjV1LAiiaAx0Zgy71xTL7xNmJtNmhpja7GKzFSAoulqBDS1D57B7lbZDCvDEKIWIQSBUmBQ==",
+ "requires": {}
+ },
"pretty-bytes": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-4.0.2.tgz",
diff --git a/package.json b/package.json
index d141b40..cbd9e30 100644
--- a/package.json
+++ b/package.json
@@ -31,7 +31,9 @@
"preact": "^10.3.2",
"preact-cli-tailwind": "^3.0.0",
"preact-render-to-string": "^5.1.4",
- "preact-router": "^3.2.1"
+ "preact-router": "^3.2.1",
+ "prettier": "^2.5.1",
+ "prettier-plugin-tailwindcss": "^0.1.5"
},
"jest": {
"preset": "jest-preset-preact",
diff --git a/size-plugin.json b/size-plugin.json
index 813e2e6..a8f8c0e 100644
--- a/size-plugin.json
+++ b/size-plugin.json
@@ -1 +1 @@
-[{"timestamp":1642889032469,"files":[{"filename":"bundle.*****.esm.js","previous":10316,"size":11254,"diff":938},{"filename":"polyfills.*****.esm.js","previous":2191,"size":2191,"diff":0},{"filename":"route-Home.chunk.*****.esm.js","previous":5607,"size":5820,"diff":213},{"filename":"route-Plant.chunk.*****.esm.js","previous":6797,"size":6964,"diff":167},{"filename":"route-Profile.chunk.*****.esm.js","previous":953,"size":1512,"diff":559},{"filename":"sw-esm.js","previous":10768,"size":10772,"diff":4},{"filename":"sw.js","previous":10778,"size":10785,"diff":7},{"filename":"index.html","previous":1804,"size":1827,"diff":23},{"filename":"200.html","previous":907,"size":943,"diff":36},{"filename":"polyfills.0ba84.js","previous":2290,"size":2290,"diff":0},{"filename":"route-Home~route-Plant.chunk.7dea9.js","previous":5510,"size":0,"diff":-5510},{"filename":"bundle.9771c.css","previous":2897,"size":0,"diff":-2897},{"filename":"bundle.6998f.js","previous":10990,"size":0,"diff":-10990},{"filename":"route-Home.chunk.e5b2b.js","previous":1512,"size":0,"diff":-1512},{"filename":"route-Plant.chunk.f00ee.js","previous":3203,"size":0,"diff":-3203},{"filename":"route-Profile.chunk.68572.js","previous":1424,"size":0,"diff":-1424},{"filename":"bundle.48c06.css","previous":0,"size":3189,"diff":3189},{"filename":"route-Style.chunk.*****.esm.js","previous":0,"size":1212,"diff":1212},{"filename":"route-Home~route-Plant.chunk.96a33.js","previous":0,"size":5641,"diff":5641},{"filename":"bundle.423bb.js","previous":0,"size":11957,"diff":11957},{"filename":"route-Home.chunk.f74e9.js","previous":0,"size":1604,"diff":1604},{"filename":"route-Plant.chunk.3016e.js","previous":0,"size":3249,"diff":3249},{"filename":"route-Profile.chunk.4193f.js","previous":0,"size":2150,"diff":2150},{"filename":"route-Style.chunk.97e5a.js","previous":0,"size":1220,"diff":1220}]},{"timestamp":1642529294712,"files":[{"filename":"bundle.*****.esm.js","previous":10271,"size":10316,"diff":45},{"filename":"polyfills.*****.esm.js","previous":2191,"size":2191,"diff":0},{"filename":"route-Home.chunk.*****.esm.js","previous":5604,"size":5607,"diff":3},{"filename":"route-Plant.chunk.*****.esm.js","previous":6752,"size":6797,"diff":45},{"filename":"route-Profile.chunk.*****.esm.js","previous":922,"size":953,"diff":31},{"filename":"sw-esm.js","previous":10763,"size":10768,"diff":5},{"filename":"sw.js","previous":10769,"size":10778,"diff":9},{"filename":"index.html","previous":1749,"size":1804,"diff":55},{"filename":"200.html","previous":906,"size":907,"diff":1},{"filename":"polyfills.0ba84.js","previous":2290,"size":2290,"diff":0},{"filename":"route-Profile.chunk.3423a.js","previous":1394,"size":0,"diff":-1394},{"filename":"bundle.fdcd5.css","previous":2890,"size":0,"diff":-2890},{"filename":"route-Home~route-Plant.chunk.7dea9.js","previous":5510,"size":5510,"diff":0},{"filename":"bundle.af5c1.js","previous":10940,"size":0,"diff":-10940},{"filename":"route-Home.chunk.1a164.js","previous":1508,"size":0,"diff":-1508},{"filename":"route-Plant.chunk.d2bd9.js","previous":3152,"size":0,"diff":-3152},{"filename":"bundle.9771c.css","previous":0,"size":2897,"diff":2897},{"filename":"bundle.6998f.js","previous":0,"size":10990,"diff":10990},{"filename":"route-Home.chunk.e5b2b.js","previous":0,"size":1512,"diff":1512},{"filename":"route-Plant.chunk.f00ee.js","previous":0,"size":3203,"diff":3203},{"filename":"route-Profile.chunk.68572.js","previous":0,"size":1424,"diff":1424}]},{"timestamp":1642514633677,"files":[{"filename":"bundle.*****.esm.js","previous":10269,"size":10271,"diff":2},{"filename":"polyfills.*****.esm.js","previous":2191,"size":2191,"diff":0},{"filename":"route-Home.chunk.*****.esm.js","previous":5318,"size":5604,"diff":286},{"filename":"route-Plant.chunk.*****.esm.js","previous":6423,"size":6752,"diff":329},{"filename":"route-Profile.chunk.*****.esm.js","previous":922,"size":922,"diff":0},{"filename":"sw-esm.js","previous":10764,"size":10763,"diff":-1},{"filename":"sw.js","previous":10774,"size":10769,"diff":-5},{"filename":"index.html","previous":1750,"size":1749,"diff":-1},{"filename":"200.html","previous":907,"size":906,"diff":-1},{"filename":"bundle.6e91b.css","previous":2808,"size":0,"diff":-2808},{"filename":"route-Home~route-Plant.chunk.f4501.js","previous":5268,"size":0,"diff":-5268},{"filename":"bundle.bf6f7.js","previous":10941,"size":0,"diff":-10941},{"filename":"polyfills.0ba84.js","previous":2290,"size":2290,"diff":0},{"filename":"route-Home.chunk.04c91.js","previous":1432,"size":0,"diff":-1432},{"filename":"route-Plant.chunk.445a5.js","previous":3029,"size":0,"diff":-3029},{"filename":"route-Profile.chunk.3423a.js","previous":1394,"size":1394,"diff":0},{"filename":"bundle.fdcd5.css","previous":0,"size":2890,"diff":2890},{"filename":"route-Home~route-Plant.chunk.7dea9.js","previous":0,"size":5510,"diff":5510},{"filename":"bundle.af5c1.js","previous":0,"size":10940,"diff":10940},{"filename":"route-Home.chunk.1a164.js","previous":0,"size":1508,"diff":1508},{"filename":"route-Plant.chunk.d2bd9.js","previous":0,"size":3152,"diff":3152}]},{"timestamp":1642349922889,"files":[{"filename":"bundle.e3489.css","previous":2808,"size":0,"diff":-2808},{"filename":"bundle.*****.esm.js","previous":10272,"size":10269,"diff":-3},{"filename":"polyfills.*****.esm.js","previous":2191,"size":2191,"diff":0},{"filename":"route-Home.chunk.*****.esm.js","previous":5325,"size":5318,"diff":-7},{"filename":"route-Plant.chunk.*****.esm.js","previous":6411,"size":6423,"diff":12},{"filename":"route-Profile.chunk.*****.esm.js","previous":922,"size":922,"diff":0},{"filename":"sw-esm.js","previous":10767,"size":10764,"diff":-3},{"filename":"sw.js","previous":10760,"size":10774,"diff":14},{"filename":"bundle.e98ad.js","previous":10911,"size":0,"diff":-10911},{"filename":"polyfills.03377.js","previous":2291,"size":0,"diff":-2291},{"filename":"route-Home.chunk.58d66.js","previous":5871,"size":0,"diff":-5871},{"filename":"route-Plant.chunk.b4421.js","previous":7001,"size":0,"diff":-7001},{"filename":"route-Profile.chunk.5b010.js","previous":1393,"size":0,"diff":-1393},{"filename":"index.html","previous":1751,"size":1750,"diff":-1},{"filename":"200.html","previous":908,"size":907,"diff":-1},{"filename":"bundle.6e91b.css","previous":0,"size":2808,"diff":2808},{"filename":"route-Home~route-Plant.chunk.f4501.js","previous":0,"size":5268,"diff":5268},{"filename":"bundle.bf6f7.js","previous":0,"size":10941,"diff":10941},{"filename":"polyfills.0ba84.js","previous":0,"size":2290,"diff":2290},{"filename":"route-Home.chunk.04c91.js","previous":0,"size":1432,"diff":1432},{"filename":"route-Plant.chunk.445a5.js","previous":0,"size":3029,"diff":3029},{"filename":"route-Profile.chunk.3423a.js","previous":0,"size":1394,"diff":1394}]},{"timestamp":1642348996263,"files":[{"filename":"ssr-build/ssr-bundle.f564d.css","previous":5645,"size":0,"diff":-5645},{"filename":"ssr-build/ssr-bundle.js","previous":12645,"size":0,"diff":-12645},{"filename":"bundle.e3489.css","previous":0,"size":2808,"diff":2808},{"filename":"bundle.*****.esm.js","previous":0,"size":10272,"diff":10272},{"filename":"polyfills.*****.esm.js","previous":0,"size":2191,"diff":2191},{"filename":"route-Home.chunk.*****.esm.js","previous":0,"size":5325,"diff":5325},{"filename":"route-Plant.chunk.*****.esm.js","previous":0,"size":6411,"diff":6411},{"filename":"route-Profile.chunk.*****.esm.js","previous":0,"size":922,"diff":922},{"filename":"sw-esm.js","previous":0,"size":10767,"diff":10767},{"filename":"sw.js","previous":0,"size":10760,"diff":10760},{"filename":"bundle.e98ad.js","previous":0,"size":10911,"diff":10911},{"filename":"polyfills.03377.js","previous":0,"size":2291,"diff":2291},{"filename":"route-Home.chunk.58d66.js","previous":0,"size":5871,"diff":5871},{"filename":"route-Plant.chunk.b4421.js","previous":0,"size":7001,"diff":7001},{"filename":"route-Profile.chunk.5b010.js","previous":0,"size":1393,"diff":1393},{"filename":"index.html","previous":0,"size":1751,"diff":1751},{"filename":"200.html","previous":0,"size":908,"diff":908}]}]
+[{"timestamp":1642893838841,"files":[{"filename":"bundle.*****.esm.js","previous":11254,"size":11291,"diff":37},{"filename":"polyfills.*****.esm.js","previous":2191,"size":2191,"diff":0},{"filename":"route-Home.chunk.*****.esm.js","previous":5820,"size":5820,"diff":0},{"filename":"route-Plant.chunk.*****.esm.js","previous":6964,"size":7262,"diff":298},{"filename":"route-Profile.chunk.*****.esm.js","previous":1512,"size":1512,"diff":0},{"filename":"sw-esm.js","previous":10772,"size":10766,"diff":-6},{"filename":"sw.js","previous":10785,"size":10781,"diff":-4},{"filename":"index.html","previous":1827,"size":1917,"diff":90},{"filename":"200.html","previous":943,"size":1029,"diff":86},{"filename":"polyfills.0ba84.js","previous":2290,"size":2290,"diff":0},{"filename":"bundle.48c06.css","previous":3189,"size":0,"diff":-3189},{"filename":"route-Style.chunk.*****.esm.js","previous":1212,"size":1212,"diff":0},{"filename":"route-Home~route-Plant.chunk.96a33.js","previous":5641,"size":5641,"diff":0},{"filename":"bundle.423bb.js","previous":11957,"size":0,"diff":-11957},{"filename":"route-Home.chunk.f74e9.js","previous":1604,"size":1604,"diff":0},{"filename":"route-Plant.chunk.3016e.js","previous":3249,"size":0,"diff":-3249},{"filename":"route-Profile.chunk.4193f.js","previous":2150,"size":2150,"diff":0},{"filename":"route-Style.chunk.97e5a.js","previous":1220,"size":1220,"diff":0},{"filename":"bundle.c7c50.css","previous":0,"size":3312,"diff":3312},{"filename":"bundle.bb3d8.js","previous":0,"size":12008,"diff":12008},{"filename":"route-Plant.chunk.49893.js","previous":0,"size":3615,"diff":3615}]},{"timestamp":1642889032469,"files":[{"filename":"bundle.*****.esm.js","previous":10316,"size":11254,"diff":938},{"filename":"polyfills.*****.esm.js","previous":2191,"size":2191,"diff":0},{"filename":"route-Home.chunk.*****.esm.js","previous":5607,"size":5820,"diff":213},{"filename":"route-Plant.chunk.*****.esm.js","previous":6797,"size":6964,"diff":167},{"filename":"route-Profile.chunk.*****.esm.js","previous":953,"size":1512,"diff":559},{"filename":"sw-esm.js","previous":10768,"size":10772,"diff":4},{"filename":"sw.js","previous":10778,"size":10785,"diff":7},{"filename":"index.html","previous":1804,"size":1827,"diff":23},{"filename":"200.html","previous":907,"size":943,"diff":36},{"filename":"polyfills.0ba84.js","previous":2290,"size":2290,"diff":0},{"filename":"route-Home~route-Plant.chunk.7dea9.js","previous":5510,"size":0,"diff":-5510},{"filename":"bundle.9771c.css","previous":2897,"size":0,"diff":-2897},{"filename":"bundle.6998f.js","previous":10990,"size":0,"diff":-10990},{"filename":"route-Home.chunk.e5b2b.js","previous":1512,"size":0,"diff":-1512},{"filename":"route-Plant.chunk.f00ee.js","previous":3203,"size":0,"diff":-3203},{"filename":"route-Profile.chunk.68572.js","previous":1424,"size":0,"diff":-1424},{"filename":"bundle.48c06.css","previous":0,"size":3189,"diff":3189},{"filename":"route-Style.chunk.*****.esm.js","previous":0,"size":1212,"diff":1212},{"filename":"route-Home~route-Plant.chunk.96a33.js","previous":0,"size":5641,"diff":5641},{"filename":"bundle.423bb.js","previous":0,"size":11957,"diff":11957},{"filename":"route-Home.chunk.f74e9.js","previous":0,"size":1604,"diff":1604},{"filename":"route-Plant.chunk.3016e.js","previous":0,"size":3249,"diff":3249},{"filename":"route-Profile.chunk.4193f.js","previous":0,"size":2150,"diff":2150},{"filename":"route-Style.chunk.97e5a.js","previous":0,"size":1220,"diff":1220}]},{"timestamp":1642529294712,"files":[{"filename":"bundle.*****.esm.js","previous":10271,"size":10316,"diff":45},{"filename":"polyfills.*****.esm.js","previous":2191,"size":2191,"diff":0},{"filename":"route-Home.chunk.*****.esm.js","previous":5604,"size":5607,"diff":3},{"filename":"route-Plant.chunk.*****.esm.js","previous":6752,"size":6797,"diff":45},{"filename":"route-Profile.chunk.*****.esm.js","previous":922,"size":953,"diff":31},{"filename":"sw-esm.js","previous":10763,"size":10768,"diff":5},{"filename":"sw.js","previous":10769,"size":10778,"diff":9},{"filename":"index.html","previous":1749,"size":1804,"diff":55},{"filename":"200.html","previous":906,"size":907,"diff":1},{"filename":"polyfills.0ba84.js","previous":2290,"size":2290,"diff":0},{"filename":"route-Profile.chunk.3423a.js","previous":1394,"size":0,"diff":-1394},{"filename":"bundle.fdcd5.css","previous":2890,"size":0,"diff":-2890},{"filename":"route-Home~route-Plant.chunk.7dea9.js","previous":5510,"size":5510,"diff":0},{"filename":"bundle.af5c1.js","previous":10940,"size":0,"diff":-10940},{"filename":"route-Home.chunk.1a164.js","previous":1508,"size":0,"diff":-1508},{"filename":"route-Plant.chunk.d2bd9.js","previous":3152,"size":0,"diff":-3152},{"filename":"bundle.9771c.css","previous":0,"size":2897,"diff":2897},{"filename":"bundle.6998f.js","previous":0,"size":10990,"diff":10990},{"filename":"route-Home.chunk.e5b2b.js","previous":0,"size":1512,"diff":1512},{"filename":"route-Plant.chunk.f00ee.js","previous":0,"size":3203,"diff":3203},{"filename":"route-Profile.chunk.68572.js","previous":0,"size":1424,"diff":1424}]},{"timestamp":1642514633677,"files":[{"filename":"bundle.*****.esm.js","previous":10269,"size":10271,"diff":2},{"filename":"polyfills.*****.esm.js","previous":2191,"size":2191,"diff":0},{"filename":"route-Home.chunk.*****.esm.js","previous":5318,"size":5604,"diff":286},{"filename":"route-Plant.chunk.*****.esm.js","previous":6423,"size":6752,"diff":329},{"filename":"route-Profile.chunk.*****.esm.js","previous":922,"size":922,"diff":0},{"filename":"sw-esm.js","previous":10764,"size":10763,"diff":-1},{"filename":"sw.js","previous":10774,"size":10769,"diff":-5},{"filename":"index.html","previous":1750,"size":1749,"diff":-1},{"filename":"200.html","previous":907,"size":906,"diff":-1},{"filename":"bundle.6e91b.css","previous":2808,"size":0,"diff":-2808},{"filename":"route-Home~route-Plant.chunk.f4501.js","previous":5268,"size":0,"diff":-5268},{"filename":"bundle.bf6f7.js","previous":10941,"size":0,"diff":-10941},{"filename":"polyfills.0ba84.js","previous":2290,"size":2290,"diff":0},{"filename":"route-Home.chunk.04c91.js","previous":1432,"size":0,"diff":-1432},{"filename":"route-Plant.chunk.445a5.js","previous":3029,"size":0,"diff":-3029},{"filename":"route-Profile.chunk.3423a.js","previous":1394,"size":1394,"diff":0},{"filename":"bundle.fdcd5.css","previous":0,"size":2890,"diff":2890},{"filename":"route-Home~route-Plant.chunk.7dea9.js","previous":0,"size":5510,"diff":5510},{"filename":"bundle.af5c1.js","previous":0,"size":10940,"diff":10940},{"filename":"route-Home.chunk.1a164.js","previous":0,"size":1508,"diff":1508},{"filename":"route-Plant.chunk.d2bd9.js","previous":0,"size":3152,"diff":3152}]},{"timestamp":1642349922889,"files":[{"filename":"bundle.e3489.css","previous":2808,"size":0,"diff":-2808},{"filename":"bundle.*****.esm.js","previous":10272,"size":10269,"diff":-3},{"filename":"polyfills.*****.esm.js","previous":2191,"size":2191,"diff":0},{"filename":"route-Home.chunk.*****.esm.js","previous":5325,"size":5318,"diff":-7},{"filename":"route-Plant.chunk.*****.esm.js","previous":6411,"size":6423,"diff":12},{"filename":"route-Profile.chunk.*****.esm.js","previous":922,"size":922,"diff":0},{"filename":"sw-esm.js","previous":10767,"size":10764,"diff":-3},{"filename":"sw.js","previous":10760,"size":10774,"diff":14},{"filename":"bundle.e98ad.js","previous":10911,"size":0,"diff":-10911},{"filename":"polyfills.03377.js","previous":2291,"size":0,"diff":-2291},{"filename":"route-Home.chunk.58d66.js","previous":5871,"size":0,"diff":-5871},{"filename":"route-Plant.chunk.b4421.js","previous":7001,"size":0,"diff":-7001},{"filename":"route-Profile.chunk.5b010.js","previous":1393,"size":0,"diff":-1393},{"filename":"index.html","previous":1751,"size":1750,"diff":-1},{"filename":"200.html","previous":908,"size":907,"diff":-1},{"filename":"bundle.6e91b.css","previous":0,"size":2808,"diff":2808},{"filename":"route-Home~route-Plant.chunk.f4501.js","previous":0,"size":5268,"diff":5268},{"filename":"bundle.bf6f7.js","previous":0,"size":10941,"diff":10941},{"filename":"polyfills.0ba84.js","previous":0,"size":2290,"diff":2290},{"filename":"route-Home.chunk.04c91.js","previous":0,"size":1432,"diff":1432},{"filename":"route-Plant.chunk.445a5.js","previous":0,"size":3029,"diff":3029},{"filename":"route-Profile.chunk.3423a.js","previous":0,"size":1394,"diff":1394}]},{"timestamp":1642348996263,"files":[{"filename":"ssr-build/ssr-bundle.f564d.css","previous":5645,"size":0,"diff":-5645},{"filename":"ssr-build/ssr-bundle.js","previous":12645,"size":0,"diff":-12645},{"filename":"bundle.e3489.css","previous":0,"size":2808,"diff":2808},{"filename":"bundle.*****.esm.js","previous":0,"size":10272,"diff":10272},{"filename":"polyfills.*****.esm.js","previous":0,"size":2191,"diff":2191},{"filename":"route-Home.chunk.*****.esm.js","previous":0,"size":5325,"diff":5325},{"filename":"route-Plant.chunk.*****.esm.js","previous":0,"size":6411,"diff":6411},{"filename":"route-Profile.chunk.*****.esm.js","previous":0,"size":922,"diff":922},{"filename":"sw-esm.js","previous":0,"size":10767,"diff":10767},{"filename":"sw.js","previous":0,"size":10760,"diff":10760},{"filename":"bundle.e98ad.js","previous":0,"size":10911,"diff":10911},{"filename":"polyfills.03377.js","previous":0,"size":2291,"diff":2291},{"filename":"route-Home.chunk.58d66.js","previous":0,"size":5871,"diff":5871},{"filename":"route-Plant.chunk.b4421.js","previous":0,"size":7001,"diff":7001},{"filename":"route-Profile.chunk.5b010.js","previous":0,"size":1393,"diff":1393},{"filename":"index.html","previous":0,"size":1751,"diff":1751},{"filename":"200.html","previous":0,"size":908,"diff":908}]}]
diff --git a/src/Contexts.js b/src/Contexts.js
index d78ef27..219015f 100644
--- a/src/Contexts.js
+++ b/src/Contexts.js
@@ -1,23 +1,43 @@
-import { createContext } from "preact";
-import usePlants from "./hooks/PlantsHook";
-import { useLocalStorage } from "./hooks/LocalStorageHook"
-import useUser from "./hooks/UserHook";
-import {TranslateProvider} from "./components/Translation";
+import { createContext } from 'preact'
+import usePlants from './hooks/PlantsHook'
+import { useLocalStorage } from './hooks/LocalStorageHook'
+import useUser from './hooks/UserHook'
+import { TranslateProvider } from './components/Translation'
export const UserContext = createContext(null)
export const PlantsContext = createContext(null)
-export default function ContextsProviders({children}) {
-
+export default function ContextsProviders({ children }) {
const [data, setData] = useLocalStorage('data', {})
const [user, setUser] = useUser(data, setData)
- const {plants, addPlant, editPlant, removePlant, addAction, doneTask, history, archivedEntries} = usePlants(data, setData)
+ const {
+ plants,
+ addPlant,
+ editPlant,
+ removePlant,
+ addAction,
+ doneTask,
+ history,
+ archivedEntries,
+ } = usePlants(data, setData)
- return
-
-
- {children}
-
-
-
-}
\ No newline at end of file
+ return (
+
+
+
+ {children}
+
+
+
+ )
+}
diff --git a/src/components/App.js b/src/components/App.js
index 915705c..60b11c9 100644
--- a/src/components/App.js
+++ b/src/components/App.js
@@ -1,31 +1,30 @@
-import { h } from 'preact';
-import { Router } from 'preact-router';
-import ContextsProviders from '../Contexts';
-import Header from './Header';
-
+import { h } from 'preact'
+import { Router } from 'preact-router'
+import ContextsProviders from '../Contexts'
+import Header from './Header'
// Code-splitting is automated for `routes` directory
-import Home from '../routes/Home';
-import Plant from '../routes/Plant';
-import Profile from '../routes/Profile';
-import Style from "../routes/Style";
+import Home from '../routes/Home'
+import Plant from '../routes/Plant'
+import Profile from '../routes/Profile'
+import Style from '../routes/Style'
const App = () => {
+ return (
+
+ )
+}
- return (
-
-)}
-
-export default App;
+export default App
diff --git a/src/components/Button.js b/src/components/Button.js
index c9eb553..9cfbb47 100644
--- a/src/components/Button.js
+++ b/src/components/Button.js
@@ -1,19 +1,31 @@
-import { classNames } from "../utilities/classNames"
-
-export const Button = ({ children, className = "", type = "button", ...props }) => {
-
- return (
-
- )
+export const Button = ({
+ children,
+ className = '',
+ type = 'button',
+ ...props
+}) => {
+ return (
+
+ )
}
-export const SmallButton = ({ children, className = "", type = "button", ...props }) => {
-
- return (
-
- )
-}
\ No newline at end of file
+export const SmallButton = ({
+ children,
+ className = '',
+ type = 'button',
+ ...props
+}) => {
+ return (
+
+ )
+}
diff --git a/src/components/Form.js b/src/components/Form.js
index 60c5e63..b4a719b 100644
--- a/src/components/Form.js
+++ b/src/components/Form.js
@@ -1,8 +1,13 @@
-import {classNames} from "../utilities/classNames";
-import {Text} from "./Translation";
-
-export const InputField = ({children, name, value = "", type = "text", textSupport = "", ...props}) => {
+import { Text } from './Translation'
+export const InputField = ({
+ children,
+ name,
+ value = '',
+ type = 'text',
+ textSupport = '',
+ ...props
+}) => {
const id = props.id ?? name
const classStyle = props.className ?? ''
@@ -10,22 +15,31 @@ export const InputField = ({children, name, value = "", type = "text", textSuppo
delete props.className
}
- return
+ return (
+
+ )
}
-export const TextAreaField = ({children, name, ...props}) => {
-
+export const TextAreaField = ({ children, name, ...props }) => {
const id = props.id ?? name
const classStyle = props.className ?? ''
@@ -33,29 +47,54 @@ export const TextAreaField = ({children, name, ...props}) => {
delete props.className
}
- return
+ return (
+
+ )
}
-export const SelectField = ({children, name, options, className = '', ...props}) => {
-
+export const SelectField = ({
+ children,
+ name,
+ options,
+ className = '',
+ ...props
+}) => {
const id = props.id ?? name
- return
-}
\ No newline at end of file
+ return (
+
+ )
+}
diff --git a/src/components/Header.js b/src/components/Header.js
index 278ef71..3b3baa9 100644
--- a/src/components/Header.js
+++ b/src/components/Header.js
@@ -1,30 +1,33 @@
-import { Link } from "preact-router/match"
-import {Text} from "./Translation"
+import { Link } from 'preact-router/match'
+import { Text } from './Translation'
const Header = () => {
- return (
-
- )
+ return (
+
+ )
}
export default Header
const NavLink = ({ path, children }) => {
- return (
-
- {children}
-
- )
+ return (
+
+ {children}
+
+ )
}
diff --git a/src/components/Modals.js b/src/components/Modals.js
index de2f2c2..9f15a34 100644
--- a/src/components/Modals.js
+++ b/src/components/Modals.js
@@ -1,33 +1,52 @@
-import {Text} from "./Translation";
+import { Text } from './Translation'
-export const Modal = ({children, isOpen, customClose = false, ...props}) => {
+export const Modal = ({ children, isOpen, customClose = false, ...props }) => {
+ const handleClose = (e) => props.onChange(e)
- const handleClose = e => props.onChange(e)
-
- return <>
- {isOpen &&
-
-
-
-
- {children}
+ return (
+ <>
+ {isOpen && (
+
+
+
+
{children}
+ {!customClose && (
+
+
+
+ )}
- {!customClose &&
-
-
}
-
- }
+ )}
>
+ )
}
-export const ModalTitle = ({children, ...props}) => {
- return
{children}
+export const ModalTitle = ({ children, ...props }) => {
+ return (
+
+ {children}
+
+ )
}
export const closeModal = (e, setter) => {
- if (e.target.classList.contains("overlay") || e.target.classList.contains("close-button")) {
+ if (
+ e.target.classList.contains('overlay') ||
+ e.target.classList.contains('close-button')
+ ) {
setter(false)
}
-}
\ No newline at end of file
+}
diff --git a/src/components/PageLayout.js b/src/components/PageLayout.js
index 891f73b..3a651b1 100644
--- a/src/components/PageLayout.js
+++ b/src/components/PageLayout.js
@@ -1,9 +1,3 @@
-import { classNames } from "../utilities/classNames";
-
-
-export const PageLayout = ({children, ...props}) => {
-
- return
- {children}
-
-}
\ No newline at end of file
+export const PageLayout = ({ children, ...props }) => {
+ return
{children}
+}
diff --git a/src/components/Plants.js b/src/components/Plants.js
index c7e19e8..c199189 100644
--- a/src/components/Plants.js
+++ b/src/components/Plants.js
@@ -1,81 +1,108 @@
-import { Link } from "preact-router/match"
-import {getPicture} from "../utilities/pictures"
-import {InputField, TextAreaField} from "./Form"
-import {Button} from "./Button"
-import {useState} from "preact/hooks"
-import {Text} from "./Translation"
+import { Link } from "preact-router/match";
+import { getPicture } from "../utilities/pictures";
+import { InputField, TextAreaField } from "./Form";
+import { Button } from "./Button";
+import { useState } from "preact/hooks";
+import { Text } from "./Translation";
export const PlantThumb = ({ plant, children }) => {
-
- return
-
-
})
-
- {children}
-
-
- {plant.actions.length}
-
-
+ return (
+
+
+
})
+
+ {children}
+
+
+ {plant.actions.length}
+
+
-}
+ );
+};
-export const PlantForm = ({children, plant, ...props}) => {
+export const PlantForm = ({ children, plant, ...props }) => {
+ const [plantForm, setPlantForm] = useState(plant);
- const [plantForm, setPlantForm] = useState(plant)
+ return (
+
-}
\ No newline at end of file
+ );
+};
diff --git a/src/components/SVG.js b/src/components/SVG.js
index 7bc75b1..901769e 100644
--- a/src/components/SVG.js
+++ b/src/components/SVG.js
@@ -1,29 +1,40 @@
-
-const SVGSkeleton = ({paths, viewBox = "0 0 512 512", ...props}) => {
- return
+const SVGSkeleton = ({ paths, viewBox = '0 0 512 512', ...props }) => {
+ return (
+
+ )
}
-export const PlusSVG = (props) => SVGSkeleton({
- viewBox: "0 0 448 512",
- paths:
,
- ...props
-})
+export const PlusSVG = (props) =>
+ SVGSkeleton({
+ viewBox: '0 0 448 512',
+ paths: (
+
+ ),
+ ...props,
+ })
-export const EditSVG = (props) => SVGSkeleton({
- viewBox: "0 0 576 512",
- paths:
,
- ...props
-})
+export const EditSVG = (props) =>
+ SVGSkeleton({
+ viewBox: '0 0 576 512',
+ paths: (
+
+ ),
+ ...props,
+ })
-export const TriangleSVG = (props) => SVGSkeleton({
- viewBox: "0 0 320 512",
- paths:
,
- ...props
-})
\ No newline at end of file
+export const TriangleSVG = (props) =>
+ SVGSkeleton({
+ viewBox: '0 0 320 512',
+ paths: (
+
+ ),
+ ...props,
+ })
diff --git a/src/components/Tasks.js b/src/components/Tasks.js
index afbfb0d..4781a76 100644
--- a/src/components/Tasks.js
+++ b/src/components/Tasks.js
@@ -1,21 +1,23 @@
-import {Button} from "./Button"
-import { Link } from "preact-router/match"
-import {useContext} from "preact/hooks"
-import {PlantsContext} from "../Contexts"
-import {Text} from "./Translation"
+import { Button } from './Button'
+import { Link } from 'preact-router/match'
+import { useContext } from 'preact/hooks'
+import { PlantsContext } from '../Contexts'
+import { Text } from './Translation'
export const Tasks = () => {
-
const { plants, doneTask, history } = useContext(PlantsContext)
const taskIsRequired = (action) => {
- if (Number(action.frequency) === 0) {
+ if (Number(action.frequency) === 0) {
return false
}
if (history()[action.id]) {
let lastTask = new Date(history()[action.id])
- return lastTask.addDays(Number(action.frequency)).toSQLDate() < (new Date()).toSQLDate()
+ return (
+ lastTask.addDays(Number(action.frequency)).toSQLDate() <
+ new Date().toSQLDate()
+ )
}
return true
}
@@ -24,31 +26,60 @@ export const Tasks = () => {
if (history()[action.id]) {
let lastTask = new Date(history()[action.id])
const oneDay = 1000 * 60 * 60 * 24
- return Math.round(((new Date()) - lastTask)/oneDay)
+ return Math.round((new Date() - lastTask) / oneDay)
}
return 0
}
- return
-
-
-
-
- {plants.map(plant => plant.actions.filter(action => taskIsRequired(action)).map(action =>
-
-
-
-
- {plant.name}
-
-
- {Number(action.frequency) === 0
- ?
- : (taskDelay(action) > 1 ?
- : )}
-
))}
+ return (
+
+
+
+
+
+ {plants.map((plant) =>
+ plant.actions
+ .filter((action) => taskIsRequired(action))
+ .map((action) => (
+
+
+
+
+
+
+ {plant.name}
+
+
+
+ {Number(action.frequency) === 0 ? (
+
+
+
+ ) : taskDelay(action) > 1 ? (
+
+
+
+ ) : (
+
+
+
+ )}
+
+ ))
+ )}
+
-
-}
\ No newline at end of file
+ )
+}
diff --git a/src/components/Translation.js b/src/components/Translation.js
index 2783911..929cf0a 100644
--- a/src/components/Translation.js
+++ b/src/components/Translation.js
@@ -1,12 +1,11 @@
-import {en} from "../lang/en"
-import {fr} from "../lang/fr"
-import {useContext, useEffect, useState} from "preact/hooks"
-import {createContext} from "preact"
+import en from '../lang/en.json'
+import fr from '../lang/fr.json'
+import { useContext, useEffect, useState } from 'preact/hooks'
+import { createContext } from 'preact'
export const TranslateContext = createContext(null)
-export const Text = ({text, count = null}) => {
-
+export const Text = ({ text, count = null }) => {
const lang = useContext(TranslateContext)
const [translate, setTranslate] = useState()
@@ -27,23 +26,23 @@ export const Text = ({text, count = null}) => {
setTranslate(text)
}, [])
- return <>{ translate }>
+ return <>{translate}>
}
-export const TranslateProvider = ({children}) => {
-
+export const TranslateProvider = ({ children }) => {
let translate = null
- if (typeof navigator !== "undefined") {
+ if (typeof navigator !== 'undefined') {
const userLang = navigator.language || navigator.userLanguage
- if (userLang === "en") {
+ if (userLang === 'en') {
translate = en
- } else if (userLang === "fr") {
+ } else if (userLang === 'fr') {
translate = fr
}
}
- return
- { children }
-
-
-}
\ No newline at end of file
+ return (
+
+ {children}
+
+ )
+}
diff --git a/src/hooks/LocalStorageHook.js b/src/hooks/LocalStorageHook.js
index 38d546e..1470947 100644
--- a/src/hooks/LocalStorageHook.js
+++ b/src/hooks/LocalStorageHook.js
@@ -1,4 +1,4 @@
-import { useState } from "preact/hooks"
+import { useState } from 'preact/hooks'
export const useLocalStorage = (key, initialValue) => {
const [storedValue, setStoredValue] = useState(() => {
diff --git a/src/hooks/PlantsHook.js b/src/hooks/PlantsHook.js
index 5916e45..0a0e661 100644
--- a/src/hooks/PlantsHook.js
+++ b/src/hooks/PlantsHook.js
@@ -1,46 +1,57 @@
-import { useEffect, useState } from "preact/hooks"
-import {route} from "preact-router";
-import {actionId} from "../utilities/actions";
+import { useEffect, useState } from 'preact/hooks'
+import { route } from 'preact-router'
+import { actionId } from '../utilities/actions'
const usePlants = (data, setData) => {
const [plants, setPlants] = useState([])
- useEffect(() =>{
+ useEffect(() => {
setPlants(data.plants ?? [])
}, [])
const addPlant = (plantForm) => {
let plant = plantForm
- let maxId = Math.max.apply(Math, plants.map(function(elem) { return elem.id; }))
+ let maxId = Math.max.apply(
+ Math,
+ plants.map(function (elem) {
+ return elem.id
+ })
+ )
plant.id = maxId === -Infinity ? 1 : maxId + 1
plant.actions = []
setPlants([...plants, plant])
- setData({...data, plants: [...plants, plant]})
+ setData({ ...data, plants: [...plants, plant] })
}
const editPlant = (plant) => {
- let plantIndex = plants.findIndex(item => item.id === plant.id)
+ let plantIndex = plants.findIndex((item) => item.id === plant.id)
plants[plantIndex] = plant
savePlants(plants)
}
const removePlant = (plant) => {
- plants.splice(plants.findIndex(item => item.id === plant.id), 1)
+ plants.splice(
+ plants.findIndex((item) => item.id === plant.id),
+ 1
+ )
savePlants(plants)
route('/', true)
}
const addAction = (plant, action) => {
action.id = action.action_type + '-' + plant.id
- let actionIndex = plant.actions.findIndex(item => item.action_type === action.action_type)
- actionIndex >= 0 ? plant.actions[actionIndex] = action
+ let actionIndex = plant.actions.findIndex(
+ (item) => item.action_type === action.action_type
+ )
+ actionIndex >= 0
+ ? (plant.actions[actionIndex] = action)
: plant.actions.push(action)
editPlant(plant)
}
const savePlants = (plants) => {
setPlants(plants)
- setData({...data, plants: plants})
+ setData({ ...data, plants: plants })
}
const doneTask = (action) => {
@@ -51,10 +62,10 @@ const usePlants = (data, setData) => {
archived.push({
plantId: Number(action.split('-')[1]),
action: actionId(action.split('-')[0]),
- time: (new Date()).toSQLDate()
+ time: new Date().toSQLDate(),
})
- setData({...data, history: history, archived: archived})
+ setData({ ...data, history: history, archived: archived })
}
const history = () => data.history ?? {}
@@ -64,7 +75,16 @@ const usePlants = (data, setData) => {
return archived.where('plantId', plantId)
}
- return {plants, addPlant, editPlant, removePlant, addAction, doneTask, history, archivedEntries}
+ return {
+ plants,
+ addPlant,
+ editPlant,
+ removePlant,
+ addAction,
+ doneTask,
+ history,
+ archivedEntries,
+ }
}
-export default usePlants
\ No newline at end of file
+export default usePlants
diff --git a/src/hooks/UserHook.js b/src/hooks/UserHook.js
index 71ef54b..85d1d6a 100644
--- a/src/hooks/UserHook.js
+++ b/src/hooks/UserHook.js
@@ -1,16 +1,16 @@
-import { useEffect, useState } from "preact/hooks"
-
+import { useEffect, useState } from 'preact/hooks'
const useUser = (data, setData) => {
- const [user, setUser] = useState(data.user ?? {name: "me", dark_mode: false})
+ const [user, setUser] = useState(
+ data.user ?? { name: 'me', dark_mode: false }
+ )
- useEffect(() =>{
- setData({...data, user: user})
+ useEffect(() => {
+ setData({ ...data, user: user })
document.querySelector('html').classList.toggle('dark', user.dark_mode)
}, [user])
-
return [user, setUser]
}
-export default useUser
\ No newline at end of file
+export default useUser
diff --git a/src/index.js b/src/index.js
index 2702f7d..1e5fcab 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,23 +1,25 @@
-import App from './components/App';
-import './style';
+import App from './components/App'
+import './style'
-Number.prototype.pad = function(n) {
+Number.prototype.pad = function (n) {
return (new Array(n).join('0') + this).slice(-n)
}
Date.prototype.addDays = function (days) {
- let date = new Date(this.valueOf());
- date.setDate(date.getDate() + days);
- return date;
+ let date = new Date(this.valueOf())
+ date.setDate(date.getDate() + days)
+ return date
}
-Date.prototype.toFrDate = function() {
- let month = ((this.getMonth() + 1 < 10) ? '0' : '') + (this.getMonth() + 1)
+Date.prototype.toFrDate = function () {
+ let month = (this.getMonth() + 1 < 10 ? '0' : '') + (this.getMonth() + 1)
return `${this.getDate()}/${month}/${this.getFullYear()}`
}
-Date.prototype.toSQLDate = function() {
- return `${this.getFullYear()}-${Number(this.getMonth() + 1).pad(2)}-${Number(this.getDate()).pad(2)}`
+Date.prototype.toSQLDate = function () {
+ return `${this.getFullYear()}-${Number(this.getMonth() + 1).pad(
+ 2
+ )}-${Number(this.getDate()).pad(2)}`
}
/**
@@ -26,8 +28,8 @@ Date.prototype.toSQLDate = function() {
* @param {string} search to filter by
* @returns {*[]}
*/
-Array.prototype.where = function(field, search) {
- return this.filter(item => item[field] === search)
+Array.prototype.where = function (field, search) {
+ return this.filter((item) => item[field] === search)
}
/**
@@ -42,4 +44,4 @@ Array.prototype.sortObjectsBy = function (field, desc = false) {
: this.sort((a, b) => a[field] > b[field])
}
-export default App;
+export default App
diff --git a/src/lang/en.js b/src/lang/en.js
deleted file mode 100644
index dfa9956..0000000
--- a/src/lang/en.js
+++ /dev/null
@@ -1,10 +0,0 @@
-
-export const en = {
- "Add": "+",
- "Add Plant": "Add Plant",
- "Done": "Done",
- "Tasks": "Tasks",
- "watering": "watering",
- "when you want": "when you want",
- "since {{count}} day": {one: "since {{count}} day", many: "since {{count}} days"}
-}
\ No newline at end of file
diff --git a/src/lang/en.json b/src/lang/en.json
new file mode 100644
index 0000000..a871937
--- /dev/null
+++ b/src/lang/en.json
@@ -0,0 +1,12 @@
+{
+ "Add": "+",
+ "Add Plant": "Add Plant",
+ "Done": "Done",
+ "Tasks": "Tasks",
+ "watering": "watering",
+ "when you want": "when you want",
+ "since {{count}} day": {
+ "one": "since {{count}} day",
+ "many": "since {{count}} days"
+ }
+}
\ No newline at end of file
diff --git a/src/lang/fr.js b/src/lang/fr.js
deleted file mode 100644
index 5ea3e93..0000000
--- a/src/lang/fr.js
+++ /dev/null
@@ -1,39 +0,0 @@
-
-export const fr = {
- "Add": "Ajouter",
- "Add Action": "Ajouter une action",
- "Add Plant": "Ajouter une plante",
- "A number of days between 2 actions. You can use 0 to set no notification.": "Un nombre de jours entre deux actions. Vous pouvez utilisé le 0 pour ne pas avoir de notification.",
- "bathing": "baigner",
- "Close": "Fermer",
- "Confirm delete plant": "Confirmer la suppression de la plante",
- "Description": "Description",
- "Dark Mode": "Mode sombre",
- "Delete": "Supprimer",
- "Delete Plant ?": "Supprimer la plante ?",
- "Done": "Fait",
- "Download": "Télécharger",
- "Download config": "Télécharger votre vos données",
- "Edit": "Editer",
- "Edit Plant": "Editer la plante",
- "every {{count}} days": {one: "tous les jours", many: "tous les {{count}} jours"},
- "Frequency": "Fréquence",
- "Indoor": "Intérieur",
- "last task": "dernière fois",
- "Me": "Moi",
- "Name": "Nom",
- "never": "jamais",
- "Outdoor": "Extérieur",
- "Plantes": "Plantes",
- "Plants": "Plantes",
- "{{count}} Plants": "{{count}} Plantes",
- "Profile": "Profile",
- "Spot": "Emplacement",
- "Spot:": "Emplacement : ",
- "spraying": "asperger",
- "Style": "Style",
- "Tasks": "Tâches",
- "watering": "arrossage",
- "when you want": "quand je veux",
- "since {{count}} days": {one: "depuis {{count}} jour", many: "depuis {{count}} jours"}
-}
\ No newline at end of file
diff --git a/src/lang/fr.json b/src/lang/fr.json
new file mode 100644
index 0000000..e084bc0
--- /dev/null
+++ b/src/lang/fr.json
@@ -0,0 +1,45 @@
+{
+ "Add": "Ajouter",
+ "Add Action": "Ajouter une action",
+ "Add Plant": "Ajouter une plante",
+ "A number of days between 2 actions. You can use 0 to set no notification.":
+ "Un nombre de jours entre deux actions. Vous pouvez utilisé le 0 pour ne pas avoir de notification.",
+ "bathing": "baigner",
+ "Close": "Fermer",
+ "Confirm delete plant": "Confirmer la suppression de la plante",
+ "Description": "Description",
+ "Dark Mode": "Mode sombre",
+ "Delete": "Supprimer",
+ "Delete Plant ?": "Supprimer la plante ?",
+ "Done": "Fait",
+ "Download": "Télécharger",
+ "Download config": "Télécharger votre vos données",
+ "Edit": "Editer",
+ "Edit Plant": "Editer la plante",
+ "every {{count}} days": {
+ "one": "tous les jours",
+ "many": "tous les {{count}} jours"
+ },
+ "Frequency": "Fréquence",
+ "Indoor": "Intérieur",
+ "last task": "dernière fois",
+ "Me": "Moi",
+ "Name": "Nom",
+ "never": "jamais",
+ "Outdoor": "Extérieur",
+ "Plantes": "Plantes",
+ "Plants": "Plantes",
+ "{{count}} Plants": "{{count}} Plantes",
+ "Profile": "Profile",
+ "Spot": "Emplacement",
+ "Spot:": "Emplacement : ",
+ "spraying": "asperger",
+ "Style": "Style",
+ "Tasks": "Tâches",
+ "watering": "arrosage",
+ "when you want": "quand je veux",
+ "since {{count}} days": {
+ "one": "depuis {{count}} jour",
+ "many": "depuis {{count}} jours"
+ }
+}
\ No newline at end of file
diff --git a/src/routes/Home.js b/src/routes/Home.js
index a7d9534..40b14ff 100644
--- a/src/routes/Home.js
+++ b/src/routes/Home.js
@@ -1,52 +1,59 @@
-import { createPortal } from "preact/compat"
-import { useContext, useState } from "preact/hooks"
-import {closeModal, Modal, ModalTitle} from "../components/Modals"
-import { PageLayout } from "../components/PageLayout"
-import {PlantForm, PlantThumb} from "../components/Plants"
-import { PlantsContext } from "../Contexts"
-import {Tasks} from "../components/Tasks"
-import {Text} from "../components/Translation";
+import { createPortal } from 'preact/compat'
+import { useContext, useState } from 'preact/hooks'
+import { closeModal, Modal, ModalTitle } from '../components/Modals'
+import { PageLayout } from '../components/PageLayout'
+import { PlantForm, PlantThumb } from '../components/Plants'
+import { PlantsContext } from '../Contexts'
+import { Tasks } from '../components/Tasks'
+import { Text } from '../components/Translation'
export const Home = () => {
- const [addModal, setAddModal] = useState(false)
- const { plants, addPlant } = useContext(PlantsContext)
+ const [addModal, setAddModal] = useState(false)
+ const { plants, addPlant } = useContext(PlantsContext)
- const handleSubmit = (e, plantForm) => {
- e.preventDefault()
- e.stopPropagation()
- addPlant(plantForm)
- setAddModal(false)
- }
+ const handleSubmit = (e, plantForm) => {
+ e.preventDefault()
+ e.stopPropagation()
+ addPlant(plantForm)
+ setAddModal(false)
+ }
- return (
-
+ return (
+
+
-
+
+
+
+
+ {plants.map((plant) => (
+
{plant.name}
+ ))}
+
+
+
setAddModal(true)}
+ className="flex h-16 w-16 cursor-pointer items-center justify-center rounded-full bg-primary text-white shadow hover:bg-primary-dark">
+
+
+
-
-
- {plants.map((plant) => (
-
{plant.name}
- ))}
-
-
-
setAddModal(true)}
- className="rounded-full shadow w-16 h-16 flex items-center justify-center cursor-pointer bg-primary hover:bg-primary-dark text-white">
-
-
-
-
- {typeof window !== "undefined" && createPortal(
- closeModal(e, setAddModal)}>
-
-
-
-
- ,
- document.getElementById('app')
- )}
-
- )
+ {typeof window !== 'undefined' &&
+ createPortal(
+ closeModal(e, setAddModal)}>
+
+
+
+
+
+
+ ,
+ document.getElementById('app')
+ )}
+
+ )
}
export default Home
diff --git a/src/routes/Plant.js b/src/routes/Plant.js
index 7ca93e6..176063b 100644
--- a/src/routes/Plant.js
+++ b/src/routes/Plant.js
@@ -1,32 +1,38 @@
-import {createPortal, useRef} from "preact/compat"
-import { useContext, useEffect, useState } from "preact/hooks"
-import {Button, SmallButton} from "../components/Button"
-import {closeModal, Modal, ModalTitle} from "../components/Modals"
-import { PageLayout } from "../components/PageLayout"
-import { PlantsContext } from "../Contexts"
-import {InputField, SelectField} from "../components/Form"
-import {getPicture, storePicture} from "../utilities/pictures"
-import {EditSVG, PlusSVG, TriangleSVG} from "../components/SVG"
-import {classNames} from "../utilities/classNames"
-import {PlantForm} from "../components/Plants"
-import {ACTION_TYPES, actionId} from "../utilities/actions"
-import {Text} from "../components/Translation"
-
-const Plant = ({id}) => {
+import { createPortal, useRef } from 'preact/compat'
+import { useContext, useEffect, useState } from 'preact/hooks'
+import { Button, SmallButton } from '../components/Button'
+import { closeModal, Modal, ModalTitle } from '../components/Modals'
+import { PageLayout } from '../components/PageLayout'
+import { PlantsContext } from '../Contexts'
+import { InputField, SelectField } from '../components/Form'
+import { getPicture, storePicture } from '../utilities/pictures'
+import { EditSVG, PlusSVG, TriangleSVG } from '../components/SVG'
+import { PlantForm } from '../components/Plants'
+import { ACTION_TYPES, actionId } from '../utilities/actions'
+import { Text } from '../components/Translation'
+const Plant = ({ id }) => {
const [addModal, setAddModal] = useState(false)
const [editModal, setEditModal] = useState(false)
const [deleteModal, setDeleteModal] = useState(false)
- const {plants, editPlant, removePlant, addAction, doneTask, history, archivedEntries} = useContext(PlantsContext)
+ const {
+ plants,
+ editPlant,
+ removePlant,
+ addAction,
+ doneTask,
+ history,
+ archivedEntries,
+ } = useContext(PlantsContext)
const [plant, setPlant] = useState({})
const archived = archivedEntries(Number(id))
const [actionForm, setActionForm] = useState({})
- const [image, setImage] = useState(localStorage.getItem("image" + id) ?? '')
+ const [image, setImage] = useState(localStorage.getItem('image' + id) ?? '')
const pictureName = 'picture-' + id
const picture = useRef(null)
useEffect(() => {
- const plantFind = plants.find(plant => plant.id === Number(id))
+ const plantFind = plants.find((plant) => plant.id === Number(id))
setPlant(plantFind)
}, [])
@@ -42,144 +48,254 @@ const Plant = ({id}) => {
}
addAction(plant, actionForm)
setAddModal(false)
- }
+ }
- const handleEditSubmit = (e, plantForm) => {
- e.preventDefault()
- e.stopPropagation()
- editPlant(plantForm)
- setEditModal(false)
- setPlant(plantForm)
- }
+ const handleEditSubmit = (e, plantForm) => {
+ e.preventDefault()
+ e.stopPropagation()
+ editPlant(plantForm)
+ setEditModal(false)
+ setPlant(plantForm)
+ }
const handleDeletePlant = () => removePlant(plant)
const handleOpenEditModal = () => setEditModal(true)
- const addPicture = e => storePicture(e, id)
+ const addPicture = (e) => storePicture(e, id)
- return
-
-
{ plant.name }
-
-
-
-
-
-
-
-
})
-
-
-
-
-
- {plant.description &&
{ plant.description }
}
- {plant.hasOwnProperty('indoor') &&
}
- {plant.spot &&
{ plant.spot }
}
-
-
-
-
-
-
setAddModal(true)}>
-
-
-
- {plant.actions && plant.actions.map(action => {
- let isDone = false
- let lastTask = false
- if (history()[action.id]) {
- lastTask = new Date(history()[action.id])
- isDone = lastTask.addDays(Number(action.frequency)).toSQLDate() >= (new Date()).toSQLDate()
- }
- return
-
-
-
-
- {Number(action.frequency) === 0
- ?
- :
}
-
{lastTask ? lastTask.toFrDate() : }
-
+ return (
+
+
+
{plant.name}
+
+
+
- })}
-
+
+
+
+
})
+
+
+
+
+
+ {plant.description &&
{plant.description}
}
+ {plant.hasOwnProperty('indoor') && (
+
+
+
+ )}
+ {plant.spot && (
+
+ {' '}
+ {plant.spot}
+
+ )}
+
+
+
+
+
+
+
+
setAddModal(true)}>
+
+
+
+ {plant.actions &&
+ plant.actions.map((action) => {
+ let isDone = false
+ let lastTask = false
+ if (history()[action.id]) {
+ lastTask = new Date(history()[action.id])
+ isDone =
+ lastTask
+ .addDays(Number(action.frequency))
+ .toSQLDate() >= new Date().toSQLDate()
+ }
+ return (
+
+
+
+
+
+
+
+ {Number(action.frequency) === 0 ? (
+
+
+
+ ) : (
+
+
+
+ )}
+
+ {' '}
+ {lastTask ? (
+ lastTask.toFrDate()
+ ) : (
+
+ )}
+
+
+
+ )
+ })}
+
- {createPortal(
-
closeModal(e, setAddModal)}>
-
-
- ,
- app
- )}
-
- {createPortal(
-
closeModal(e, setEditModal)}>
-
-
-
-
- ,
- app
- )}
-
- {createPortal(
-
closeModal(e, setDeleteModal)}>
-
-
-
-
- ,
- app
- )}
-
+ {createPortal(
+
closeModal(e, setDeleteModal)}>
+
+
+
+
+ ,
+ app
+ )}
+
+ )
}
export default Plant
-const ArchivedAction = ({archived = []}) => {
+const ArchivedAction = ({ archived = [] }) => {
console.log(archived)
const [isOpen, setIsOpen] = useState(false)
- return <>
- {archived.length > 0 &&
setIsOpen(!isOpen)}>
- { archived.length }
- {archived.length > 0 && isOpen &&
- {archived.sortObjectsBy('time', true).map(archive => - {(new Date(archive.time)).toFrDate()}
)}
-
}
- }
- >
-}
\ No newline at end of file
+ return (
+ <>
+ {archived.length > 0 && (
+
setIsOpen(!isOpen)}>
+ {archived.length}{' '}
+
+ {archived.length > 0 && isOpen && (
+
+ {archived
+ .sortObjectsBy('time', true)
+ .map((archive) => (
+ - {new Date(archive.time).toFrDate()}
+ ))}
+
+ )}
+
+ )}
+ >
+ )
+}
diff --git a/src/routes/Profile.js b/src/routes/Profile.js
index 0619d0e..cc05717 100644
--- a/src/routes/Profile.js
+++ b/src/routes/Profile.js
@@ -1,13 +1,13 @@
-import { useContext, useEffect, useState } from "preact/hooks";
-import { PageLayout } from "../components/PageLayout";
-import {PlantsContext, UserContext} from "../Contexts";
-import {Button} from "../components/Button";
-import {useLocalStorage} from "../hooks/LocalStorageHook";
-import {Text} from "../components/Translation";
+import { useContext, useEffect, useState } from 'preact/hooks'
+import { PageLayout } from '../components/PageLayout'
+import { PlantsContext, UserContext } from '../Contexts'
+import { Button } from '../components/Button'
+import { useLocalStorage } from '../hooks/LocalStorageHook'
+import { Text } from '../components/Translation'
export default function Profile() {
const [user, setUser] = useContext(UserContext)
- const {plants} = useContext(PlantsContext)
+ const { plants } = useContext(PlantsContext)
const [darkMode, setDarkMode] = useState(false)
const [data, setData] = useLocalStorage('data', {})
@@ -16,46 +16,55 @@ export default function Profile() {
}, [])
useEffect(() => {
- setUser({...user, dark_mode: darkMode})
+ setUser({ ...user, dark_mode: darkMode })
}, [darkMode])
const handleChangeDarkMode = () => {
- setUser({...user, dark_mode: !user.dark_mode})
+ setUser({ ...user, dark_mode: !user.dark_mode })
}
const handleDownloadConfig = async () => {
- const fileName = "plants"
+ const fileName = 'plants'
const json = JSON.stringify(data)
- const blob = new Blob([json], {type: 'application/json'})
+ const blob = new Blob([json], { type: 'application/json' })
const href = await URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = href
- link.download = fileName + ".json"
+ link.download = fileName + '.json'
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
}
- return
-
-
-
-
-
-
-
-
+
+
+ )
+}
diff --git a/src/routes/Style.js b/src/routes/Style.js
index 595029f..cc3fa51 100644
--- a/src/routes/Style.js
+++ b/src/routes/Style.js
@@ -1,79 +1,86 @@
-import {PageLayout} from "../components/PageLayout";
-import {Button} from "../components/Button";
+import { PageLayout } from '../components/PageLayout'
+import { Button } from '../components/Button'
export default function Style() {
+ return (
+
+ Style
- return
- Style
-
-
-
-
H1 Head
-
H2 Headline
-
H3 Headline
-
H4 Headline
-
H5 Headline
-
H6 Headline
-
Text paragraph
-
-
-
-
-
- Primary
- Smooth
- Ghost
- Raised
- Previous
-
-
- Secondary
- Smooth
- Ghost
- Raised
- Previous
-
-
- Warning
- Smooth
- Ghost
- Raised
- Previous
-
-
- Success
- Smooth
- Ghost
- Raised
- Previous
-
-
- Danger
- Smooth
- Ghost
- Raised
- Previous
-
-
-
-
-
- Primary light
-
-
- Primary
-
-
- Primary dark
-
-
- Primary darkest
+
+
H1 Head
+
H2 Headline
+
H3 Headline
+
H4 Headline
+
H5 Headline
+
H6 Headline
+
Text paragraph
-
- Background Primary
+
+
+
+
+ Primary
+
+
+ Smooth
+
+
+ Ghost
+
+
+ Raised
+
+
+ Previous
+
+
+
+ Secondary
+ Smooth
+ Ghost
+ Raised
+ Previous
+
+
+ Warning
+ Smooth
+ Ghost
+ Raised
+ Previous
+
+
+ Success
+ Smooth
+ Ghost
+ Raised
+ Previous
+
+
+ Danger
+ Smooth
+ Ghost
+ Raised
+ Previous
+
-
-
-}
\ No newline at end of file
+
+
+
+
+ Primary light
+
+
Primary
+
+ Primary dark
+
+
+ Primary darkest
+
+
+
Background Primary
+
+
+ )
+}
diff --git a/src/utilities/actions.js b/src/utilities/actions.js
index 150c418..f2194ff 100644
--- a/src/utilities/actions.js
+++ b/src/utilities/actions.js
@@ -1,6 +1,5 @@
-
export const ACTION_TYPES = ['watering', 'spraying', 'bathing']
export const actionId = (action) => {
- return ACTION_TYPES.findIndex(item => item === action)
-}
\ No newline at end of file
+ return ACTION_TYPES.findIndex((item) => item === action)
+}
diff --git a/src/utilities/classNames.js b/src/utilities/classNames.js
deleted file mode 100644
index 75d8dfe..0000000
--- a/src/utilities/classNames.js
+++ /dev/null
@@ -1,4 +0,0 @@
-export function classNames() {
- // console.log(Object.values(arguments), Object.values(arguments).join(' '));
- return Object.values(arguments).join(' ')
-}
diff --git a/src/utilities/pictures.js b/src/utilities/pictures.js
index fb60f5b..4d8aa03 100644
--- a/src/utilities/pictures.js
+++ b/src/utilities/pictures.js
@@ -1,68 +1,66 @@
-
-const pictureName = id => {
+const pictureName = (id) => {
return 'picture-' + id
}
-export const getPicture = id => {
- return localStorage.getItem('picture-' + id ?? '') ?? ""
+export const getPicture = (id) => {
+ return localStorage.getItem(pictureName(id) ?? '') ?? ''
}
export const storePicture = (e, id) => {
- const files = e.target.files;
- let file = files[0];
+ const files = e.target.files
+ let file = files[0]
if (file) {
- const reader = new FileReader();
- reader.onload = function(e) {
- document.getElementById("picture").src = e.target.result;
- };
- reader.readAsDataURL(file);
+ const reader = new FileReader()
+ reader.onload = function (e) {
+ document.getElementById('picture').src = e.target.result
+ }
+ reader.readAsDataURL(file)
}
- const filesToUploads = document.getElementById("input-file").files;
- file = filesToUploads[0];
+ const filesToUploads = document.getElementById('input-file').files
+ file = filesToUploads[0]
if (file) {
const reader = new FileReader()
let dataPicture
reader.onload = function (e) {
- let img = document.createElement("img");
- img.src = e.target.result;
+ let img = document.createElement('img')
+ img.src = e.target.result
- let canvas = document.createElement("canvas");
- var ctx = canvas.getContext("2d");
- ctx.drawImage(img, 0, 0);
+ let canvas = document.createElement('canvas')
+ var ctx = canvas.getContext('2d')
+ ctx.drawImage(img, 0, 0)
- const MAX_WIDTH = 300;
- const MAX_HEIGHT = 300;
- let width = img.width;
- let height = img.height;
+ const MAX_WIDTH = 300
+ const MAX_HEIGHT = 300
+ let width = img.width
+ let height = img.height
if (width > height) {
if (width > MAX_WIDTH) {
- height *= MAX_WIDTH / width;
- width = MAX_WIDTH;
+ height *= MAX_WIDTH / width
+ width = MAX_WIDTH
}
} else {
if (height > MAX_HEIGHT) {
- width *= MAX_HEIGHT / height;
- height = MAX_HEIGHT;
+ width *= MAX_HEIGHT / height
+ height = MAX_HEIGHT
}
}
- canvas.width = width;
- canvas.height = height;
- var ctx = canvas.getContext("2d");
- ctx.drawImage(img, 0, 0, width, height);
+ canvas.width = width
+ canvas.height = height
+ var ctx = canvas.getContext('2d')
+ ctx.drawImage(img, 0, 0, width, height)
- dataPicture = canvas.toDataURL(file.type);
- document.getElementById("picture").src = dataPicture;
+ dataPicture = canvas.toDataURL(file.type)
+ document.getElementById('picture').src = dataPicture
setTimeout(() => {
localStorage.setItem(pictureName(id), dataPicture)
}, 500)
-
- };
- reader.readAsDataURL(file);
+ }
+ reader.readAsDataURL(file)
}
-}
\ No newline at end of file
+}