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

Release refactor changes to main #247

Merged
merged 191 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from 186 commits
Commits
Show all changes
191 commits
Select commit Hold shift + click to select a range
b140273
Reduced text in 'intro' and 'why' section
Wallen-Ribeiro Oct 16, 2023
21b8dd7
Added banner to About page
Wallen-Ribeiro Nov 27, 2023
2f2e37c
cleaned updates info
Wallen-Ribeiro Jan 26, 2024
d32312a
updated home-page imgs
Wallen-Ribeiro Jan 26, 2024
32f1147
Merge pull request #187 from NIAEFEUP/fix/check-outdated-data
LuisDuarte1 Jan 28, 2024
28e715f
Fixed endpoint path
diogotvf7 Jan 28, 2024
6e16578
Merge pull request #189 from NIAEFEUP/fix/check-outdated-data
LuisDuarte1 Jan 28, 2024
7789d32
added ni-stamp v1
Wallen-Ribeiro Jan 29, 2024
8586c7a
Remove outdated faqs
thePeras Jan 30, 2024
3d7c657
Removed unnecessary console.logs
diogotvf7 Feb 1, 2024
e17b446
Bug on paste fixed!
diogotvf7 Feb 1, 2024
ba22856
Add new FAQS and modify old ones
thePeras Feb 1, 2024
f980d50
Faq default close
thePeras Feb 5, 2024
30ea8cc
Fixed randomizer | Locked button not switching state before switching…
diogotvf7 Feb 6, 2024
77c9d9f
Make an action to wait for netlify deploy
LuisDuarte1 Feb 7, 2024
6d9430f
preview config
jpnsantoss Feb 7, 2024
36183ed
added .env.example
jpnsantoss Feb 7, 2024
714d797
Revert "added .env.example"
jpnsantoss Feb 7, 2024
2def73a
Revert "preview config"
jpnsantoss Feb 7, 2024
3bd1771
revert changes + netlify spa
jpnsantoss Feb 7, 2024
6d28b52
Merge pull request #193 from NIAEFEUP/devops/wait-for-netlify
LuisDuarte1 Feb 7, 2024
5c1919a
Merge pull request #194 from NIAEFEUP/feat/preview
LuisDuarte1 Feb 7, 2024
14c1c4f
New dropdown menu
jpnsantoss Feb 7, 2024
c2be415
Renamed component
jpnsantoss Feb 7, 2024
e9927fc
Added tooltip on buttons
diogotvf7 Feb 7, 2024
41c7911
Fixed small bug
diogotvf7 Feb 7, 2024
d972ac2
Fixed print on dark mode
diogotvf7 Feb 7, 2024
9ae207a
dark mode
jpnsantoss Feb 7, 2024
33857e1
Added tooltips to buttons
diogotvf7 Feb 8, 2024
1794fc3
Updated courses order to mimic sigarra
diogotvf7 Feb 8, 2024
f1a659d
Changed faqs text
diogotvf7 Feb 8, 2024
e9d436e
Merge pull request #192 from NIAEFEUP/fix/faqs
diogotvf7 Feb 8, 2024
69c199b
Fixed lists of components with no key
diogotvf7 Feb 8, 2024
5be066b
Class dropdowns are the same size as the trigger
diogotvf7 Feb 8, 2024
c7c866c
Enhanced responsiveness of class picker
diogotvf7 Feb 8, 2024
5e85eff
Merge pull request #195 from NIAEFEUP/feat/dropdown
diogotvf7 Feb 8, 2024
5da8ce8
Merge branch 'develop' into fix/bug-fixes
diogotvf7 Feb 8, 2024
fe08f99
Removed debug console.logs
diogotvf7 Feb 10, 2024
a901bba
New types file
diogotvf7 Feb 10, 2024
771050b
Started making new course picker
diogotvf7 Feb 11, 2024
1012024
Merge pull request #196 from NIAEFEUP/fix/bug-fixes
thePeras Feb 11, 2024
426b56c
Created major context, started working on courses picker
diogotvf7 Feb 11, 2024
65d25d8
Using old major combobox | majorIndex is now selected major
diogotvf7 Feb 13, 2024
9749547
Displaying couse year tabs and checkboxes
diogotvf7 Feb 13, 2024
207acfa
Progress on course picker
diogotvf7 Feb 13, 2024
d647caf
More progress on course picker
diogotvf7 Feb 14, 2024
668fe60
Almost finishing course picker
diogotvf7 Feb 14, 2024
ee7b2f7
syncing states with local storage
diogotvf7 Feb 18, 2024
1c9bcb8
refactored main features section
Wallen-Ribeiro Feb 19, 2024
bc2bf04
Merged branch 'develop' into 158-about-page
Feb 19, 2024
0ba73c0
Remove course unit UI
diogotvf7 Feb 19, 2024
4f34edc
added description to each feature
Feb 19, 2024
c6a0ec0
Double click on tab to select all course units from a specific year
diogotvf7 Feb 20, 2024
c5334ad
Double click on tab to select all course units from a specific year f…
diogotvf7 Feb 20, 2024
4258fe2
MajorSearchCombobox UI finished
diogotvf7 Feb 21, 2024
24de067
MajorSearchCombobox logic implemented
diogotvf7 Feb 21, 2024
1a28912
MajorSearchCombobox finished
diogotvf7 Feb 21, 2024
99582dc
Bugfixes
diogotvf7 Feb 21, 2024
a8d8033
Fixed small issue on command component
diogotvf7 Feb 26, 2024
63869d9
improved responsive design
Feb 27, 2024
883486e
Fixed small issue on command component
diogotvf7 Feb 26, 2024
ad2675f
Reorganize schedule selector in mobile mode
rubuy-74 Feb 27, 2024
1fccc14
Change mobile design
rubuy-74 Feb 28, 2024
e8db17e
Padding on day of the week bar
diogotvf7 Feb 28, 2024
853fcb4
Remove cursor pointer on features
diogotvf7 Feb 28, 2024
93c28fd
Delete .env
diogotvf7 Feb 28, 2024
b0cb13e
Merge pull request #201 from NIAEFEUP/158-about-page
diogotvf7 Feb 28, 2024
d942326
Merge pull request #204 from NIAEFEUP/feature/change-display-mobile
diogotvf7 Feb 28, 2024
32fb1a2
Removed some bloat
diogotvf7 Feb 28, 2024
a36dae8
added placeholder cards
Mar 12, 2024
1de2c93
Changed the display of the placeholders
diogotvf7 Mar 13, 2024
3752825
Fixed svg issues
diogotvf7 Mar 13, 2024
adae4a0
Fixed some issues on dark mode
diogotvf7 Mar 13, 2024
e10ce98
Course picker size is more consistent
diogotvf7 Mar 13, 2024
d78fd99
Merge pull request #209 from NIAEFEUP/feature/placeholder-cards
diogotvf7 Mar 13, 2024
f16bf85
Commented old code, and new fetch for classes is workinggit add .! :D
diogotvf7 Mar 13, 2024
751717e
schedule toggle
clarapbsousa Mar 19, 2024
b6e6cb9
Checkpoint (tenho soninho)
diogotvf7 Apr 1, 2024
8e07383
Added shine effect on hover
diogotvf7 Apr 2, 2024
e549763
Merge branch 'refactor/states' into schedule__toggle
diogotvf7 Apr 2, 2024
32b96d5
Merge pull request #211 from NIAEFEUP/schedule__toggle
diogotvf7 Apr 2, 2024
00d6f5c
Merge pull request #211 from NIAEFEUP/schedule__toggle
diogotvf7 Apr 2, 2024
c5df8db
Fix options in Dark Mode
rubuy-74 Apr 9, 2024
0014787
Merge branch 'develop' into fix/dark-mode-session-option
rubuy-74 Apr 9, 2024
5d4b284
Progress on ClassSelector!
diogotvf7 Apr 9, 2024
916dbf5
Mooooore progressssss.......
diogotvf7 Apr 9, 2024
567e6fa
Professors filters && Displaying classes and teachers on modal && etc
diogotvf7 Apr 10, 2024
2395de0
progress..............
diogotvf7 Apr 30, 2024
c2fe8b2
Adapting Schedule.tsx to work with endpoint changes
diogotvf7 May 28, 2024
09db788
Merge branch 'refactor/states' of https://github.com/NIAEFEUP/tts-rev…
tomaspalma May 28, 2024
d8a672e
fix: classes not loaded text was shown when classes were loaded
tomaspalma May 28, 2024
211ebc8
fix: displaying information about picked option on class select
tomaspalma May 28, 2024
e18f757
now able to filter by teacher
tomaspalma May 29, 2024
d34db51
able to choose multiple options and saving correctly to local storage
tomaspalma May 30, 2024
ddbcd53
refactored copying with
tomaspalma Jun 4, 2024
4be0a2f
Pasting options working with same selected courses
tomaspalma Jun 4, 2024
e4c4fea
fix: selectedOption index now works correctly
tomaspalma Jun 5, 2024
5e83798
unchecked courses are now imported correctly but other courses not on…
tomaspalma Jun 6, 2024
470e1cd
Make export not throw error
Process-ing Jun 5, 2024
e0c992b
Pass first columns to CSV
Process-ing Jun 5, 2024
1a77873
Export rest of selection information
Process-ing Jun 5, 2024
a6ec079
Remove unused optionsList parameter from export
Process-ing Jun 6, 2024
3cf0184
Small cleanup
Process-ing Jun 6, 2024
044dfcc
refactor: individual course unit now does not return as array from ba…
tomaspalma Jun 7, 2024
f6eff2c
feat: pasting imported courses is now correctly working
tomaspalma Jun 11, 2024
1f82bd8
now able to filter by teacher
tomaspalma May 29, 2024
ace064b
teacher filter now appearing
tomaspalma Jun 11, 2024
bfc4aae
Merge pull request #219 from NIAEFEUP/refactor/export-with-multiple-o…
Process-ing Jun 18, 2024
8da56ce
Merge branch 'refactor/states' of github.com:NIAEFEUP/tts-revamp-fe i…
diogotvf7 Jun 18, 2024
b8e0897
refactor: created courseInfo specific utils method file
tomaspalma Jun 19, 2024
cc4764f
feat: teacher filters
tomaspalma Jun 21, 2024
a690a7a
fix: importing unchecked courses was not working due to commented code
tomaspalma Jun 21, 2024
3039949
Merge branch 'refactor/states' of github.com:NIAEFEUP/tts-revamp-fe i…
diogotvf7 Jul 1, 2024
557d639
Código funcional, parece Haskell
diogotvf7 Jul 1, 2024
1e4223f
chore: remove unecessary folder
tomaspalma Jul 3, 2024
872f028
feat: previewing schedule of class item
tomaspalma Jul 6, 2024
f518a67
Conflicts are now global
diogotvf7 Jul 10, 2024
d7d9548
Create CombinedProvider
Process-ing Jun 27, 2024
b253b98
Integrate MultipleOptions in CombinedProvider
Process-ing Jun 27, 2024
0fa0d92
Optimize getCourseTeachers function and refactor get(Multiple)Options…
Process-ing Jun 30, 2024
dcfc4bd
Use StorageAPI on CombinedProvider
Process-ing Jun 30, 2024
fc547a9
Write StorageAPI functions for the selected option
Process-ing Jun 30, 2024
16efeeb
Use StorageAPI functions for selected option in CombinedProvider
Process-ing Jun 30, 2024
16ffe2c
Make application use only multipleOptions through the context and rem…
Process-ing Jun 30, 2024
8a09552
Fix handling of empty local storage
Process-ing Jul 2, 2024
de5c9c9
Remove all usages of optionsList
Process-ing Jul 3, 2024
58bf20d
Fix schedule visualization
Process-ing Jul 3, 2024
57105b3
Fix linting on fillOptions
Process-ing Jul 3, 2024
133cfc3
Address old TODOs
Process-ing Jul 21, 2024
a491b4e
Move localStorage usage to StorageAPI
Process-ing Jul 22, 2024
902aeec
Move all context state to CombinedProvider
Process-ing Jul 22, 2024
a768776
Merge pull request #223 from NIAEFEUP/refactor/remove-options-list
thePeras Jul 22, 2024
6b7bc39
Conflicts on class selector
diogotvf7 Jul 22, 2024
7985786
fix: class item selected class only updates if not previewing
tomaspalma Jul 22, 2024
e9a3444
Revert "Move all context state to CombinedProvider"
tomaspalma Jul 22, 2024
a832eed
Fixed selected teachers classes options
thePeras Jul 23, 2024
92d6a6e
Merge pull request #228 from NIAEFEUP/fix/classes-options-and-seleted…
thePeras Jul 23, 2024
ac5c8a9
added the updated about-us page since it disappeared from this branch
Jul 30, 2024
0b09dec
Merge branch 'refactor/states' into refactor/schedule
tomaspalma Jul 30, 2024
0c074db
Merge pull request #227 from NIAEFEUP/refactor/schedule
thePeras Jul 31, 2024
eb15482
Merge pull request #229 from NIAEFEUP/about-us
thePeras Jul 31, 2024
2e9b0a7
fix: class fetching on picked courses is without race conditions
tomaspalma Aug 1, 2024
5b886da
Merge pull request #231 from NIAEFEUP/refactor/pickedcourses-class-fe…
thePeras Aug 1, 2024
06a894c
Only deletions :scissors:
thePeras Aug 2, 2024
a7a5731
Fix emojies on chrome and .map error when no backend
thePeras Aug 3, 2024
d89a505
chore: removed stranded unecessary console.logs
tomaspalma Aug 6, 2024
435b76d
Fix faqs and dark theme buttons
thePeras Aug 6, 2024
b3f6240
Merge pull request #235 from NIAEFEUP/fix/faqs2
tomaspalma Aug 6, 2024
2f61382
Merge pull request #198 from NIAEFEUP/refactor/states
tomaspalma Aug 6, 2024
b9c5db6
Merge branch 'develop' into fix/dark-mode-session-option
tomaspalma Aug 7, 2024
94a8601
Merge pull request #212 from NIAEFEUP/fix/dark-mode-session-option
tomaspalma Aug 7, 2024
799e2c4
fix: preview not null when class selected
tomaspalma Aug 7, 2024
12295e2
Setup plausible and custom event for selected major
thePeras Aug 7, 2024
663c92c
Merge pull request #240 from NIAEFEUP/fix/preview-not-null-when-class…
thePeras Aug 7, 2024
1c2fd23
refactor: improved class fetching logic by separating states
tomaspalma Aug 5, 2024
1dc20f8
fix: when year classes are chosen, the picked classes are not overriden
tomaspalma Aug 8, 2024
5505b47
chore: remove useswr revalidation from course units
tomaspalma Aug 8, 2024
87f5e1d
Track faculty on major select
thePeras Aug 8, 2024
bce94a4
Merge pull request #242 from NIAEFEUP/setup/plausible
thePeras Aug 8, 2024
21799ed
refactor: changed build system from cra to vite
tomaspalma Aug 6, 2024
5e9ad5b
Merge branch 'develop' into refactor/improve-course-class-fetching
tomaspalma Aug 8, 2024
4083218
feat: concurrently execute promises to get course classes
tomaspalma Aug 8, 2024
cc84c6c
chore: added easy way to run frontend in production
tomaspalma Aug 8, 2024
d206c85
Merge pull request #238 from NIAEFEUP/refactor/improve-course-class-f…
tomaspalma Aug 9, 2024
a50220b
Fix problem with sortablejs
thePeras Aug 9, 2024
de7b769
chore: update README with new steps for running the project
tomaspalma Aug 9, 2024
ff38e65
fix: use currentTarget to interact with elemenet event handler attach…
tomaspalma Aug 9, 2024
cae4a31
chore: dev.sh can run without .env.production present
tomaspalma Aug 9, 2024
9d3fef6
Merge branch 'develop' into refactor/vite
tomaspalma Aug 9, 2024
e3f5059
chore: add build.sh to build dev and prod with less verbosity
tomaspalma Aug 9, 2024
4090bef
Merge pull request #239 from NIAEFEUP/refactor/vite
tomaspalma Aug 9, 2024
1809252
chore: prepare for niployments
limwa Aug 13, 2024
5935472
fix: use correct variable
limwa Aug 13, 2024
351efe3
fix: typo
limwa Aug 13, 2024
326f8ec
fix: use multiline string for lists in yaml
limwa Aug 13, 2024
e4bddd4
ci: add staging environment
limwa Aug 14, 2024
1d7b230
Merge pull request #243 from NIAEFEUP/chore/prepare-for-niployments
tomaspalma Aug 14, 2024
511fb19
refactor: course api year is now dynamic
tomaspalma Aug 13, 2024
cc15919
Merge pull request #245 from NIAEFEUP/refactor/dynamic-school-year
tomaspalma Aug 14, 2024
ce87ecb
fix: picked courses are now being correctly stored
tomaspalma Aug 16, 2024
130c297
Merge pull request #248 from NIAEFEUP/fix/correctly-store-picked-courses
tomaspalma Aug 17, 2024
f60205d
fix: ghost conflicts on class hover
tomaspalma Aug 17, 2024
2c22f8f
Simplify conflict condition
Process-ing Aug 20, 2024
b843ae0
Merge pull request #249 from NIAEFEUP/fix/ghost-conflicts-on-class-hover
tomaspalma Aug 21, 2024
17bd785
fix search bug when major was null
thePeras Aug 21, 2024
9b7ab57
Merge pull request #253 from NIAEFEUP/fix/search-major-bug
thePeras Aug 21, 2024
0b99744
UI improvements, fix bug and add redirect on /
thePeras Aug 23, 2024
976708f
chore: remove uncessary console.log
tomaspalma Aug 23, 2024
ab86239
Merge pull request #254 from NIAEFEUP/ui/little-improvements
thePeras Aug 24, 2024
18fbb7e
fix: <Schedule> now appearing on smaller screens
tomaspalma Aug 24, 2024
6ea60dc
Merge pull request #256 from NIAEFEUP/fix/schedule-not-appearing-mobile
tomaspalma Aug 24, 2024
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
12 changes: 7 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
REACT_APP_PROD=0
REACT_APP_RELEASE_DATE=2023-01-27
VITE_APP_PROD=0
VITE_APP_RELEASE_DATE=2023-01-27
PORT=3100
REACT_APP_SEMESTER=
REACT_APP_SITE_TITLE=
REACT_APP_BACKEND_URL=
VITE_APP_PLAUSIBLE_DOMAIN=
VITE_APP_PLAUSIBLE_HOST=
VITE_APP_SEMESTER=
VITE_APP_SITE_TITLE=
VITE_APP_BACKEND_URL=
16 changes: 16 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
on:
push:
branches: [develop]
jobs:
deploy:
name: "Deploy to netlify"
runs-on: ubuntu-latest
steps:
- name: Wait for the Netlify Preview
uses: kamranayub/[email protected]
id: waitForNetlify
with:
site_name: 'tts-fe-preview'
max_timeout: 300 # 5 minutes
env:
NETLIFY_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
25 changes: 25 additions & 0 deletions .github/workflows/niployments.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Deploy

