Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Dashboard Search #61

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions client/src/components/NavBar/BecomeSitter/BecomeSitter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ const BecomeSitter = (): JSX.Element => {
};

const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
setState({
...state,
setState((prevState) => ({
...prevState,
[event.target.name]: event.target.checked,
});
}));
};

const handleSitter = (event: ChangeEvent<HTMLInputElement>) => {
Expand All @@ -49,7 +49,6 @@ const BecomeSitter = (): JSX.Element => {

const handleSubmit = () => {
//TODO: Placeholder for editing profile info to switch between sitter and not a sitter
moffatethan marked this conversation as resolved.
Show resolved Hide resolved
console.log('hello');
setOpen(false);
};

Expand Down
5 changes: 0 additions & 5 deletions client/src/pages/Dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ export default function Dashboard(): JSX.Element {
const { loggedInUser } = useAuth();
const history = useHistory();

const handleSubmit = () => {
console.log('submitted');
};

useEffect(() => {
getAllProfiles(searchValue, startValue, endValue).then((data) => {
setProfiles(data.profiles);
Expand Down Expand Up @@ -64,7 +60,6 @@ export default function Dashboard(): JSX.Element {
endValue={endValue}
/>
</Grid>

{/**TODO:
*
* Currently using mock profiles, need to change to actual list of profiles from api call
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function DashboardSearch({
const initialDate = new Date();

return (
<Grid container justify={'center'} className={classes.root}>
<Grid container justify={'center'}>
<Grid item>
<TextField
id="city"
Expand Down
4 changes: 1 addition & 3 deletions client/src/pages/Dashboard/DashboardSearch/useStyles.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { makeStyles } from '@material-ui/core/styles';

const useStyles = makeStyles((theme) => ({
root: {},
}));
const useStyles = makeStyles((theme) => ({}));

export default useStyles;
6 changes: 1 addition & 5 deletions server/controllers/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ exports.getProfile = asyncHandler(async (req, res, next) => {
exports.getAllProfiles = asyncHandler(async (req, res, next) => {
const { search, start, end } = req.query;

if (search != "" || start != "null" || end != "null") {
if (!search || !start || !end) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

const profiles = await Profile.find({
location: { $regex: search, $options: "i" },
isSitter: true,
Expand All @@ -114,10 +114,6 @@ exports.getAllProfiles = asyncHandler(async (req, res, next) => {
}

const profiles = await Profile.find();
if (!profiles) {
res.status(500);
throw new Error("0 results");
}

res.status(200).json({
profiles,
Expand Down