Go to file
2025-03-14 14:07:56 -04:00
.github/workflows fixes 2025-03-11 16:01:53 -04:00
scripts fixes 2025-03-11 16:01:53 -04:00
src ok 2025-03-14 14:07:56 -04:00
.env.example points via supabase 2025-03-11 14:58:39 -04:00
.gitignore ongoing 2025-03-11 13:11:38 -04:00
CLAUDE.md Trigger 2025-03-11 17:06:53 -04:00
next-env.d.ts innit 2025-01-09 12:32:34 -05:00
next.config.mjs fix 2025-01-09 14:57:15 -05:00
package-lock.json more debug 2025-03-11 16:35:34 -04:00
package.json more debug 2025-03-11 16:35:34 -04:00
postcss.config.js innit 2025-01-09 12:32:34 -05:00
README.md points via supabase 2025-03-11 14:58:39 -04:00
supabase-drop-functions.sql ok 2025-03-12 09:25:54 -04:00
supabase-schema-updates.sql fixes 2025-03-12 10:01:34 -04:00
supabase-schema.sql fixes 2025-03-12 10:01:34 -04:00
tailwind.config.ts innit 2025-01-09 12:32:34 -05:00
tsconfig.json auth the whole app 2025-03-11 12:12:48 -04:00

Ranger Portal

This portal template is populated from .env.local

The automation works like this:

  1. Google form - https://forms.gle/kFYjiegnsRDNscja6

Submission triggers the code to run in this GAS app

  1. Google Apps Script - https://script.google.com/u/3/home/projects/18VXOKc_7bvOCCUoif6LMt5tQj7NLqwdmn75eXVc0YxUsYXQ1u3KjR9SA

Running this script hits http://143.198.37.25:3000/deploy with the relevant data

  1. Ranger Backend - https://github.com/mito-systems/ranger-backend

Has two endpoints:

User types

Portal Creator

Anyone who wants a custom portal can use the Google form and receive an e-mail with a link to share as far and wide as they'd like.

End users

Receive links to custom portals and are invited to add data by uploading photographs

Data consumers

Query a data set from any custom portal

Social Login Setup

This application supports social login with Google and GitHub. To set up social login, follow these steps:

  1. Set up environment variables: Update the following variables in your .env.local file:

    # Authentication
    NEXTAUTH_URL=http://localhost:3000
    NEXTAUTH_SECRET=your-nextauth-secret-key-at-least-32-chars
    
    # OAuth Providers
    GOOGLE_CLIENT_ID=your-google-client-id
    GOOGLE_CLIENT_SECRET=your-google-client-secret
    
    GITHUB_CLIENT_ID=your-github-client-id
    GITHUB_CLIENT_SECRET=your-github-client-secret
    
  2. Create OAuth applications:

    For Google:

    • Go to Google Cloud Console
    • Create a new project or select an existing one
    • Navigate to "APIs & Services" > "Credentials"
    • Click "Create Credentials" > "OAuth client ID"
    • Select "Web application" as the application type
    • Add your app's URL to the authorized JavaScript origins (e.g., http://localhost:3000)
    • Add your app's callback URL to the authorized redirect URIs (e.g., http://localhost:3000/api/auth/callback/google)
    • Copy the Client ID and Client Secret to your .env.local file

    For GitHub:

    • Go to GitHub Developer Settings
    • Click on "New OAuth App"
    • Fill in the application details
    • Set the Authorization callback URL to your app's callback URL (e.g., http://localhost:3000/api/auth/callback/github)
    • Copy the Client ID and Client Secret to your .env.local file
  3. Generate a secure NEXTAUTH_SECRET: Run the following command to generate a secure secret:

    openssl rand -base64 32
    

    Copy the output to your .env.local file as the NEXTAUTH_SECRET value.

  4. Install required packages:

    npm install next-auth@4.22.1
    
  5. Restart your application:

    npm run dev
    

Points System Setup with Supabase

This application uses Supabase to track user points for contributing wildlife images.

Setup Instructions

  1. Create a Supabase account at https://supabase.com
  2. Create a new project
  3. Go to the SQL Editor and execute the SQL in supabase-schema.sql to create the necessary tables and functions
  4. Get your project URL and anon key from Settings > API
  5. Add these values to your .env.local file:
NEXT_PUBLIC_SUPABASE_URL=your-project-url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key

Points System Features

  • Users earn 1 point for each successful wildlife image upload
  • Points are displayed on the "My Points" page which shows:
    • Total points accumulated
    • A history of all contributions with images
    • Details about each uploaded image
  • The system prevents duplicate image uploads and point awards
  • Only authenticated users can earn and view points