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

Refactor: Frontend modified to adapt to api change, Authentication flow change, Add card to PDF feature, and CI/CD updates #20

Merged
merged 9 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ jobs:
build_and_deploy_job:
runs-on: ubuntu-latest
name: Build and Deploy Job
env:
VITE_API_BASEURL: ${{ github.ref == 'refs/heads/production' && secrets.VITE_API_BASEURL_PRODUCTION || secrets.VITE_API_BASEURL_STAGING }}
VITE_CLIENT_ID: ${{ secrets.VITE_CLIENT_ID }}
VITE_AUTHORITY: ${{ secrets.VITE_AUTHORITY }}
VITE_CLIENT_SECRET: ${{ secrets.CLIENT_SECRET_FOR_MSAL }}
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -24,7 +29,4 @@ jobs:
app_location: "/" # App source code path
api_location: "" # Api source code path - optional
output_location: "build" # Built app content directory - optional
production_branch: "production"
access_token_for_api: ${{ secrets.ACCESS_CODE_FOR_API }}
redirect_uri_for_msal: ${{ secrets.REDIRECT_URI_FOR_MSAL }}
client_secret_for_msal: ${{ secrets.CLIENT_SECRET_FOR_MSAL }}
production_branch: "production"
168 changes: 132 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"d3-scale": "^4.0.2",
"lodash.remove": "^4.7.0",
"lodash.sortby": "^4.7.0",
"qs": "^6.13.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.8.2",
Expand All @@ -35,6 +36,7 @@
"@types/d3-force": "^3.0.4",
"@types/d3-scale": "^4.0.3",
"@types/node": "^20.3.1",
"@types/qs": "^6.9.16",
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"@typescript-eslint/eslint-plugin": "^5.51.0",
Expand Down
File renamed without changes.
Binary file added public/assets/UNDP-hero-image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
19 changes: 8 additions & 11 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Future Trends and Signals System (FTSS)

[![Azure Static Web Apps CI/CD](https://github.com/UNDP-Data/fe-signals-and-trends/actions/workflows/azure-static-web-apps-thankful-forest-05a90a303.yml/badge.svg)](https://github.com/UNDP-Data/fe-signals-and-trends/actions/workflows/azure-static-web-apps-thankful-forest-05a90a303.yml)

The [Future Trends and Signals System](https://signals.data.undp.org) captures signals of change noticed across UNDP, and identifies the trends emerging – helping us all make stronger, more future-aware decisions. This repository hosts the codebase for the front-end application written in React.

## Table of Contents
Expand Down Expand Up @@ -60,20 +63,14 @@ npm install

To start the project locally, you can run `npm run dev` in the project folder in terminal or command prompt. This will run the app in development mode. Open [http://localhost:5173/](http://localhost:5173/) to view it in the browser. The page will reload if you make edits. You will also see any lint errors in the console.

To deploy locally successfully you will need to make some changes to the `Constants.tsx`:

- `export const WEB_ADDRESS = 'https://signals.data.undp.org/';` to `export const WEB_ADDRESS = './';`
- `export const API_ACCESS_TOKEN = process.env.INPUT_ACCESS_TOKEN_FOR_API';` to `export const API_ACCESS_TOKEN = import.meta.env.VITE_ACCESS_CODE`
- `export const REDIRECT_URL = process.env.INPUT_REDIRECT_URI_FOR_MSAL;` to `export const REDIRECT_URL = import.meta.env.VITE_REDIRECT_URL;`

These changes are only required for local deployment. For production, you will need to keep the value same.

Also you will need a `.env.local` file in the root folder. the `env` file would require the following variable and values
You will need a `.env.local` file in the root folder. the `env` file would require the following variable and values

```
VITE_API_LINK=https://signals-and-trends-api.azurewebsites.net/v1/
VITE_ACCESS_CODE={{contact the team for API secret}}
VITE_REDIRECT_URL=http://localhost:5173/
VITE_AUTHORITY=https://login.microsoftonline.com/{{contact the team for the complete URL}}
VITE_CLIENT_ID={{contact the team forClient ID}}
VITE_API_BASEURL=https://ftss-api-dev.azurewebsites.net/
```

### Tooling Setup
Expand All @@ -96,7 +93,7 @@ The application interfaces with the back-end API. See the [documentation](https:
The application CI/CD to Azure Static Web App and automatically deployed on changes to `production` or `staging`.

- `production` is deployed to the [production environment](https://signals.data.undp.org).
- `staging` is deployed to the [staging environment]() (TBA).
- `staging` is deployed to the [staging environment](https://thankful-forest-05a90a303-staging.westeurope.3.azurestaticapps.net).

## Contributing

Expand Down
Loading
Loading