-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into justin/project-modal
- Loading branch information
Showing
10 changed files
with
775 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { createClient } from '@supabase/supabase-js'; | ||
|
||
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL as string; | ||
const supabaseKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY as string; | ||
|
||
if (!supabaseUrl || !supabaseKey) { | ||
throw new Error( | ||
'No Supabase environment variables detected, please make sure they are in place!', | ||
); | ||
} | ||
|
||
const supabase = createClient(supabaseUrl, supabaseKey); | ||
|
||
export default supabase; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import supabase from '../createClient'; | ||
|
||
export default async function queryProjects() { | ||
const { data: projects, error } = await supabase.from('Projects').select('*'); | ||
|
||
console.log('PROJECTS', projects, 'ERROR', error); | ||
|
||
return { projects, error }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
'use client'; | ||
|
||
import { useCallback, useState } from 'react'; | ||
import { GoogleMap, useJsApiLoader } from '@react-google-maps/api'; | ||
|
||
const containerStyle = { | ||
width: '700px', | ||
height: '700px', | ||
}; | ||
|
||
const center = { | ||
lat: 40.7128, | ||
lng: -74.006, | ||
}; | ||
|
||
const zoom = 7; | ||
|
||
export default function Map() { | ||
const { isLoaded } = useJsApiLoader({ | ||
id: 'google-map-script', | ||
googleMapsApiKey: process.env.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY as string, | ||
}); | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const [map, setMap] = useState<google.maps.Map | null>(null); | ||
|
||
const onLoad = useCallback((map: google.maps.Map) => { | ||
map.setCenter(center); | ||
map.setZoom(zoom); | ||
setMap(map); | ||
}, []); | ||
|
||
const onUnmount = useCallback(() => { | ||
setMap(null); | ||
}, []); | ||
|
||
return isLoaded ? ( | ||
<GoogleMap | ||
mapContainerStyle={containerStyle} | ||
onLoad={onLoad} | ||
onUnmount={onUnmount} | ||
></GoogleMap> | ||
) : ( | ||
<></> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
'use client'; | ||
|
||
import { CSSProperties, useEffect, useState } from 'react'; | ||
import Image from 'next/image'; | ||
import BPLogo from '@/assets/images/bp-logo.png'; | ||
import queryProjects from '../../api/supabase/queries/query'; | ||
|
||
interface Project { | ||
id: string; | ||
project_name: string; | ||
energy_category: string; | ||
size: number; | ||
developer: string; | ||
longitude: number; | ||
latitude: number; | ||
project_statues: string; | ||
county: string; | ||
town: string; | ||
region: string; | ||
state_senate_district: number; | ||
assembly_district: number; | ||
project_image: string | null; | ||
additional_information: string | null; | ||
key_development_milestones: object | null; | ||
} | ||
|
||
export default function Home() { | ||
const [projects, setProjects] = useState<Project[] | null>(null); | ||
const [error, setError] = useState<string | null>(null); | ||
|
||
useEffect(() => { | ||
queryProjects() | ||
.then(data => { | ||
setProjects(data.projects); | ||
}) | ||
.catch(err => setError(err)); | ||
}, []); | ||
|
||
return ( | ||
<main style={mainStyles}> | ||
<Image style={imageStyles} src={BPLogo} alt="Blueprint Logo" /> | ||
<p>Open up app/page.tsx to get started!</p> | ||
<p> | ||
<b>Projects:</b> | ||
</p> | ||
{projects ? ( | ||
projects?.map(project => { | ||
return <div key={project.id}>{project.project_name}</div>; | ||
}) | ||
) : ( | ||
<div>Loading...</div> | ||
)} | ||
{error ? <div style={errorStyles}>{error}</div> : null} | ||
</main> | ||
); | ||
} | ||
|
||
// CSS styles | ||
|
||
const mainStyles: CSSProperties = { | ||
width: '100%', | ||
height: '100vh', | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}; | ||
|
||
const imageStyles: CSSProperties = { | ||
width: '80px', | ||
height: '80px', | ||
marginBottom: '0.5rem', | ||
}; | ||
|
||
const errorStyles: CSSProperties = { | ||
color: '#D22B2B', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {}; | ||
const nextConfig = { | ||
compiler: { | ||
// Enables the styled-components SWC transform | ||
styledComponents: true, | ||
}, | ||
}; | ||
|
||
export default nextConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.