on:
push:
branches:
- main
- develop

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Upload to NIployments register
uses: NIAEFEUP/[email protected]
with:
docker_dockerfile: Dockerfile
docker_context: .
docker_target: prod
docker_build_args: |
TTS_FE_VARS_METHOD=content-var
TTS_FE_VARS_CONTENT=${{ secrets.TTS_FE_VARS_CONTENT }}
NIPLOYMENTS_REGISTRY_URL: ${{ vars.NIPLOYMENTS_REGISTRY_URL }}
NIPLOYMENTS_REGISTRY_USERNAME: ${{ vars.NIPLOYMENTS_REGISTRY_USERNAME }}
NIPLOYMENTS_REGISTRY_PASSWORD: ${{ secrets.NIPLOYMENTS_REGISTRY_PASSWORD }}
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
# misc
.DS_Store
.env
.env.production
.vscode/

dist/

npm-debug.log*
yarn-debug.log*
yarn-error.log*

.github/workflows/github-actions.yaml
37 changes: 34 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM node:16-alpine3.12
ARG TTS_FE_VARS_METHOD=dotenv

# build
FROM node:21-alpine3.19 AS build

RUN mkdir -p /usr/src/tts-fe
WORKDIR /usr/src/tts-fe
Expand All @@ -7,12 +10,40 @@ COPY .*rc ./
COPY *.json ./
COPY .prettier* ./
COPY *.config.js ./
COPY *.config.ts ./

