Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bacalj committed Aug 8, 2024
1 parent 0c290c1 commit 5e36f9f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const App: React.FC = () => {
dayOfYear={dayOfYear}
location={location}
setDayOfYear={setDayOfYear}
userLocations={locations}
locations={locations}
/>
</div>
</div>
Expand Down
15 changes: 1 addition & 14 deletions src/components/location-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,9 @@ export const LocationTab: React.FC<LocationTabProps> = ({
const locationExists = locations.some(item =>
item.latitude === location?.latitude && item.longitude === location.longitude
);
// if we already have the location or not all required fields are filled out, return
if (locationExists || !latitude || !longitude) return;

// otherwise, get the data and set the locations
// if the location does not already exist, and we have params, get the data
const tableCreated = await getDayLengthData(Number(latitude), Number(longitude), location);
if (tableCreated?.success) {
const uniqeLocations = await getUniqueLocationsInCodapData();
Expand Down Expand Up @@ -162,18 +161,6 @@ export const LocationTab: React.FC<LocationTabProps> = ({
Get Data
</button>
</div>
{ locations && locations.length > 0 && (
<div className="plugin-row user-locations">
<label>User Locations</label>
<ul>
{locations.map((loc, i) => (
<li key={i}>
{loc.name} ({loc.latitude}, {loc.longitude})
</li>
))}
</ul>
</div>
)}
</div>
);
};
4 changes: 2 additions & 2 deletions src/components/simulation-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface SimulationTabProps {
longitude: string;
dayOfYear: string;
location: ILocation | null;
userLocations: ILocation[];
locations: ILocation[];
setDayOfYear: (day: string) => void;
}

Expand All @@ -19,7 +19,7 @@ export const SimulationTab: React.FC<SimulationTabProps> = ({
dayOfYear,
setDayOfYear,
location,
userLocations
locations
}) => {

return (
Expand Down

0 comments on commit 5e36f9f

Please sign in to comment.