Skip to content

Commit

Permalink
Add binoculars theme, auto reformat everything
Browse files Browse the repository at this point in the history
  • Loading branch information
pietervdvn committed Sep 8, 2021
1 parent 38dea80 commit 78d6482
Show file tree
Hide file tree
Showing 586 changed files with 114,803 additions and 111,072 deletions.
42 changes: 20 additions & 22 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.187.0/containers/typescript-node
{
"name": "MapComplete",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version: 12, 14, 16
"args": {
"VARIANT": "14"
}
},
"name": "MapComplete",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version: 12, 14, 16
"args": {
"VARIANT": "14"
}
},
// Set *default* container specific settings.json values on container create.
"settings": {},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
1234
],
// Use 'postCreateCommand' to run commands after the container is created.
//"postCreateCommand": "npm run init",

// Set *default* container specific settings.json values on container create.
"settings": {},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [1234],

// Use 'postCreateCommand' to run commands after the container is created.
//"postCreateCommand": "npm run init",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node"
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node"
}
9 changes: 5 additions & 4 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@

Opening a pull request on MapComplete
=====================================

Hey! Thanks for opening a pull request on Mapcomplete! This probably means you want to add a new theme - if so, please follow the checklist below.
If this pull request is for some other issue, please ignore the template.
Hey! Thanks for opening a pull request on Mapcomplete! This probably means you want to add a new theme - if so, please
follow the checklist below. If this pull request is for some other issue, please ignore the template.

Adding your new theme
---------------------
Expand All @@ -14,4 +13,6 @@ To making merging smooth, please make sure that each of the following conditions