RUN npm install -g nodemon
RUN npm install

COPY public/ public/
COPY src/ src/
COPY index.html ./

# dev
FROM build AS dev

EXPOSE $PORT
CMD ["nodemon", "start"]

CMD ["npm", "run", "dev"]

# prod-build-with-dotenv
FROM build AS prod-build-with-dotenv

ARG TTS_FE_DOTENV_FILE=.env.production
COPY ${TTS_DOTENV_FILE} .env.production

# prod-build-with-var
FROM build AS prod-build-with-content-var

ARG TTS_FE_VARS_CONTENT
RUN echo "${TTS_FE_VARS_CONTENT}" | base64 -d > .env.production

# prod-build
FROM prod-build-with-${TTS_FE_VARS_METHOD} AS prod-build
RUN npm run build

# prod
FROM nginx:alpine AS prod

COPY --from=prod-build /usr/src/tts-fe/build /usr/share/nginx/html
COPY nginx.tts.conf /etc/nginx/conf.d/default.conf

140 changes: 128 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
<p align="center">
<h3 align="center"> TTS frontend </h3>
<p align="center"> Ordinary movie list rating built with react and bootstrap </p>
<h3 align="center"> TimeTableScheduler - Frontend </h3>
<p align="center"> A platform where students can experiment with the possible combination of schedule options they can pick at the start of the semester </p>
<p align="center">
<a href="https://reactjs.org/">
<img src="https://img.shields.io/badge/react-v17.0.1-inactive&?style=for-the-badge&logo=react" alt="frontend-dev-react">
<img src="https://img.shields.io/badge/react-v18.2-inactive&?style=for-the-badge&logo=react" alt="frontend-dev-react">
</a>
<a href="https://nodejs.com/">
<img src="https://img.shields.io/badge/nodejs-v16-red&?style=for-the-badge&logo=node.js" alt="nodejs">
<img src="https://img.shields.io/badge/nodejs-v21-red&?style=for-the-badge&logo=node.js" alt="nodejs">
</a>
<a href="https://tailwindcss.com">
<img src="https://img.shields.io/badge/tailwindcss-v3.4.1-red&?style=for-the-badge&logo=tailwindcss" alt="tailwindcss">
</a>
<a href="https://vitejs.dev">
<img src="https://img.shields.io/badge/vite-v4.3.1-red&?style=for-the-badge&logo=vite" alt="vite">
</a>
<a href="https://ui.shadcn.com/">
<img src="https://img.shields.io/badge/shadcn/ui--red&?style=for-the-badge&logo=shadcnui" alt="vite">
</a>
</p>
</p>

