Skip to content

Commit

Permalink
Update codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Hans5958 committed Jul 29, 2023
1 parent 5b0b148 commit 31d1123
Show file tree
Hide file tree
Showing 31 changed files with 544 additions and 435 deletions.
20 changes: 19 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,27 @@
"design",
"doc"
]
},
{
"login": "Hans5958",
"name": "Hans5958",
"avatar_url": "https://avatars.githubusercontent.com/u/11584103?v=4",
"profile": "https://github.com/Hans5958",
"contributions": [
"a11y",
"bug",
"code",
"content",
"data",
"doc",
"design",
"maintenance",
"projectManagement",
"tool"
]
}
],
"contributorsPerLine": 7,
"contributorsPerLine": 4,
"skipCi": true,
"repoType": "github",
"repoHost": "https://github.com",
Expand Down
10 changes: 5 additions & 5 deletions .github/ISSUE_TEMPLATE/3-edit-json.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Entry edit submission
description: Edit an existing entry after using the website
labels: ["entry update"]
name: Patch submission
description: Make changes to the Atlas data after using the website
labels: ["atlas data: patch"]
body:
- type: markdown
attributes:
Expand All @@ -14,8 +14,8 @@ body:
- type: textarea
id: json
attributes:
label: Entry data
description: Upon editing, please copy the exported JSON-formatted data. This will be automatically formatted into code, so no need for backticks.
label: Patch
description: Upon editing, please copy the exported JSON-formatted patch. This will be automatically formatted into code, so no need for backticks.
render: json
validations:
required: true
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/4-edit-request.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Edit request
description: Request for edits of the Atlas data
labels: ["entry update"]
description: Request for changes to the Atlas data
labels: ["atlas data: request"]
body:
- type: textarea
id: description
Expand Down
3 changes: 3 additions & 0 deletions .github/labeler-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
staging merge:
- 'cleanup'
- 'staging/*'
5 changes: 5 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'atlas data: patch':
- data/patches/**

'atlas data: direct':
- web/atlas.json
13 changes: 13 additions & 0 deletions .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: "PR Labeler"
on:
- pull_request_target

jobs:
triage:
name: Triage
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
6 changes: 6 additions & 0 deletions .github/workflows/qodana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ jobs:
qodana:
name: Qodana
runs-on: ubuntu-latest
if: github.repository_owner == 'placeAtlas'
permissions:
contents: write
pull-requests: write
checks: write
security-events: write
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/validate-json.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
name: Validate Atlas data
name: Validate JSON files
on:
push:
paths:
- web/atlas.json
- data/patches/*.json
pull_request:
paths:
- web/atlas.json
- data/patches/*.json
jobs:
validate:
name: Validate
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -17,7 +21,7 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
key: ${{ runner.os }}-pip-${{ hashFiles('tools/ci/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Validate
Expand Down
61 changes: 33 additions & 28 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,69 @@
# Contributing

This project is open source, and contributions are welcome. In fact, the Atlas relies on user contributions.
This project is open-source, and contributions are welcome. In fact, the Atlas relies on user contributions.

You may contribute to the project by submitting a Pull Request on the GitHub repo or sending your submissions through [Reddit](https://www.reddit.com/r/placeAtlas2). Other than that, you can get help from [Discord](https://discord.gg/pJkm23b2nA) or [Reddit](https://www.reddit.com/r/placeAtlas2).

## New Atlas entries

To contribute to the map, we require a certain format for artwork region and labels. This can be generated on [the drawing mode](https://2022.place-atlas.stefanocoding.me?mode=draw) on the website.

To add a new entry, go to [the drawing mode](https://2022.place-atlas.stefanocoding.me?mode=draw) and draw a shape/polygon around the region you'd like to describe. You can use the <kbd>Undo</kbd>, <kbd>Redo</kbd>, and <kbd>Reset</kbd> buttons to help you creating a good polygon. Make sure that the lines you're drawing don't form a [self-intersecting polygon](https://upload.wikimedia.org/wikipedia/commons/thumb/0/0f/Complex_polygon.svg/288px-Complex_polygon.svg.png).
To add a new entry, go to [the drawing mode](https://2022.place-atlas.stefanocoding.me?mode=draw) and draw a shape/polygon around the region you'd like to describe. You can use the <kbd>Undo</kbd>, <kbd>Redo</kbd>, and <kbd>Reset</kbd> buttons to help you creating a good polygon. Make sure that the lines you're drawing don't form a [self-intersecting polygon](https://upload.wikimedia.org/wikipedia/commons/thumb/0/0f/Complex_polygon.svg/288px-Complex_polygon.svg.png).

Multiple periods can be added to represent the changing state of the artwork on different times. You can set the start and end period, as well as chosing the appropriate canvas variations. You can also copy the polygon from one period to the other, duplicating a period to be edited later, as well as deleting a period (if there is more than one). An alert is also shown if there are errors for assistance.
If you want to see which areas of the canvas do not have entries yet, select "Highlight Empty" to hide areas that already have entries.

When you're happy with the shape you've drawn, press <kbd>Finish</kbd>. You will now be able to enter some information about the highlighted region:
Multiple periods can be added to represent the changing state of the artwork on different times. You can set the start and end period, as well as chosing the appropriate canvas variations. You can also copy the polygon from one period to the other, duplicating a period to be edited later, as well as deleting a period (if there is more than one). An alert is also shown if there are errors that needed attention.

When you're happy with the shape you've drawn, press <kbd>Finish</kbd>. You will now be able to enter some information about the entry:

- **Name**: A short, descriptive name.
- **Description**: A short description that will also be understood by somebody not familiar with the topic. Usually, the first sentence on Wikipedia is a good example.
- **Links**: Some links that's either most relevant to the topic, or that was responsible for creating the artwork.
- **Description**: A short description that can be understood by somebody not familiar with the topic. If you were involved in drawing this artwork, you may include the meta, describing the process of drawing the artwork in the event. To include lengthy, additional information, consider creating a page on [the r/place Wiki](https://place-wiki.stefanocoding.me/).
- **Links**: Some links that are most relevant to the topic, and/or regarding the process of the drawing the artwork in the event.
- **Website**: If you're describing a project, the project's main website would be suitable here.
- **Subreddit**: Format it like `r/subreddit`.
- **Discord**: Write the invite code, that the invite link without the `discord.gg/` part.
- **Wiki**: The page title of [the r/place Wiki](https://place-wiki.stefanocoding.me/).

All fields but the name are optional. For example, a country flag doesn't necessarily need a description.

Once you've entered all the information, you'll be presented with a pop-up window containing some [JSON](https://en.wikipedia.org/wiki/JSON)-formatted submission data. Depending on the method, there are two preferred methods.
Once you've entered all the information, you'll be presented with a pop-up window containing some [JSON](https://en.wikipedia.org/wiki/JSON)-formatted data. This is the patch that you are going to submit. Depending on the method, there are two preferred methods.

### Through Reddit

You can press the <kbd>Post Direct to Reddit</kbd> button, which will open a page with the title and body already been filled for you. You don't need to change anything what has been prepared.

If that didn't work, copy the entire JSON text and [create a new text post on the subreddit](https://www.reddit.com/r/placeAtlas2/submit). You don't need to add any other text; just directly send the data.
If that didn't work, copy the entire JSON text and [create a new text post on the subreddit](https://www.reddit.com/r/placeAtlas2/submit). You don't need to add any other text; just directly send the patch.

Remember to flair your post with <kbd>New Entry</kbd>. On New Reddit, click the <kbd>Flair</kbd> button on the bottom part, and select <kbd>New Entry</kbd>. On Old Reddit, click the <kbd>select</kbd> button on the "choose a flair" section instead.

### Through GitHub

If you know about Git and how to create a pull request on GitHub, you can try create a patch that will be merged, along with other patches, by one of the members.

You can try pressing the <kbd>Submit Direct to GitHub</kbd> button, which will open a page with the patch file already been prepared to you. If you haven't forked the repository, you would need to fork it with the provided instruction shown on the page. You may add attribution by adding an `_author` key, explained in the next paragraphs. After that, you can press <kbd>Submit changes</kbd>, add follow the steps to create a pull request within GitHub.
You can try pressing the <kbd>Submit Direct to GitHub</kbd> button, which will open a page with the patch file already been prepared to you.

If that didn't work, copy the entire JSON text and [create a new patch file to the repository through GitHub](https://github.com/placeAtlas/atlas-2022/new/cleanup/data/patches?filename=gh-0000-ENTRY-NAME-HERE.json
). Upon opening, replace the `ENTRY-NAME-HERE` into the name of the entry (with the slug format, if possible, e.g. `foo-bar`). You don't need to add any other text; just directly send the patch.

If you haven't forked the repository, you would need to fork it with the provided instruction shown on the page. You may add attribution by adding an `_author` key, explained in the next paragraphs. After that, you can press <kbd>Submit changes</kbd>, add follow the steps to create a pull request within GitHub.

The commit message and description doesn't matter, but you may change it into something more descriptive to make it easier for checking (e.g. <kbd>Add Foo Bar</kbd> or <kbd>Edit Foo Bar</kbd> for the commit message). However, we suggest you to edit the title (at least) and the description of the pull request, containing the changes that you want to do (something like <kbd>Add Foo Bar</kbd> or <kbd>Edit Foo Bar</kbd> for the title, similar to the commit message, is also sufficient).

If you can fork and clone the repository, you can use the provided `tools/create_patch.py` script. This script helps you to create a working patch, along with additional data such as your name for attribution sakes. Simply run the script inside the `tools/` folder and follow the given instructions.

If you want to do this manually (e.g. you don't have Python), you can create a patch by creating a `.json` file inside `data/patches`, with the content of the JSON-formatted data that is given earlier. You may add attribution by adding an `_author` key with the value of your Reddit username or your GitHub username plus a `gh:` prefix.

```json5
{
"id": 0,
"id": -1, // -1 signififies a new entry.
// ...
"_author": "Hans5958_",
// or...
"_author": "gh:Hans5958",
// Choose one of the folllowing:
"_author": "Hans5958_", // Links to https://reddit.com/user/Hans5958_
"_author": "gh:Hans5958", // Links to https://github.com/Hans5958
}
```

Once you have successfully created the patch, the file can be committed, and a pull request towards the `cleanup` branch can be created. A member will merge the pull request if it is adequate.
Once you have successfully created the patch, the file can be committed, and a pull request towards the `cleanup` branch can be created. A member will merge the pull request if it is adequate.

## Edits to Atlas entries

Expand All @@ -68,9 +77,9 @@ Upon submitting, if you use Reddit, please flair it as <kbd>Edit Entry</kbd> ins

As an alternative, you can also submit an issue on GitHub using [this form](https://github.com/placeAtlas/atlas-2022/issues/new?assignees=&labels=entry+update&template=edit-entry.yml) or report it on our Discord server.

### Manually
### Manually by direct edits

Edits are also welcome on this repository using Git through GitHub. You may use Git or GitHub for bulk or large-scale changes, such as removing duplicates.
Direct edits to the `web/atlas.json` are also welcome on this repository using Git through GitHub. You may use Git or GitHub for bulk or large-scale changes, such as removing duplicates, or doing those that are not possible by using patches, such as removing an entry. Keep in mind that this may causes conflicts, so only do it when necessary.

`web/atlas.json` is where the Atlas data is located, in which you can edit on GitHub. The next section includes an example of an entry.

Expand All @@ -80,11 +89,11 @@ To help find duplicates, [use the Overlap mode](https://2022.place-atlas.stefano

### Example

Hereforth is an example of the structured data. The example has been expanded, but please save it in the way so each line is an entry which is minified. The `aformatter.py` script can help you with this.
Hereforth is an example of the structured entry data. The example has been expanded, but when editing directly, please save it in the way so each line is an entry that is minified. The `tools/aformatter.py` script can help you with this.

```json5
{
"id": "tu203o",
"id": 1,
"name": "An entry",
"description": "This is an entry, it is remarkable.",
"links": {
Expand Down Expand Up @@ -124,15 +133,11 @@ Opening the HTML file on your browser is adequate enough to edit. If it doesn't
# Run it inside the web/ folder.
cd web

# Choose one of the following.
# Python 2
python -m SimpleHTTPServer 8000
# Python 3
python -m http.server 8000
# Node.js (http-server)
npx http-server
# Node.js (serve)
npx serve
# Choose one of the following:
python -m SimpleHTTPServer 8000 # Python 2
python -m http.server 8000 # Python 3
npx http-server # Node.js (http-server)
npx serve # Node.js (serve)
```

### Tools
Expand All @@ -143,4 +148,4 @@ The `tools` folder have various scripts for the maintainance of the project, suc
- Formatting/tidying up the data
- Building the site for production

The tools are built using either Node.js and/or Python (3).
The tools may built with various programming languages, but mostly it is made in Python (3).
Loading

0 comments on commit 31d1123

Please sign in to comment.