Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New user interface (coral) setup #138

Merged
merged 63 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
3205fd5
🙈 Add OS generated files to gitignore.
programmiri Oct 17, 2022
704f88a
📝 Add doc for documentation for coral.
programmiri Oct 17, 2022
6458e78
Add new line at end of .gitignore
programmiri Oct 17, 2022
5256ba6
Merge pull request #89 from aiven/update-gitignore
jlprat Oct 17, 2022
715ed74
📝 Add doc for accessibility for coral.
programmiri Oct 17, 2022
2e22491
📝 Add doc for frontend testing for coral.
programmiri Oct 17, 2022
c559286
📝 Add doc for directory structure for coral.
programmiri Oct 17, 2022
f8a5c2c
Merge pull request #91 from aiven/coral-docs-accessibility
SmuliS Oct 17, 2022
0ad7d02
Merge pull request #92 from aiven/coral-docs-frontend-testing
SmuliS Oct 17, 2022
c931fb0
Merge pull request #90 from aiven/coral-docs-documentation
SmuliS Oct 17, 2022
e184513
Fix type and indentation error, remove optional naming option
programmiri Oct 18, 2022
0d2533c
Merge pull request #93 from aiven/coral-docs-directory-structure
SmuliS Oct 18, 2022
c637a5a
Prepare gitignore for react app.
programmiri Oct 18, 2022
fe976f5
Set strict node version to prevent incompatible dependencies.
programmiri Oct 18, 2022
d65d75a
Add vite scaffold react project with typescript
programmiri Oct 18, 2022
a25c12b
Remove elements from the template that are not needed.
programmiri Oct 18, 2022
c7732a7
Add missing newline.
programmiri Oct 19, 2022
343c221
Move coral directory to root level
programmiri Oct 19, 2022
5dc8df5
Merge pull request #107 from aiven/scaffold-react-app
SmuliS Oct 19, 2022
bee762a
feat[coral]: Add prettier
SmuliS Oct 19, 2022
f75ff0e
feat[coral]: run prettier to initial project
SmuliS Oct 19, 2022
5edb660
feat[coral]: Add eslint
SmuliS Oct 19, 2022
059fb3c
feat[coral]: extend ESLint config with eslint-config-prettier
SmuliS Oct 20, 2022
0ce86c1
Merge pull request #116 from aiven/smulis-110
programmiri Oct 20, 2022
a71b0b6
Add testrunner with related packages and basic config.
programmiri Oct 19, 2022
9eb6570
Add testing library and first test to prove working state.
programmiri Oct 19, 2022
c2cb699
Add additional matcher library and update config accordingly.
programmiri Oct 19, 2022
bc38354
Add script for running test in watch mode for development.
programmiri Oct 19, 2022
f0b1c55
Fix missing newlines and typo. Use better selector for test example.
programmiri Oct 20, 2022
2af16f5
Update lockfile after merge inlcuding package changes.
programmiri Oct 20, 2022
a0f63c4
Reformat based on code formatting rules rebased from coral.
programmiri Oct 20, 2022
857e051
Merge pull request #117 from aiven/setup-frontend-testing
SmuliS Oct 20, 2022
b8be2f6
Add aiven design system as package. Configure vite to enable us to us…
programmiri Oct 21, 2022
54323bf
Import css in main.tsx to enable usage. Add component form lib using …
programmiri Oct 21, 2022
c0c8352
Import font for design system.
programmiri Oct 21, 2022
84a984f
Merge pull request #130 from aiven/113-ui-rewrite-add-setup-for-styling
SmuliS Oct 21, 2022
e44a256
fix[coral]: Include required font weights to Inter import
SmuliS Oct 21, 2022
336cb0c
Merge pull request #131 from aiven/smulis-extend-inter-font-import-wi…
programmiri Oct 21, 2022
d7f942b
feat[coral]: Introduce GH action for Coral PR check
SmuliS Oct 20, 2022
f814b9e
Merge pull request #127 from aiven/smulis-add-gh-action-for-coral-pr-…
jlprat Oct 21, 2022
f45938a
feat[coral]: Add support for css modules in unittests
SmuliS Oct 21, 2022
b3a39a1
feat[coral]: Showcase css modules with example
SmuliS Oct 21, 2022
35f3aa1
Merge pull request #133 from aiven/smulis-setup-css-modules
programmiri Oct 24, 2022
57a5684
Add husky. Add prepare script for husky use in sub-directory.
programmiri Oct 20, 2022
984e26c
Add pre-commit hook.
programmiri Oct 20, 2022
d2b1bf5
Add lint-staged and configuration. Update pre-commit hook.
programmiri Oct 20, 2022
c307054
Add condition to only run tasks on pre-commit if changes are in coral…
programmiri Oct 20, 2022
fa74b24
Remove js and jsx from lint-staged as we don't accept js files.
programmiri Oct 20, 2022
4f3ed2c
Remove lint-staged from root and update script.
programmiri Oct 21, 2022
d15ade4
Fix lockfile after merge.
programmiri Oct 21, 2022
2fcb628
feat[coral]: extract tsc into its own pre-commit check
SmuliS Oct 24, 2022
b5da1c8
Merge pull request #129 from aiven/add-precommit-hook
SmuliS Oct 24, 2022
2a6b825
Add typecheck script. Sort scripts alphabetically.
programmiri Oct 21, 2022
153d593
Add first version for README as an overview about the klaw frontend app.
programmiri Oct 21, 2022
14be22f
Update README for coral.
programmiri Oct 21, 2022
1cabe85
Add alex as optional script.
programmiri Oct 21, 2022
eef78fd
Update docs based on some alex suggestions.
programmiri Oct 21, 2022
4268f92
Use imperative to be consistent.:
programmiri Oct 24, 2022
926b202
Remove alex as dependency.
programmiri Oct 24, 2022
3e45e07
Remove tsc and update readme accordingly.
programmiri Oct 24, 2022
b972659
Merge pull request #132 from aiven/add-coral-readme
SmuliS Oct 24, 2022
9dbe8c8
docs: Update README with info about coral.
programmiri Oct 25, 2022
6856b2b
Merge pull request #146 from aiven/145-add-info-about-coral-to-klaw-r…
SmuliS Oct 25, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions .github/workflows/coral-pr-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Coral PR Pipeline

