ki-ki-316 / cc-app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Court Canva

Getting Started ✨ ✨

Install dependencies

$ npm i

Start the server

$ npm run dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying src/pages/index.tsx. The page auto-updates as you edit the file.

The src/pages/api directory is mapped to /api/*. Files in this directory are treated as API routes instead of React pages.

Environment Variables

Add a file named .env at the root directory. Copy the .env code from Frontend ENV ticket on notion(Get notion access permission from the development group) and paste it in .env. You can refer to the .env.example file in the directory and repo.

Build for Deploy

$ npm run build
$ npm run export

Run the Production

$ npm run start

Run All Test

$ npm run test:ci

Run Single Test With Watching And Display Coverage

$ npm run test filename --watch --coverage

Project structure

$PROJECT_ROOT
│   # run some command when you commit
├── husky
│   # end-to-end testing
├── cypress
│   #icon
├── public
│
├── src
│   │   # all unit tests
│   ├── tests
│   │   # all images
│   ├── assets
│   │   # react component files
│   ├── components
│   │   # Page layout
│   ├── layouts
│   │   # Page files
│   ├── pages
│   │   # redux(store,reducer,action)
│   ├── store
│   │   # chakra config
│   ├── styles
│   │   # tools
│   ├── utils

Project Tech Stack

Front-end
• Node Version: v16.14
• Framework: Next.js (The React version we are using is 17)
• Scripting Language: Typescript
• 2D Canvas: Konva
• State-Management: Redux-toolkit
• Styling: Chakra-UI, Styled-component
• ApiClient: Axios
• Testing: Jest, React-testing-library
• React Hooks Testing Library
• Code Control: Eslint, Prettier
• Git Hook: Husky,commitlint, lint-staged
Recommended Plugins

Visual Studio Code Editor:

  • Code Spell Checker : A basic spell checker that works well with camelCase code.
  • Gitlens: GitLens simply helps you better understand code. Quickly glimpse into whom, why, and when a line or code block was changed.
  • Prettier: Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.
  • vscode-icons(optional): Manage pull requests and conduct code reviews in your IDE with full source-tree context. Comment on any line, not just the diffs. Use jump-to-definition, your favorite keybindings, and code intelligence with more of your workflow.

Chrome Extensions

  • React Developer Tools : React Developer Tools is a Chrome DevTools extension for the open-source React JavaScript library. It allows you to inspect the React component hierarchies in the Chrome Developer Tools
  • Wappalyzer : Find out the technology stack of any website.

UI Design

Figma: Link

Notion Board

We put our ticket board and other important information in the notion board. Please advise our BA to get access to it.

Code of Conduct 📋

1. Creating New Branches
  • Warning:heavy_exclamation_mark::cop:: No one was allowed to manipulate main branch directly in any way and for any reason. When you get a new ticket and plan to start your work, please create a new branch then start coding. You can create a pull request to make your work able to be reviewed and tested by team and get your code merged after getting enough approvals.
  • Branch Name Example: "feature/cc-0027-a-user-can-view-pro-full-court"
  • Tutorial about branch management: Link
  • It is better to delete your branch after your pull request is approved and your branch have been merged into main branch.
2. Commit Message
# Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

feat: add hat wobble
^--^  ^------------^
|     |
|     +-> Summary in present tense.
|
+-------> Type: chore, docs, feat, fix, refactor, style, or test.

More Examples:

  • feat: (new feature for the user, not a new feature for build script)
  • fix: (bug fix for the user, not a fix to a build script)
  • docs: (changes to the documentation)
  • style: (formatting, missing semi colons, etc; no production code change)
  • refactor: (refactoring production code, eg. renaming a variable)
  • test: (adding missing tests, refactoring tests; no production code change)
  • chore: (updating grunt tasks etc; no production code change)

References:

3. Pull Request
  • Pull Request Title Example: "Feature/cc 0042 a user can log in sign up for my account"
  • Tutorial About How To Create A Pull Request: Link
  • 4. Specific Code Convention
  • Basically we will use double double quotes ""instead of single quotes'' in the front end project.
  • We use full names of the attributes for Css code like marginTop:30px instead of mt: 30px.
  • In terms of indentation, our indentation in the project is two spaces.
    How To Change Indentation in your VS code
  • Please format your code before submitting your work.
  • Frequent Issue Solutions:pill:

    If you find any issues which block you when your are working, please check this list or search on the Internet 🔍 to look for potential solutions. Don't worry if you cannot find it 😆 , just put your questions in the group chat and discuss with our team members and tutors. We will try our best to help you fix it 🎓 .

    Why cannot I start the server?
      1. Read the "Getting Started" section in this document again to make sure your input is correct.
      1. We are using "npm" to manage the packages. If you are using "yarn" instead, please install "npm" and use "npm" in this project.
      1. Please make sure you have the correct .env file in your root directory.
      1. Please make sure you have run "npm i" every time before you are trying to run the project especially after you have pulled others' work from other branches.
      1. Use node -v to check whether your node version is 16. If you are curious about how to have multiple versions in your computer, you may be interested about this 👉 Manage multiple node versions for Mac users:apple:
    Why cannot I commit my work?
      1. Please check whether you followed the correct work flow to commit your work.
        Git Guide About Commit
      1. Please make sure you have the correct .env file in your root directory.
      1. Please make sure you have solved all conflicts before you commit your work.
        How to resolve conflicts in Git
      1. Please make sure your commit message is in correct format. You can check the "Commit Message" section in this document or here.
      1. SWC issue: if you met exceptions about SWC when you are trying to commit your work especially you are using M1 MacBook, please check the following steps to fix it:

        1. Delete node_modules and package-lock.json.
        2. Run npm i -f in your terminal.
        3. Use the package-lock.json existing on the main branch which works perfectly fine to replace the package-lock.json in your directory.
        4. Run npm run pre-commit to check if you have fixed it.

    Enjoy the journey!👏

    About


    Languages

    Language:TypeScript 96.3%Language:JavaScript 3.4%Language:CSS 0.2%Language:Shell 0.1%