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

Added funded line, ability to edit groups, and fixed what was ailing … #619

Closed
wants to merge 8 commits into from

Conversation

laredotornado
Copy link
Contributor

…volunteer selection.

Related to this ticket ...

#561

Copy link
Member

@jwu910 jwu910 left a comment

Choose a reason for hiding this comment

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

Still lots of debugging code you left in, we'll need to have them removed. Can you also remove all the lint warnings before we move forward?

);

const props = { classes, mission };

const volunteerEditable = volunteerStatus.includes(mission.status);

useEffect(() => {
document.getElementById("pickup-address-id").value = values.pickUpLocation?.address;
document.getElementById("delivery-address-id").value = values.deliveryLocation?.address;
Copy link
Member

Choose a reason for hiding this comment

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

Im not 100% sure I'm following the logic and reasoning to update this value.

I think what you're trying to achieve can be solved by by these elements setting their values based on state or props instead.

There aren't many cases where we need to use document.getElementById. Majority of use cases can be solved with react element refs.

Copy link
Member

Choose a reason for hiding this comment

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

If you're just trying to set the value of the address input I had previously added the value prop which you can use instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're goign to have to spell it out for me. I don't know how to set the default value of the AddressInputElement without doing the above. Whatever you want me to insert, I'll do it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, @qdozaq instructed me on the proper way to do this, so this shoudl also now be addressed now.

@@ -226,14 +207,28 @@ const MissionEditView = ({ mission, toDetailsView, toListView, volunteers }) =>
date: values.deliveryWindow.startTime,
location: "",
});
console.log("mission tentative:" + mission.tentativeVolunteerUid);
console.log(mission);
Copy link
Member

Choose a reason for hiding this comment

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

Be sure to review your commits before you submit a PR to remove debug console logs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, my bad, this is gone.

@@ -380,6 +374,7 @@ const MissionEditView = ({ mission, toDetailsView, toListView, volunteers }) =>
</Card>
<Card label="Delivery Details" classes={classes}>
<Row Icon={ScheduleIcon} classes={classes}>
{" "}
Copy link
Member

Choose a reason for hiding this comment

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

If we're trying to add spacing to both sides of this input, can we use CSS instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, not sure how that got in there, but it's gone now.

src/app/dashboard/Missions/MissionFundedStatusRow.jsx Outdated Show resolved Hide resolved
import { Box, Container, Grid, Paper } from "@material-ui/core";

