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

Add frontend implementation for Reviewed! #2

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions session-3/frontend/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
VITE_GRAPHQL_ENDPOINT_HTTP=http://localhost:9000/reviewed
VITE_GRAPHQL_ENDPOINT_WS=ws://localhost:9000/reviewed

# For SSL Enabled endpoints
# VITE_GRAPHQL_ENDPOINT_HTTP=https://localhost:9000/reviewed
# VITE_GRAPHQL_ENDPOINT_WS=wss://localhost:9000/reviewed
23 changes: 23 additions & 0 deletions session-3/frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
62 changes: 62 additions & 0 deletions session-3/frontend/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,63 @@
# Frontend implementation for Reviewed!

## Overview

This is the frontend implementation for Reviewed!. It consists of a React application that works with a Ballerina GraphQL backend. It uses the Apollo Client on the frontend to connect to the GraphQL backend.

## Get Started

There are two ways to instantly serve up the frontend application:

1. Serve the application using NodeJS.

```bash
npx serve dist --single --listen 3000
```

2. Serve the application using Python.

```bash
python -m http.server 3000 --directory dist
```

> Note: URL rewriting is not supported when serving the production build using Python. Also, the contents of ErrorPage.jsx will not render for invalid URLs.

- Open the browser and navigate to: [http://localhost:3000](http://localhost:3000)

## Running the Application in Development Mode

### Prerequisites

Install the following software.

- [Node.js (version v20.12.0)](https://nodejs.org/en/blog/release/v20.12.0)
- [npm (version 10.5.0 or later)](https://www.npmjs.com/package/npm)

### Steps

1. Install the required project dependencies by running the following command.

```bash
npm install
```

2. To change the backend endpoints, update the environment variables in the `.env` file.

```.env
VITE_GRAPHQL_ENDPOINT_HTTP=http://localhost:9000/reviewed
VITE_GRAPHQL_ENDPOINT_WS=ws://localhost:9000/reviewed
```

3. Start the application.

```bash'
npm run dev
```

4. Open the browser and navigate to [http://localhost:3000](http://localhost:3000).

5. To deploy the application, create a production build by running the following command.

```bash
npm run build
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually, I think we can elaborate a bit on the underlying implementation. E.g., we can a screenshot of each page, mention the GraphQL query, any additional processing we do on the response, etc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not required for this first iteration.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
342 changes: 342 additions & 0 deletions session-3/frontend/dist/assets/index-CelfHX13.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions session-3/frontend/dist/assets/index-Cp-0kh0u.css

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

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added session-3/frontend/dist/favicon.ico
Binary file not shown.
18 changes: 18 additions & 0 deletions session-3/frontend/dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Reviewed!</title>
<script type="module" crossorigin src="/assets/index-CelfHX13.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-Cp-0kh0u.css">
</head>

<body>
<div id="root"></div>

</body>

</html>
16 changes: 16 additions & 0 deletions session-3/frontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Reviewed!</title>
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>

</html>