This repository contains the frontend for displaying Batten Institute's (and other centers') programs/events on the Darden website via iframe.
Tasks (features/bugs) are managed via GitHub Issues.
The programs data are fetched from Airtable using Netlify functions.
The free Airtable plan is used, which has a limit of 1,000 records per base and 1,000 API requests per month per workspace, and 5 editors per base. The API usage often gets close to the limit, but there's a 30-day grace period if the limit is ever reached.
To set up the project locally for development, follow these steps:
Clone the repository to your local machine.
Navigate to the project directory.
Install the dependencies using npm:
npm install
Install Netlify Cli.
Start the development server:
netlify dev
npm run dev won't work because it won't run the Netlify functions.
Open your browser and go to http://localhost:8888 to view the application.
Set the correct AIRTABLE_TOKEN and GOOGLE_SHEETS_API_KEY environment variables using netlify env:set command or in the Netlify project settings.
The main branch is automatically deployed to Netlify when changes are pushed to the repository.
Deployed to: https://batten-programs.netlify.app/
Netlify is configured to deploy all branches to a unique URL. For example, a branch named 'review' will be deployed to: https://review--batten-programs.netlify.app/
Append the route to see the corresponding page. For example, to see the 'batten-full' page, go to: https://review--batten-programs.netlify.app/batten-full
The list of months to be displayed is fetched from a Google Sheet. This is handled by the src/data/getMonthsToShow.js file.
To change which months are displayed, you need to update the following Google Sheet: https://docs.google.com/spreadsheets/d/1Uc-nT4W7rtyw6TyxM6XHpof5GwmvboArJREdaCCV4P0/edit
Any changes in the sheet will be reflected in the application automatically.
Airtable's free plan has a limit of 1,000 API requests per month per workspace. The Netlify function fetches data from Airtable on each request, which can quickly use up the API limit if the site has high traffic.
To mitigate this, consider implementing caching in the Netlify function to reduce the number of API requests made to Airtable.
A Svelte component is created for each view. The component is then imported into the 'App.svelte' file and the route is defined there.
The routes currently are:
The corresponding components are:
The routes are used to show different views on the Darden website via iframe.
Located in the 'netlify/functions' directory, getdata.js function fetches the programs data from Airtable using Airtable's API.
The Airtable base contains a table named 'Programs' with the following fields: [TODO: List the fields here for reference]