Expand All @@ -16,31 +25,138 @@ Made with :heart: by NIAEFEUP.

# Installation

## Dependencies
In order to run this project, you need to have [Docker](https://www.docker.com/).

To run this project you must have installed:
# Brief explanation of used vite commands

- [`docker`](https://www.docker.com/)
- [`docker compose`](https://www.docker.com/)
## `npm run dev`

## How to run
This is the command that should be used if you do not want to use docker and want to run a development server.

Before running this you should have previously ran `npm install`.

## `npm run build`

It builds the react application by generating static files that would be a lot like what a website would look like if no frameworks were used.

It greatly minifies the files and reduces the number of them, making a way better experience for the user.

Before running this you should have previously ran `npm install`.

## `npm run preview`

This allows us to preview what the production build will look like but `Vite` does not recommend at all using this in the production image at all.

# Running the project

In local development, after you run the project you can access it at `localhost:3100/tts`. If you just go to `localhost:3100/` you will be greeted by a blank screen.

## Docker

This is the recommended approach since it uniformizes the way the application behaves since the developers do not have the same computer hardware nor the same operating system.

### Development

Firstly, you have to create an `.env` file in order for the app to receive environment variables.

```bash
cp .env.example .env
```

Then, to build the application run:

```bash
./build.sh dev

```
Or directly with `Docker` (although `build.sh` also uses docker)

```bash
docker compose build tts-frontend
```

After build, run to execute:

```bash
./dev.sh
```

If the script is not able to be executed you may have to change its permissions in order for you to have execution permission (`x`).

```bash
chmod u+x ./dev.sh
```

To stop the container:

```bash
docker-compose down
```

After executing the application, open your browser at: `localhost:3100`

### Production

In order to run the production build, we need to use the `tts-frontend-prod` container instead of the `tts-frontend` one.

In the production build we are serving a static page with minified html, css and javascript files, greatly reducing the load of the page.

Firstly, you have to create an `.env` file in order for the app to receive environment variables.

```bash
cp .env.example .env
```

Internally, when the production build runs with vite, it creates an `.env.production` file from the `.env` file to be used by the `vite build` command. This was done to ease the development process, since running `./dev.sh` complained that the `.env.production` was not found.

To build the application run:

```bash
docker-compose build
./build.sh prod
```

Or directly with `Docker` (although `build.sh` also uses docker)

```bash
docker compose build tts-frontend-prod
```

After build, run to execute:

```bash
docker-compose up
./prod.sh
```

If the script is not able to be executed you may have to change its permissions in order for you to have execution permission (`x`).

```bash
chmod u+x ./prod.sh
```

To stop the container:

```bash
docker-compose down
```
## Baremetal with `npm`


```bash
npm install
npm run dev
```

After executing the application, open your browser at: `localhost:3000`
In case you have problems with this commands you may run

```bash
rm -rf node_modules
rm package-lock.json
```

And then try the previous commands (`npm install` and `npm run dev` again).

In case you want to preview the production build you can run

```bash
npm run preview
```
10 changes: 10 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

case "$1" in
"dev")
docker compose build tts-frontend $2
;;
"prod")
docker compose build tts-frontend-prod $2
;;
esac
4 changes: 4 additions & 0 deletions dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
set -e # abort script if any command fails

docker compose up $1 tts-frontend
17 changes: 15 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
version: '3'
services:
tts-frontend:
container_name: tts_frontend
build:
context: .
target: dev
volumes:
- ./src:/usr/src/tts-fe/src
- ./public:/usr/src/tts-fe/public
ports:
- 3100:3000
- 3100:3100
env_file:
- .env

tts-frontend-prod:
container_name: tts_frontend_prod
build:
context: .
target: prod
args:
- TTS_FE_VARS_METHOD=dotenv
- TTS_FE_DOTENV_FILE=.env
volumes:
- ./src:/usr/src/tts-fe/src
- ./public:/usr/src/tts-fe/public
ports:
- 3100:80
9 changes: 6 additions & 3 deletions public/index.html → index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#b33636" />
<meta name="description" content="NIAEFEUP | TimeTableScheduler" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="apple-touch-icon" href="/logo192.png" />

<!-- Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
Expand All @@ -19,12 +19,15 @@
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;500;600;700;800;900&display=swap"
rel="stylesheet"
/>
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />

<link rel="manifest" href="/manifest.json" />
<title>NIAEFEUP | TimeTableScheduler</title>
</head>

<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>

<script type="module" src="/src/index.tsx"></script>
</body>
</html>
4 changes: 4 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
Loading
Loading