Skip to content

Commit 8af77cc

Browse files
authored
refactor: Refactor code structure for improved readability and maintainability (#1172)
1 parent fe8b540 commit 8af77cc

36 files changed

+2784
-1161
lines changed

.all-contributorsrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,4 +337,4 @@
337337
]
338338
}
339339
]
340-
}
340+
}

.github/dependabot.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
version: 2
77
updates:
8-
- package-ecosystem: "npm" # See documentation for possible values
9-
directory: "/" # Location of package manifests
8+
- package-ecosystem: 'npm' # See documentation for possible values
9+
directory: '/' # Location of package manifests
1010
schedule:
11-
interval: "weekly"
11+
interval: 'weekly'
1212
open-pull-requests-limit: 3

.github/pull_request_template.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Description
2+
23
<Please describe the suggested changes>
34

45
## screenshots
5-
<paste here>
6+
7+
<paste here>

.gitpod.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
tasks:
22
- init: npm install && npm run build
33
command: npm run start
4-
5-

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
**/generated/*
2-
README.md
2+
.all-contributorsrc

.stylelintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "stylelint-config-standard-scss",
2+
"extends": ["stylelint-config-standard-scss", "stylelint-prettier/recommended"],
33
"ignoreFiles": [
44
"node_modules/**/*",
55
"dist/**/*",

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"eslint.experimental.useFlatConfig": true
3-
}
2+
"eslint.experimental.useFlatConfig": true
3+
}

CHANGELOG.md

Lines changed: 288 additions & 303 deletions
Large diffs are not rendered by default.

CONTRIBUTING.md

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ Look at the project and if you see some points which can be improved (it can be
2626

2727
For start working on the project you can use any of options from the below:
2828

29-
- You can set up project locally. This is **highly recommended** for regular/repeat contributions. This setup allows you to work and test your changes.
30-
- Use Gitpod, a free online dev environment. Clicking the link below will start a ready-to-code dev environment in your browser. It only takes a few minutes.
29+
- You can set up project locally. This is **highly recommended** for regular/repeat contributions. This setup allows you to work and test your changes.
30+
- Use Gitpod, a free online dev environment. Clicking the link below will start a ready-to-code dev environment in your browser. It only takes a few minutes.
3131

3232
Click [here](https://gitpod.io/#https://github.com/hasadna/open-bus-map-search) to
3333
open project in Gitpod
@@ -42,48 +42,48 @@ Follow these steps to run the project on your local machine:
4242
2. **Clone the Repository:**
4343
Clone the repository to your local machine. You can do this by running the following command in your terminal:
4444

45-
```bash
46-
git clone https://github.com/hasadna/open-bus-map-search.git
47-
```
45+
```bash
46+
git clone https://github.com/hasadna/open-bus-map-search.git
47+
```
4848

4949
3. **Navigate to the Project Directory:**
5050
Once the repository is cloned, navigate to the project directory by running:
5151

52-
```bash
53-
cd open-bus-map-search
54-
```
52+
```bash
53+
cd open-bus-map-search
54+
```
5555

5656
4. **Install Dependencies:**
5757
The project uses npm to manage dependencies. Once Node is installed, you can install the project dependencies by running:
58-
```bash
59-
npm install
60-
```
58+
```bash
59+
npm install
60+
```
6161
5. **Run the Project:**
6262
After all dependencies are installed, you can start the project by running:
63-
```bash
64-
npm start
65-
```
66-
The project should now be running on your local machine. Open your web browser and navigate to http://localhost:3000 to view the project.
63+
```bash
64+
npm start
65+
```
66+
The project should now be running on your local machine. Open your web browser and navigate to http://localhost:3000 to view the project.
6767

6868
# How to open the PR
6969

70-
- If you're new to GitHub, here is a [tutorial describing Pull Requests](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).
71-
- create a branch
72-
- branch better to be named after issue (or feature) it tries so solve, e.g. `feat/add-close-button-to-modal`
73-
- Please make sure that the project works on your computer
74-
- do changes and then - do commit (`git commit -m "feat: add some feature"`)
75-
- push the branch to remote repo (`git push`)
76-
- go to the repo and create a pr (by pressing `create a pr` button)
77-
- tag one of the maintainers as reviewers
70+
- If you're new to GitHub, here is a [tutorial describing Pull Requests](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).
71+
- create a branch
72+
- branch better to be named after issue (or feature) it tries so solve, e.g. `feat/add-close-button-to-modal`
73+
- Please make sure that the project works on your computer
74+
- do changes and then - do commit (`git commit -m "feat: add some feature"`)
75+
- push the branch to remote repo (`git push`)
76+
- go to the repo and create a pr (by pressing `create a pr` button)
77+
- tag one of the maintainers as reviewers
7878

7979
# Commit message convention
8080

81-
- commit messages better to be short and explain clearly what the change is about
82-
- `fix` change that tries to fix some bug, e.g. `fix: make close button visible at mobile`
83-
- `feat` change that add some new functionality, e.g. `feat: add a modal component`
84-
- `docs` change that adds some documentation, e.g. `docs: add project description at readme`
85-
- `refactor` change that makes the code better, e.g. `refactor: split App component to subcomponents`
86-
- `chore` all the other things `chore: upgrade react package to new 18 version`
81+
- commit messages better to be short and explain clearly what the change is about
82+
- `fix` change that tries to fix some bug, e.g. `fix: make close button visible at mobile`
83+
- `feat` change that add some new functionality, e.g. `feat: add a modal component`
84+
- `docs` change that adds some documentation, e.g. `docs: add project description at readme`
85+
- `refactor` change that makes the code better, e.g. `refactor: split App component to subcomponents`
86+
- `chore` all the other things `chore: upgrade react package to new 18 version`
8787

8888
## testing the project:
8989

@@ -97,35 +97,35 @@ Follow these steps to run the project on your local machine:
9797
| `npm run test:e2e:ui` | Run the e2e (playwright) tests with user interface. |
9898
| `npm run test` | Run all the kind of tests. |
9999

100-
- additional helpful flags - https://playwright.dev/docs/test-cli
100+
- additional helpful flags - https://playwright.dev/docs/test-cli
101101

102102
## useful resources:
103103

104-
- [the design file](https://www.figma.com/file/Plw8Uuu6U96CcX5tJyRMoW/Public-Transportation-visual-informaiton?type=design&node-id=0-1&mode=design&t=Dh8lI3EJ37unxvoe-0)
105-
- [data model schema](https://github.com/hasadna/open-bus-stride-db/blob/main/DATA_MODEL.md)
106-
- [API documentation and examples (swagger)](https://open-bus-stride-api.hasadna.org.il/docs)
107-
- [the deployed website](https://open-bus-map-search.hasadna.org.il/dashboard)
104+
- [the design file](https://www.figma.com/file/Plw8Uuu6U96CcX5tJyRMoW/Public-Transportation-visual-informaiton?type=design&node-id=0-1&mode=design&t=Dh8lI3EJ37unxvoe-0)
105+
- [data model schema](https://github.com/hasadna/open-bus-stride-db/blob/main/DATA_MODEL.md)
106+
- [API documentation and examples (swagger)](https://open-bus-stride-api.hasadna.org.il/docs)
107+
- [the deployed website](https://open-bus-map-search.hasadna.org.il/dashboard)
108108

109109
## Page Video Descriptions
110110

111111
This section provides video tutorials for some of the key pages in this project.
112112

113113
**Dashboard & Maps Pages**
114114

115-
- **Video:** [How to Use the Dashboard & Maps Pages](https://www.youtube.com/watch?v=MJZrIxjQEH8&list=PL6Rh06rT7uiX1AQE-lm55hy-seL3idx3T&t=17s)
115+
- **Video:** [How to Use the Dashboard & Maps Pages](https://www.youtube.com/watch?v=MJZrIxjQEH8&list=PL6Rh06rT7uiX1AQE-lm55hy-seL3idx3T&t=17s)
116116

117117
**Bug Reporting**
118118

119-
- **Video:** [How to Report Bugs](https://www.youtube.com/watch?v=F6sD9Bz4Xj0&list=PL6Rh06rT7uiX1AQE-lm55hy-seL3idx3T)
119+
- **Video:** [How to Report Bugs](https://www.youtube.com/watch?v=F6sD9Bz4Xj0&list=PL6Rh06rT7uiX1AQE-lm55hy-seL3idx3T)
120120

121121
## Troubleshooting
122122

123123
we're here to help! feel free to join our [Slack channel](https://join.slack.com/t/hasadna/shared_invite/zt-21qipktl1-7yF4FYJVxAqXl0wE4DlMKQ)
124124

125125
# Related Repositories
126126

127-
- the API client
128-
- the data API
127+
- the API client
128+
- the data API
129129

130130
## API client
131131

@@ -144,7 +144,7 @@ https://open-bus-stride-api.hasadna.org.il/docs
144144

145145
### Why do I get a red `x` commit status?
146146

147-
- lint - you have lint errors. fix them by running `npm run lint:fix`
148-
- tests - you have test errors. see them by running `npm run test:unit:ci`
149-
- build - you have build errors. see them by running `npm run build`
150-
- pr title validation - you have an invalid pr title. please edit the title of your PR with conventional commit formatting. examples: `feat: add new feature`, `fix: fix a bug` or `docs: update README.md`
147+
- lint - you have lint errors. fix them by running `npm run lint:fix`
148+
- tests - you have test errors. see them by running `npm run test:unit:ci`
149+
- build - you have build errors. see them by running `npm run build`
150+
- pr title validation - you have an invalid pr title. please edit the title of your PR with conventional commit formatting. examples: `feat: add new feature`, `fix: fix a bug` or `docs: update README.md`

README.md

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,69 @@
11
# Open bus ranking app
22

33
## Welcome!
4+
45
This is the official repository of the open bus (תחב"צ פתוחה / דאטאבוס) project - also known as "ShameBus".
56
[link to the project](https://open-bus-map-search.hasadna.org.il/dashboard)
67

78
Please feel free to submit pull requests and contribute to the project.
89
For more details about contributing, see the [CONTRIBUTING.md](CONTRIBUTING.md) file.
910

1011
# Running the project locally
12+
1113
An explanation how to run the project locally you can [read here](CONTRIBUTING.md#running-the-project-on-a-local-environment).
1214

1315
## View video (Hebrew language):
14-
### The video will explain you how to contribute to the project:
16+
17+
### The video will explain you how to contribute to the project:
18+
1519
[![video (hebrew) about the project](https://img.youtube.com/vi/6H6jkJCVhgk/0.jpg)](https://www.youtube.com/watch?v=6H6jkJCVhgk)
1620

1721
# Easter eggs
22+
1823
We've hidden a couple of fun surprises in our web app, just for you. Discovering them is as easy as typing a few magic words on your keyboard.
1924

2025
## How to Find the Easter Eggs
26+
2127
1. Open our [web app](https://open-bus-map-search.hasadna.org.il/dashboard)
2228
2. **Unleash the Magic Words:**
2329
To reveal the hidden gems, use your keyboard to type the following commands:
24-
2530
- **Type "storybook":**
2631
Watch the magic unfold as you type "storybook" on your keyboard. You might just stumble upon our Storybook, a treasure trove of UI components showcasing the beauty and functionality of our app.
2732
- **Type "geek":**
2833
To get some experimental charts with some additional data and aggregation
2934

30-
3135
## deployments
3236

3337
This app is created by the volunteers of [Public Knowledge Workshop](https://www.hasadna.org.il/)
3438

3539
### submitting pull requests
40+
3641
Thanks for your willingness to invest time and help us improve!
42+
3743
1. If you're new to GitHub, here is a [tutorial describing Pull Requests](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request). if you're familiarized with Merge Requests - it's the same concept.
3844
2. Please make sure that the project works on your computer
3945
3. Please tag one of the maintainers as reviewers
40-
we're here to help! feel free to join our [Slack channel](https://join.slack.com/t/hasadna/shared_invite/zt-21qipktl1-7yF4FYJVxAqXl0wE4DlMKQ)
46+
we're here to help! feel free to join our [Slack channel](https://join.slack.com/t/hasadna/shared_invite/zt-21qipktl1-7yF4FYJVxAqXl0wE4DlMKQ)
4147

4248
## Links for developers
43-
* [figma file](https://www.figma.com/file/Plw8Uuu6U96CcX5tJyRMoW/Public-Transportation-visual-informaiton?node-id=0%3A1&t=EJCQpeg5zSbVXLUx-0)
44-
* [data model schema](https://github.com/hasadna/open-bus-stride-db/blob/main/DATA_MODEL.md)
45-
* [Slack channel](https://join.slack.com/t/hasadna/shared_invite/zt-21qipktl1-7yF4FYJVxAqXl0wE4DlMKQ)
46-
* [Swagger](https://open-bus-stride-api.hasadna.org.il/docs)
47-
* [Production](https://open-bus-map-search.hasadna.org.il/dashboard)
4849

49-
## Related Repositories
50+
- [figma file](https://www.figma.com/file/Plw8Uuu6U96CcX5tJyRMoW/Public-Transportation-visual-informaiton?node-id=0%3A1&t=EJCQpeg5zSbVXLUx-0)
51+
- [data model schema](https://github.com/hasadna/open-bus-stride-db/blob/main/DATA_MODEL.md)
52+
- [Slack channel](https://join.slack.com/t/hasadna/shared_invite/zt-21qipktl1-7yF4FYJVxAqXl0wE4DlMKQ)
53+
- [Swagger](https://open-bus-stride-api.hasadna.org.il/docs)
54+
- [Production](https://open-bus-map-search.hasadna.org.il/dashboard)
55+
56+
## Related Repositories
57+
5058
- the API client
5159
- the data API
5260

5361
### API client
62+
5463
The client is a JS library that provides methods and data models. for example:
55-
https://github.com/hasadna/open-bus-map-search/blob/main/src/model/busStop.ts#L4
64+
https://github.com/hasadna/open-bus-map-search/blob/main/src/model/busStop.ts#L4
5665
[link to repo](https://github.com/iliakap/open-bus-stride-client).
5766

58-
5967
## Contributors
6068

6169
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
@@ -116,7 +124,8 @@ https://github.com/hasadna/open-bus-map-search/blob/main/src/model/busStop.ts#L4
116124
<!-- ALL-CONTRIBUTORS-LIST:END -->
117125

118126
### data API
127+
119128
The API is backend code that provides us with data and aggregations from the DB
120-
You can see it's endpoints here:
121-
https://open-bus-stride-api.hasadna.org.il/docs
122-
[link to repo](https://github.com/hasadna/open-bus-stride-api).
129+
You can see it's endpoints here:
130+
https://open-bus-stride-api.hasadna.org.il/docs
131+
[link to repo](https://github.com/hasadna/open-bus-stride-api).

babel.config.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
2-
"presets": [
3-
"@babel/preset-env",
4-
["@babel/preset-react", { "runtime": "automatic" }]
5-
],
2+
"presets": ["@babel/preset-env", ["@babel/preset-react", { "runtime": "automatic" }]],
63
"plugins": ["babel-plugin-transform-import-meta"]
74
}

eslint.config.js

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ export default [
2424
'test-results',
2525
'playwright-report',
2626
'storybook-static',
27+
'public',
2728
'.nx',
28-
'jest.config.ts',
2929
'**/*.js',
30-
'public',
3130
'applitools.config.cjs',
3231
],
3332
},
@@ -41,7 +40,10 @@ export default [
4140
},
4241
},
4342
{
44-
settings: { 'import/resolver': { typescript: true }, react: { version: 'detect' } },
43+
settings: {
44+
'import/resolver': { typescript: true },
45+
react: { version: 'detect' },
46+
},
4547
languageOptions: {
4648
parser: typescriptEslintParser,
4749
parserOptions: {
@@ -54,34 +56,23 @@ export default [
5456
},
5557
{
5658
rules: {
57-
...typescriptEslintEslintPlugin.configs.recommended.rules,
58-
...typescriptEslintEslintPlugin.configs['recommended-requiring-type-checking'].rules,
59-
...eslintPluginReact.configs.recommended.rules,
59+
// React
6060
'react-hooks/rules-of-hooks': 'error',
6161
'react/jsx-filename-extension': [1, { extensions: ['.tsx'] }],
6262
'react/react-in-jsx-scope': 'off',
63+
// TypeScript
6364
'@typescript-eslint/no-explicit-any': 'warn',
6465
'@typescript-eslint/no-unsafe-call': 'off',
6566
'@typescript-eslint/no-unsafe-member-access': 'off',
6667
'@typescript-eslint/no-floating-promises': 'off',
6768
'@typescript-eslint/restrict-template-expressions': 'off',
6869
'@typescript-eslint/no-base-to-string': 'off',
6970
'@typescript-eslint/no-unsafe-assignment': 'off',
71+
// Import
7072
'import/no-unused-modules': 'error',
7173
'import/order': 'error',
72-
'prettier/prettier': [
73-
'error',
74-
{
75-
semi: false,
76-
tabWidth: 2,
77-
printWidth: 100,
78-
singleQuote: true,
79-
trailingComma: 'all',
80-
bracketSameLine: true,
81-
jsxSingleQuote: false,
82-
endOfLine: 'auto',
83-
},
84-
],
74+
// Prettier
75+
'prettier/prettier': 'error',
8576
},
8677
},
8778
]

0 commit comments

Comments
 (0)