on:
pull_request:
branches:
- main
- coral
paths:
- 'coral/**'
- '.github/workflows/coral-checks.yml'

permissions:
contents: read

env:
NODE_VERSION: 16
PNPM_VERSION: 7.13.4

jobs:
static_code_analysis:
name: Static code analysis
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
persist-credentials: false

- name: Setup node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

- name: Setup pnpm
uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd # v2.2.4
with:
version: ${{ env.PNPM_VERSION }}
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
working-directory: ./coral
run: pnpm install --frozen-lockfile

- name: Run static checks
working-directory: ./coral
run: pnpm run lint

tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
persist-credentials: false

- name: Setup node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

- name: Setup pnpm
uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd # v2.2.4
with:
version: ${{ env.PNPM_VERSION }}
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
working-directory: ./coral
run: pnpm install --frozen-lockfile

- name: Run unittests
working-directory: ./coral
run: pnpm run test
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,12 @@ hs_err_pid*

.idea
target

# OS generated files
.DS_Store
**/.DS_Store

# Node
node_modules/
**/node_modules/

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ For the versions available, see the [tags on this repository](https://github.com
### ClusterApi
https://github.com/aiven/klaw-cluster-api

## Work in progress

The directory `/coral` contains a React app. It's an ongoing rewrite of the existing Klaw frontend. The app Frontend app is not used in Klaw at the moment.

## Features:

- Topics (approval): Create, Update, Delete, Promote
Expand Down
31 changes: 31 additions & 0 deletions coral/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/jsx-runtime",
"prettier"
],
"overrides": [
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"react",
"@typescript-eslint"
],
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
}
}
13 changes: 13 additions & 0 deletions coral/.husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

FRONTEND_ROOT="coral"
GIT_ROOT=$(git rev-parse --show-toplevel)
STAGED_FILES=$(git diff --staged --name-only)

if echo "$STAGED_FILES" | grep -q "$FRONTEND_ROOT";
then
pnpm --prefix="$GIT_ROOT"/"$FRONTEND_ROOT" lint-staged
pnpm --prefix="$GIT_ROOT"/"$FRONTEND_ROOT" tsc
pnpm --prefix="$GIT_ROOT"/"$FRONTEND_ROOT" test --bail
fi
2 changes: 2 additions & 0 deletions coral/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node-version>=16.0.0<=16.18.0
engine-strict=true
88 changes: 88 additions & 0 deletions coral/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# 🪸 Klaw's new frontend app

- Please be aware of our [Code of Conduct](../CODE_OF_CONDUCT.md) ❤️

## About

`/coral` contains a React app. It's the rewrite of the existing Klaw frontend.

## Installation and usage