const Row = ({ children, Icon }) => {
if (!children) return null;
Copy link
Member

Choose a reason for hiding this comment

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

Row seems to be a general name for this component, but with a pretty specific use case here.

We may not need to even have a separate component for Row because of the nature of the parent it's living in.

In this case, i would just put the JSX from Row inside your return for MissionSFundedStatusRow component.

missionFundedStatusText = "Not Yet Funded";
break;
default:
throw Error("mission funded status not exist", mission.fundedStatus);
Copy link
Member

Choose a reason for hiding this comment

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

Is this an error that should be default?

Can a mission not have a FundedStatus?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know, I was trying to reuse code from someone else. I think this was @mat10tng 's?

Copy link
Collaborator

@mat10tng mat10tng May 22, 2020

Choose a reason for hiding this comment

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

yes, this is an error. A mission must have a funded status

Copy link
Member

Choose a reason for hiding this comment

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

Are we still fixing this?

}
renderOption={(group) => (
<>
<GroupWorkIcon style={{ color: _.randomColor(group.groupDisplayName) }} />{" "}
Copy link
Member

Choose a reason for hiding this comment

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

I don't see random colors in the design for this, is this necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wish I could answer, this was code I was re-using, originally authored by @mat10tng .

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes, we have random color for group, but this using the same seed, so its mean
hash -> specific color. But it is in the design

Copy link
Member

Choose a reason for hiding this comment

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

Oh okay, I couldn't find random colors on the designs. Might have looked at the wrong frames

Comment on lines 21 to 33
switch (mission?.fundedStatus) {
case Mission.FundedStatus.fundedbydonation:
missionFundedStatusText = "Funded By Donation" + fundedDateText;
break;
case Mission.FundedStatus.fundedbyrecipient:
missionFundedStatusText = "Funded By Recipient" + fundedDateText;
break;
case Mission.FundedStatus.fundingnotneeded:
missionFundedStatusText = "Funding Not Needed";
break;
case Mission.FundedStatus.notfunded:
missionFundedStatusText = "Not Yet Funded";
break;
Copy link
Member

Choose a reason for hiding this comment

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

Can we use template literals in stead of + for string concatenations?

If fundedDateText isn't provided properly, you're gonna see Funded By Donation12/12/20 or whatever the date text looks like

Funded by donation: ${fundedDateText} probably be a little cleaner.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

variant="outlined"
InputProps={{ ...params.InputProps, type: "search" }}
<>
{editable ? (
Copy link
Member

Choose a reason for hiding this comment

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

instead of wrapping this whole component in the ternary I think it would be a lot more clear to just put an if statement before hand

if (!editable) {
   return <H6>...
}

return <Autocomplete ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

);

const props = { classes, mission };

const volunteerEditable = volunteerStatus.includes(mission.status);

useEffect(() => {
document.getElementById("pickup-address-id").value = values.pickUpLocation?.address;
document.getElementById("delivery-address-id").value = values.deliveryLocation?.address;
Copy link
Member

Choose a reason for hiding this comment

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

If you're just trying to set the value of the address input I had previously added the value prop which you can use instead

@@ -368,6 +361,7 @@ const MissionEditView = ({ mission, toDetailsView, toListView, volunteers }) =>
<Grid item className={classes.fullWidth}>
<AddressInput
Copy link
Collaborator

Choose a reason for hiding this comment

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

change this to AddressAutocomplete. It should be the better version

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do I have to use taht? It doesn't work. For instnace, it doesn't populate the address wiht a default value like "AddressInput" does ...

Screen Shot 2020-05-22 at 4 43 11 PM

Copy link
Collaborator

Choose a reason for hiding this comment

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

it should work with defaultLocation props. The adressInput component is unfortunately outdated, with incorrect address and no map. You can check the AdressAutocompelete with default props in action by test order a foodbox

Copy link
Member

Choose a reason for hiding this comment

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

For reference this is how it's being use for checkout https://github.com/factn/resilience-app/blob/master/src/app/page/Request/foodbox/DeliveryStep.jsx#L113

idk if the final design has the map view or but I guess we can worry about that later

Copy link
Contributor

Choose a reason for hiding this comment

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

The 'final design' is miles behind. Can we pretty pretty please have the map preview turned on? For both address fields?

Copy link
Member

@qdozaq qdozaq left a comment

Choose a reason for hiding this comment

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

let fundedDateText = mission.fundedDate ? " on " + mission.fundedDate : "";
switch (mission?.fundedStatus) {
case Mission.FundedStatus.fundedbydonation:
missionFundedStatusText = "Funded By Donation ${fundedDateText}";
Copy link
Member

Choose a reason for hiding this comment

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

Incorrect syntax here, these should be in backticks. `` and not quotes.

The linter is catching this warning too


const MissionFundedStatusRow = ({ classes, mission }) => {
let missionFundedStatusText;
let fundedDateText = mission.fundedDate ? " on " + mission.fundedDate : "";
Copy link
Member

Choose a reason for hiding this comment

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

Unused variable?

missionFundedStatusText = "Not Yet Funded";
break;
default:
throw Error("mission funded status not exist", mission.fundedStatus);
Copy link
Member

Choose a reason for hiding this comment

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

Are we still fixing this?

}
renderOption={(group) => (
<>
<GroupWorkIcon style={{ color: _.randomColor(group.groupDisplayName) }} />{" "}
Copy link
Member

Choose a reason for hiding this comment

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

Oh okay, I couldn't find random colors on the designs. Might have looked at the wrong frames

@mat10tng
Copy link
Collaborator

move on to another pr #637

@mat10tng mat10tng closed this May 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants