Skip to content

Commit

Permalink
Add National Parks data
Browse files Browse the repository at this point in the history
  • Loading branch information
schulzetenberg committed Aug 14, 2022
1 parent 27421ca commit d83dd85
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 32 deletions.
9 changes: 4 additions & 5 deletions frontend/src/pages/app-config/app-config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,13 @@ const AppConfig: React.FC = () => {
summary="Collect images of TV shows & movies using TMDB"
/>

{/* <AppCard
<AppCard
appKey="parks"
active={data && data.parks.active}
{...cardDefaultProps}
title="National Parks"
image="/img/mountains.jpg"
summary="Track the United States national parks that have been visited"
/> */}
/>

<AppCard
appKey="states"
Expand Down Expand Up @@ -242,14 +241,14 @@ const AppConfig: React.FC = () => {
summary="Collect public Instagram images"
/>

{/* <AppCard
<AppCard
appKey="allocation"
{...cardDefaultProps}
title="Asset Allocations"
image="/img/stocks.jpg"
lastUpdated={data && data.allocations?.lastUpdated}
summary="Allocation of financial assets"
/> */}
/>
</Grid>
</Box>
</Container>
Expand Down
20 changes: 3 additions & 17 deletions frontend/src/pages/app-settings/parks-settings.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
import React, { useEffect, useState } from 'react';
import { makeStyles } from '@material-ui/core/styles';
import { useForm } from 'react-hook-form';

import { Button, Form, SwitchForm2, TextField2, MultiSelect2 } from '@schulzetenberg/component-library';

const useStyles = makeStyles(() => ({
textCenter: { textAlign: 'center' },
}));
import { Button, Form, MultiSelect2 } from '@schulzetenberg/component-library';

type FormData = {
active: boolean;
visited: { value: string; label: string }[];
options: { value: string; label: string }[];
schedule: string;
cloudinaryUpload: boolean;
};

const ParksSettings: React.FC<{ data: FormData; isLoading: boolean; submit: any }> = ({ data, isLoading, submit }) => {
const classes = useStyles();
const [options, setOptions] = useState<{ value: string; label: string }[]>([]);

const {
Expand All @@ -33,21 +26,14 @@ const ParksSettings: React.FC<{ data: FormData; isLoading: boolean; submit: any
if (data) {
setOptions(data.options);

const { active, visited, schedule, cloudinaryUpload } = data;
reset({ active, visited, schedule, cloudinaryUpload });
const { visited } = data;
reset({ visited });
}
}, [data, reset]);

return (
<Form disabled={formProps.disabled} onSubmit={handleSubmit(submit)}>
<div className={classes.textCenter}>
<SwitchForm2 {...formProps} name="active" label="Active" />
</div>
<TextField2 {...formProps} name="schedule" label="Schedule" type="text" autoFocus />
<MultiSelect2 name="visited" options={options} {...formProps} />
<div className={classes.textCenter}>
<SwitchForm2 {...formProps} name="cloudinaryUpload" label="Upload Images to Cloudinary" />
</div>
<Button {...formProps} type="submit">
Save
</Button>
Expand Down
11 changes: 1 addition & 10 deletions frontend/src/pages/app-settings/states-settings.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
import React, { useEffect, useState } from 'react';
import { makeStyles } from '@material-ui/core/styles';
import { useForm } from 'react-hook-form';

import { Button, Form, SwitchForm2, MultiSelect2 } from '@schulzetenberg/component-library';

const useStyles = makeStyles(() => ({
textCenter: { textAlign: 'center' },
}));
import { Button, Form, MultiSelect2 } from '@schulzetenberg/component-library';

type FormData = {
visited: { value: string; label: string }[];
options: { value: string; label: string }[];
};

const StatesSettings: React.FC<{ data: FormData; isLoading: boolean; submit: any }> = ({ data, isLoading, submit }) => {
const classes = useStyles();
const [options, setOptions] = useState<{ value: string; label: string }[]>([]);

const {
Expand All @@ -37,9 +31,6 @@ const StatesSettings: React.FC<{ data: FormData; isLoading: boolean; submit: any

return (
<Form disabled={formProps.disabled} onSubmit={handleSubmit(submit)}>
<div className={classes.textCenter}>
<SwitchForm2 {...formProps} name="active" label="Active" />
</div>
<MultiSelect2 name="visited" options={options} {...formProps} />
<Button {...formProps} type="submit">
Save
Expand Down

0 comments on commit d83dd85

Please sign in to comment.