ℹ️ Coral uses `pnpm run` as a package manager. Read in their official documentation [how to install](https://pnpm.io/installation) it.

- navigate to this directory
- run `pnpm install`
- run `pnpm dev` to start the frontend app in development mode

### Usage: How to run the app

ℹ️ You can see all our scripts in the [`package.json`](package.json).
You can also run `pnpm` in your console to get a list of all available scripts.

#### Scripts used and what they execute
- `build`: builds the frontend app for production
- `dev`: starts the frontend app for development
- `lint`: runs a code format check and if no error is found, lints the code.
- the linting script does not mutate your code. See [Linting and code formatting](#linting-and-code-formatting) for more info.
- `preview`: builds a preview production build _locally_
- `reformat`: runs the code formatter (prettier) and reformat all code
- `test-dev`: runs all test tests related to changed files in a watch mode
- `test`: runs all tests one time
- `tsc`: runs the TypeScript compiler

## Tech stack

### App development
- TypeScript - 📃 [documentation](https://www.typescriptlang.org/) | 🐙 [repository](https://github.com/microsoft/TypeScript)
- React - 📃 [documentation](https://reactjs.org/docs/getting-started.html) | 🐙 [repository](https://github.com/facebook/react/)
- Vite - 📃 [documentation](https://vitejs.dev/guide/) | 🐙 [repository](https://github.com/vitejs/vite)

### Testing
- Jest - 📃 [documentation](https://jestjs.io/docs/getting-started) | 🐙 [repository](https://github.com/facebook/jest)
- React Testing Library - 📃 [documentation](https://testing-library.com/docs/react-testing-library/intro/) | 🐙 [repository](https://github.com/testing-library/react-testing-library)

📃 You can find more detailed information about testing in our docs for [Frontend Testing](docs/frontend-testing.md).

### Linting and code formatting
How we keep our app's codebase looking consistent and nice 💅🏼

- [Prettier](https://prettier.io/) for code formatting
- [ESlint](https://eslint.org/) and various plugins for linting

The script `lint` runs a prettier check and eslint after. It does not mutate your code in any way. If you want to format your code or let eslint fix it for you, you can run:

1. First: `pnpm reformat` (prettier formatting)
2. After that: `pnpm eslint --fix` (eslint in fix mode)

ℹ️ It's convenient to let prettier and eslint auto-format your code "on save" by your IDE or editor.

## Styling

We use the component library of Aiven's design system:
- 📃 [documentation](https://aiven-ds.netlify.app/)
- the repository is open source, but `private` at the moment

As a rule, please don't use css classes from the design system. All styles should be created by using the existing components and their properties.

__🔄 Work in progress related to styles__
- We plan adding css variables based on the design system's tokens.
- We plan having a custom theme for Klaw. This will be used instead of the Aiven theme.

## Documentation

We've a more detailed document about our thinking about [Docmentation](docs/documentation.md).

### Tip
You can use `alex` ( 📃 [documentation]( https://alexjs.com/) | 🐙 [repository](https://github.com/get-alex/alex)) as an **optional** linting tool. It checks text documents and highlights language that potentially could be insensitive or inconsiderate.

- run it with `pnpm --silent dlx alex` to lint text files.


## More detailed documentation

We provide more documentation on:

- Our commitment to [Accessibility](docs/accessibility.md)
- Detailed overview of the [Directory Structure](docs/directory-structure.md)
- Our thinking about [Docmentation](docs/documentation.md)
- More information about [Frontend Testing](docs/frontend-testing.md)
41 changes: 41 additions & 0 deletions coral/docs/accessibility.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 🏗 🏗 🏗 THIS IS A DRAFT 🏗 🏗 🏗


----


# Accessibility for FE app

🙏 we should aim to reach at least be AA on [WCAG 2.1 standards](https://www.w3.org/WAI/standards-guidelines/wcag/). If we reach AAA and/or are already looking into 2.2. - even better ❤️


## How do we make sure of that?
- we use the aiven component library components
- we use semantic html
- we use native elements where possible
- we do automated accessibility linting and testing
- we do manual testing for new features
- using tools to help us find issues
- using assisitve technology to see how it works for ourselves
- we do usability testing sessions with users that are used to assitive technology
- we collect resources in documentation for developers for best practices


### Automation tools
(tbc)

#### Linting
- eslint-plugin-jsx-a11y
- axe Accessibility Linter

#### Testing
- @axe-core/react

#### Manual testing
- Lighthouse (browser extension)
- axe DevTools - Web Accessibility Testing (browser extension)
- https://wave.webaim.org/extension/ (browser extension)
- qualWeb Accessibility Checker (browser extension)
- https://validator.w3.org/
- https://raw.githubusercontent.com/Heydon/REVENGE.CSS/master/revenge.css

Loading