-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] pull and display all plants (#2)
Co-authored-by: Catherine Tan <[email protected]> Co-authored-by: rachaelch3n <[email protected]> Co-authored-by: Catherine Tan <[email protected]>
- Loading branch information
1 parent
8fe8603
commit 1811a59
Showing
5 changed files
with
86 additions
and
24 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,8 @@ | ||
import { Plant } from '@/types/schema'; | ||
import supabase from '../createClient'; | ||
|
||
export async function getAllPlants(): Promise<Plant[]> { | ||
const { data, error } = await supabase.from('plants').select('*'); | ||
if (error) throw new Error(`Error fetching all plants: ${error.message}`); | ||
return data; | ||
} |
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,60 @@ | ||
'use client'; | ||
|
||
import React from 'react'; | ||
// import FilterDropdown from '@/components/FilterDropdown'; | ||
import { PlantList } from '@/components/PlantList'; | ||
|
||
// interface SeasonalPlantingGuideProps {} | ||
|
||
const SeasonalPlantingGuide = () => { | ||
// hide this for now, will be used in the next PR for dropdown filters | ||
|
||
// const growingSeasonOptions = ['Spring', 'Summer', 'Fall', 'Winter']; | ||
// const harvestSeasonOptions = ['Spring', 'Summer', 'Fall', 'Winter']; | ||
// const plantingTypeOptions = [ | ||
// 'Start Seeds Indoors', | ||
// 'Start Seeds Outdoors', | ||
// 'Plant Seedlings/Transplant Outdoors', | ||
// ]; | ||
|
||
// const [growingSeason, setGrowingSeason] = useState<string>(''); | ||
// const [harvestSeason, setHarvestSeason] = useState<string>(''); | ||
// const [plantingType, setPlantingType] = useState<string>(''); | ||
|
||
return ( | ||
//hide filter dropdowns for now, will be done in another PR | ||
<div> | ||
{/* <FilterDropdown | ||
name="growingSeason" | ||
id="growingSeason" | ||
setStateAction={setGrowingSeason} | ||
options={growingSeasonOptions} | ||
placeholder="Growing Season" | ||
/> | ||
<FilterDropdown | ||
name="harvestSeason" | ||
id="harvestSeason" | ||
setStateAction={setHarvestSeason} | ||
options={harvestSeasonOptions} | ||
placeholder="Harvest Season" | ||
/> | ||
<FilterDropdown | ||
name="plantingType" | ||
id="plantingType" | ||
setStateAction={setPlantingType} | ||
options={plantingTypeOptions} | ||
placeholder="Planting Type" | ||
/> */} | ||
|
||
<PlantList | ||
// growing_season={growingSeason} | ||
// harvest_season={harvestSeason} | ||
// planting_type={plantingType} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SeasonalPlantingGuide; |
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