Skip to content

Commit

Permalink
Merge pull request #14 from Plant-for-the-Planet-org/feature/treeCounter
Browse files Browse the repository at this point in the history
Tree counter widget
  • Loading branch information
sagararyal authored Jan 28, 2021
2 parents 72e7988 + da10f55 commit efa4fd7
Show file tree
Hide file tree
Showing 11 changed files with 1,269 additions and 59 deletions.
4 changes: 2 additions & 2 deletions .env.local
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
API_URL=https://app-development.plant-for-the-planet.org/app
CDN_URL=https://cdn.plant-for-the-planet.org/development
API_URL=https://app.plant-for-the-planet.org/app
CDN_URL=https://cdn.plant-for-the-planet.org
APP_URL=https://www1.plant-for-the-planet.org
26 changes: 26 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
},
"devDependencies": {
"@rollup/plugin-commonjs": "^16.0.0",
"@rollup/plugin-multi-entry": "^4.0.0",
"@rollup/plugin-node-resolve": "^10.0.0",
"@rollup/plugin-replace": "^2.3.4",
"dotenv": "^8.2.0",
Expand Down
5 changes: 4 additions & 1 deletion public/data/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"target":"Ziel",
"plantTrees":"Bäume pflanzen",
"viewProfile":"Profil anzeigen",
"poweredBy":"Powered by Plant-for-the-Planet"
"poweredBy":"Powered by Plant-for-the-Planet",
"treesPlantedBy":"trees planted by",
"and":"und",
"treesPlantedByComm":"trees planted by community."
}
5 changes: 4 additions & 1 deletion public/data/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"target":"Target",
"plantTrees":"Plant Trees",
"viewProfile":"View Profile",
"poweredBy":"Powered by Plant-for-the-Planet"
"poweredBy":"Powered by Plant-for-the-Planet",
"treesPlantedBy":"trees planted by",
"and":"and",
"treesPlantedByComm":"trees planted by community."
}
12 changes: 12 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<title>Planet Widgets</title>

<script defer src='/build/treemap.js'></script>
<script defer src='/build/treecounter.js'></script>

</head>

Expand All @@ -25,6 +26,17 @@ <h2> TreeMap Variant 3</h2>
<p> Partner, theme="dark", community="false", locale="de" </p>
<tree-map user='prf_h6smcMDN23Qet1CP7BEplM60' theme="dark" community="false" locale="de"></tree-map>

<h2> TreeMap Variant 4</h2>
<p> local de theme=dark</p>
<tree-map user='prf_h6smcMDN23Qet1CP7BEplM60' locale="de" theme="dark"></tree-map>

<h2> Tree Counter Variant 1</h2>
<p> Default </p>
<tree-counter user='prf_h6smcMDN23Qet1CP7BEplM60'></tree-counter>

<h2> Tree Counter Variant 2</h2>
<p> Dark mode, locale="de" and community=false</p>
<tree-counter user='prf_h6smcMDN23Qet1CP7BEplM60' theme="dark" community="false" locale="de"></tree-counter>
</body>

</html>
577 changes: 577 additions & 0 deletions public/map.css

Large diffs are not rendered by default.

73 changes: 69 additions & 4 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import commonjs from "@rollup/plugin-commonjs";
import resolve from "@rollup/plugin-node-resolve";
import livereload from "rollup-plugin-livereload";
import { terser } from "rollup-plugin-terser";
import css from "rollup-plugin-css-only";
import json from "@rollup/plugin-json";
import {config} from 'dotenv';
import replace from '@rollup/plugin-replace';
Expand Down Expand Up @@ -36,7 +35,8 @@ function serve() {
};
}

export default {
//Todo separate the treemap and treecounter.js files
export default [{
input: "src/TreeMap/treemap.js",
output: {
sourcemap: true,
Expand All @@ -47,7 +47,7 @@ export default {
plugins: [
gzipPlugin(),
replace({
// stringify the object
// stringify the object
__myapp: JSON.stringify({
env: {
isProd: production,
Expand Down Expand Up @@ -101,4 +101,69 @@ export default {
watch: {
clearScreen: false,
},
};
},{
input: "src/TreeCounter/treecounter.js",
output: {
sourcemap: true,
format: "iife",
name: "app",
file: "public/build/treecounter.js",
},
plugins: [
gzipPlugin(),
replace({
// stringify the object
__myapp: JSON.stringify({
env: {
isProd: production,
...config().parsed // attached the .env config
}
}),
}),
svelte({
include: /App\.svelte$/,
compilerOptions: {
// enable run-time checks when not in production
dev: !production,
customElement: true
},
emitCss: false,
}),
svelte({
exclude: /App\.svelte$/,
compilerOptions: {
// enable run-time checks when not in production
dev: !production,
customElement: false
},
emitCss: false,
}),
json(),

// If you have external dependencies installed from
// npm, you'll most likely need these plugins. In
// some cases you'll need additional configuration -
// consult the documentation for details:
// https://github.com/rollup/plugins/tree/master/packages/commonjs
resolve({
browser: true,
dedupe: ["svelte"],
}),
commonjs(),

// In dev mode, call `npm run start` once
// the bundle has been generated
!production && serve(),

// Watch the `public` directory and refresh the
// browser on changes when not in production
!production && livereload("public"),

// If we're building for production (npm run build
// instead of npm run dev), minify
production && terser(),
],
watch: {
clearScreen: false,
},
}];
Loading

0 comments on commit efa4fd7

Please sign in to comment.