Skip to content

amplimindcc/frontend

Repository files navigation

Installation

Windows

Download and install nvm

Download and Install Docker

Linux

Download and Install nvm

Download and install Docker

Mac

Download and install nvm

Download and Install Docker

Setup

  • nvm install 21.7.1

In project folder (/frontend):

  • npm install
  • npm run dev

Translation

Installation/Configuration
  • For VSCode use i18n Ally extension
    • /frontend folder has to be opened folder to apply pre-configured settings for i18n Ally
Using translation
  1. Import translation via import { useTranslation } from 'react-i18next';
  2. Inside component declaration define translation function: const { t } = useTranslation({NAMESPACE/S});
    1. replace {NAMESPACE/S} with e.g. 'main' for single namespace use
    2. replace {NAMESPACE/S} with e.g. ['main', 'admin'] for multiple namespace use
  3. Replace hard-coded string with t({KEY}) (using only one namespace) | t('{KEY}', { ns: '{NAMESPACE}'}) (using more than one namespaces)
    1. replace {KEY} with corresponding key defined in namespace files.
    2. if you are using more than one namespaces in one component:
      1. For the first namespace inside of the array (see Point 2.2.) you don't have to add the namespace. E.g. t('buttonOK') is enough.
      2. If you want to use other namespace than the first, you have to add the namespace. E.g. t('buttonOK', { ns: 'admin' })
  4. For using parametric translations, add the parameter as option (beside ns, if used). E.g. t('userMessage', { ns: 'admin', id: userID })
Manage translations
If namespace already existing
  1. Go to i18n ally extension inside VS Code --> On "Tree" submenu click on + for creating a new key.
  2. Insert a key name.
  3. Insert a translation for english language.
    1. For parametric translations: Replace parameter with following pattern: {{PARAMETER}}. E.g. User with ID {{id}}.
    2. See Using translation --> Point 4 how to use parametric translations.
  4. Select the file you want to store the key-value.
If you want to add a new namespace
  1. Create one new file per language folder. Name the files like you want to name the namespace.
  2. Inside file i18n.ts, import the created files and add the imports to resources.
  3. After that continue with If namespace already existing.

Testing

  • npm test to run all frontend tests

Format using Prettier

  • single document: in VSCode CTRL + SHIFT + P -> Format Document -> choose prettier if prompted
  • whole project: while in frontend folder: npx prettier . --write

Conventions

  • all TypeScript Interfaces should be commented with JSDoc
  • CSS should not be directly edited but compiled from SCSS instead
  • general styling that should apply to all pages and components should always be in theme.scss

Further Reading

Frameworks

local pipeline testing with act (outdated)

use case

Act allows you to run the pipeline locally for debugging. However due to the pipeline committing changes into the project in the current version, the local run will inevitably fail. The details for setting up and running act in this section might be of use again if this changes.

Installation

Windows

Download and Install chocolatey

  • In Admin Powershell:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
  • After the install is finished log out

Download and Install act

  • In Admin Powershell navigate to your project folder (/frontend):
  • choco install act-cli
Linux

Download and Install act

  • curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
Mac

Download and Install act

  • brew install act

Setup

In project folder (/frontend):

  • Make sure Docker is running
  • act
  • Select medium

Use

  • act --job 'test' to trigger the test workflow locally
  • act pull_request to simulate all workflows triggered by pull request locally

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published