- [ ] The codebase is GPL-licensed. By opening a pull request, the new theme will be GPL too
- [ ] All images are included in the pull request and no images are loaded from an external service (e.g. Wikipedia)
- [ ] The [guidelines on how to make your own theme](https://github.com/pietervdvn/MapComplete/blob/master/Docs/Making_Your_Own_Theme.md) are read and followed
- [ ]
The [guidelines on how to make your own theme](https://github.com/pietervdvn/MapComplete/blob/master/Docs/Making_Your_Own_Theme.md)
are read and followed
20 changes: 10 additions & 10 deletions .github/workflows/deploy_pietervdvn.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
name: Deployment on pietervdvn
on:
push

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/[email protected]
with:
node-version: '15'
node-version: '15'
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'

- name: install deps
run: npm ci

- name: create generated dir
run: mkdir ./assets/generated

- name: create stub themes
run: "echo '{\"layers\": [], \"themes\": []}' > ./assets/generated/known_layers_and_themes.json"

- name: Prepare deploy
run: npm run prepare-deploy

- name: Clone deployment repo
env:
DEPLOY_KEY_PIETERVDVN: ${{ secrets.DEPLOY_KEY_PIETERVDVN }}
run: |
run: |
echo "Cloning destination repo"
git config --global user.email "[email protected]"
git config --global user.name "pietervdvn"
git clone --depth 1 --single-branch --branch master "https://x-access-token:[email protected]/pietervdvn/pietervdvn.github.io.git"
echo "Destination repo is cloned"
- name: "Copying files"
run: |
echo "Deploying"
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/pull_request_check.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
name: Pull request check
on:
pull_request_target:
types: [opened, edited, synchronize, ready_for_review, review_requested]
types: [ opened, edited, synchronize, ready_for_review, review_requested ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/[email protected]
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'

- name: install deps
run: npm ci

- name: create generated dir
run: mkdir ./assets/generated

- name: create stub themes
run: "echo '{\"layers\": [], \"themes\": []}' > ./assets/generated/known_layers_and_themes.json"

- name: generate translations
run: npm run generate:translations

- name: Compile license info
run: npm run generate:licenses

- name: Compile and validate themes and layers
run: npm run validate:layeroverview
run: npm run validate:layeroverview

- name: Validate license info
run: npm run validate:licenses

Expand All @@ -45,10 +45,10 @@ jobs:
else
echo "VALIDATION_FAILED=false" >> $GITHUB_ENV
fi
- name: Test variable
run: echo "${{ env.VALIDATION_FAILED }}"

- name: Archive reports
uses: actions/upload-artifact@v2
if: >-
Expand All @@ -58,7 +58,7 @@ jobs:
path: |
layer_report.txt
missing_licenses.txt
- name: Comment PR
uses: allthatjazzleo/actions-pull-request-add-comment@master
if: >-
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/theme_validation_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,42 @@ on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/[email protected]
with:
node-version: '15'
node-version: '15'
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'

- name: install deps
run: npm ci

- name: create generated dir
run: mkdir ./assets/generated

- name: create stub themes
run: "echo '{\"layers\": [], \"themes\": []}' > ./assets/generated/known_layers_and_themes.json"

- name: Prepare deploy
run: npm run prepare-deploy

- name: Clone deployment repo
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
run: |
run: |
echo "Cloning destination repo"
git config --global user.email "[email protected]"
git config --global user.name "MapComplete"
git clone --depth 1 --single-branch --branch main "https://x-access-token:[email protected]/MapComplete/mapcomplete.github.io.git"
echo "Destination repo is cloned"
- name: "Copying files"
run: |
echo "Deploying"
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"files.eol": "\n"
"files.eol": "\n"
}
8 changes: 4 additions & 4 deletions Customizations/SharedTagRenderings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import TagRenderingConfig from "../Models/ThemeConfig/TagRenderingConfig";

export default class SharedTagRenderings {

public static SharedTagRendering : Map<string, TagRenderingConfig> = SharedTagRenderings.generatedSharedFields();
public static SharedIcons : Map<string, TagRenderingConfig> = SharedTagRenderings.generatedSharedFields(true);
public static SharedTagRendering: Map<string, TagRenderingConfig> = SharedTagRenderings.generatedSharedFields();
public static SharedIcons: Map<string, TagRenderingConfig> = SharedTagRenderings.generatedSharedFields(true);

private static generatedSharedFields(iconsOnly = false) : Map<string, TagRenderingConfig>{
private static generatedSharedFields(iconsOnly = false): Map<string, TagRenderingConfig> {
const dict = new Map<string, TagRenderingConfig>();

function add(key, store) {
try {
dict.set(key, new TagRenderingConfig(store[key], undefined, `SharedTagRenderings.${key}`))
} catch (e) {
if(!Utils.runningFromConsole){
if (!Utils.runningFromConsole) {
console.error("BUG: could not parse", key, " from questions.json or icons.json - this error happened during the build step of the SharedTagRenderings", e)

}
Expand Down
38 changes: 25 additions & 13 deletions Docs/Architecture.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Architecture
============

This document aims to give an architectural overview of how MapCompelte is built. It should give some feeling on how everything fits together.
This document aims to give an architectural overview of how MapCompelte is built. It should give some feeling on how
everything fits together.

Servers?
--------
Expand All @@ -11,24 +12,30 @@ There are no servers for MapComplete, all services are configured by third parti
Minimal HTML - Minimal CSS
--------------------------

There is quasi no HTML. Most of the components are generated by TypeScript and attached dynamically. The html is a barebones skeleton which serves every theme.
There is quasi no HTML. Most of the components are generated by TypeScript and attached dynamically. The html is a
barebones skeleton which serves every theme.


The UIEventSource
-----------------

Most (but not all) objects in MapComplete get all the state they need as a parameter in the constructor. However, as is the case with most graphical applications, there are quite some dynamical values.
Most (but not all) objects in MapComplete get all the state they need as a parameter in the constructor. However, as is
the case with most graphical applications, there are quite some dynamical values.

All values which change regularly are wrapped into a [UIEventSource](https://github.com/pietervdvn/MapComplete/blob/master/Logic/UIEventSource.ts).
An UiEventSource is a wrapper containing a value and offers the possibility to add a callback function which is called every time the value is changed (with setData)
All values which change regularly are wrapped into
a [UIEventSource](https://github.com/pietervdvn/MapComplete/blob/master/Logic/UIEventSource.ts). An UiEventSource is a
wrapper containing a value and offers the possibility to add a callback function which is called every time the value is
changed (with setData)

Furthermore, there are various helper functions, the most widely used one being `map` - generating a new event source with the new value applied.
Note that 'map' will also absorb some changes, e.g. `const someEventSource : UIEventSource<string[]> = ... ; someEventSource.map(list = list.length)` will only trigger when the length of the list has changed.
Furthermore, there are various helper functions, the most widely used one being `map` - generating a new event source
with the new value applied. Note that 'map' will also absorb some changes,
e.g. `const someEventSource : UIEventSource<string[]> = ... ; someEventSource.map(list = list.length)` will only trigger
when the length of the list has changed.

An object which receives an UIEventSource is responsible of responding onto changes of this object. This is especially true for UI-components
An object which receives an UIEventSource is responsible of responding onto changes of this object. This is especially
true for UI-components

UI
--```
UI --```

export default class MyComponent {

Expand All @@ -37,6 +44,7 @@ export default class MyComponent {
}

}

```
The Graphical User Interface is composed of various UI-elements. For every UI-element, there is a BaseUIElement which creates the actual HTMLElement when needed.
Expand All @@ -55,9 +63,9 @@ For example:
```

const src : UIEventSource<string> = ... // E.g. user input, data that will be updated...
new VariableUIElement(src)
.AttachTo('some-id') // attach it to the html
const src : UIEventSource<string> = ... // E.g. user input, data that will be updated... new VariableUIElement(src)
.AttachTo('some-id') // attach it to the html

```
Note that every component offers support for `onClick( someCallBack)`
Expand Down Expand Up @@ -109,6 +117,7 @@ This can be constructed as following:
```

// We construct the dropdown element with values and labelshttps://tailwindcss.com/
const isOpened = new Dropdown<string>(Translations.t.is_this_shop_opened_during_holidays,
[
Expand All @@ -127,6 +136,7 @@ This can be constructed as following:
)

return new Combine([isOpened, extraQuestion])

```
### Constructing a special class
Expand All @@ -144,6 +154,7 @@ export default class MyComponent {
}

}

```
2. Construct the needed UI in the constructor
Expand All @@ -166,6 +177,7 @@ export default class MyComponent {
}

}

```
3. You'll notice that you'll end up with one certain component (in this example the combine) to wrap it all together. Change the class to extend this type of component and use super to wrap it all up:
Expand Down
Loading

0 comments on commit 78d6482

Please sign in to comment.