Skip to content

Commit

Permalink
persnickety apostrophes
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomEtc committed Sep 30, 2023
1 parent 330b7b1 commit f9864cd
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 25 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Overview

Takes functionality from our [public website calculator](https://www.rewiringamerica.org/app/ira-calculator) and packages it up in a custom web component built using `lit`. Lit's `Task` library takes care of watching the form parameters for changes
Takes functionality from our [public website calculator](https://www.rewiringamerica.org/app/ira-calculator) and packages it up in a custom web component built using `lit`. Lits `Task` library takes care of watching the form parameters for changes
and fetching data from our API.

**Note:** API keys are required, sign up on our [API homepage](https://www.rewiringamerica.org/api).
Expand All @@ -26,7 +26,7 @@ and fetching data from our API.

For better or worse, using BEM to keep CSS manageable. This may be overkill since LitElement encapsulates the styles for us already.

The CSS font-face does not seem to apply if fonts are loaded by the Shadow DOM's styles, so a separate font stylesheet is provided for these.
The CSS font-face does not seem to apply if fonts are loaded by the Shadow DOMs styles, so a separate font stylesheet is provided for these.

# Hosting

Expand All @@ -41,16 +41,16 @@ Features and content:
- [ ] Switch order of incentives depending on whether credits/rebates are more useful.
- [x] Add currency formatting to the income input element. Using [autonumeric](http://autonumeric.org), which is large.
- [ ] Consider [Inputmask](https://robinherbots.github.io/Inputmask/#/documentation/numeric) in future.
- [x] Use a better tooltip component to ensure tooltips are readable at mobile breakpoints. Trying Shoelace's [tooltip](https://shoelace.style/components/tooltip).
- [ ] Think about how the 'back to calculator' links should work on RA's detail pages ([example](https://www.rewiringamerica.org/app/ira-calculator/information/electrical-panel))
- [x] Use a better tooltip component to ensure tooltips are readable at mobile breakpoints. Trying Shoelaces [tooltip](https://shoelace.style/components/tooltip).
- [ ] Think about how the 'back to calculator' links should work on RAs detail pages ([example](https://www.rewiringamerica.org/app/ira-calculator/information/electrical-panel))
- [ ] Add analytics support (Amplitude events?)
- [ ] Add support for Spanish translations.
- [ ] Send javascript events for calculate, results, project details clicks.

Robustness:

- [x] Take a copy of fonts and serve them from this domain.
- [ ] Port to API v1's calculator endpoint.
- [ ] Port to API v1s calculator endpoint.
- [ ] Add slots to allow customizing the form intro text.
- [x] Add UI tests with Cypress, run in CI.
- [ ] Add unit tests, run in CI.
Expand All @@ -63,7 +63,7 @@ Optimizations:

- [ ] Add support for caching results in localStorage.
- [ ] Add support for showing default list of incentives (from `/api/v0/incentives`).
- [ ] Reuse microcopy from Rewiring America's CMS to avoid duplication between this repo and our website.
- [ ] Reuse microcopy from Rewiring Americas CMS to avoid duplication between this repo and our website.

Roadmap:

Expand All @@ -74,7 +74,7 @@ Roadmap:

Bugs:

- [ ] Clicking the tooltip for Household Income should focus the input. Do we need `delegatesFocus` or do we need to refactor the input into a slot so it's light DOM?
- [ ] Clicking the tooltip for Household Income should focus the input. Do we need `delegatesFocus` or do we need to refactor the input into a slot so its light DOM?
- [ ] Tapping the tooltip on mobile probably shouldn't select the field. Move outside the label maybe?

# References
Expand Down
6 changes: 3 additions & 3 deletions src/api/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ export async function fetchApi(
});
if (response.status >= 400) {
console.error(response);
// statusText isn't always set, but it's a reasonable proxy for a human readable error if it is:
// statusText isn't always set, but its a reasonable proxy for a human readable error if it is:
let message = response.statusText;
try {
const error = await response.json();
console.error(error);
if (error.title && error.detail) {
// Zuplo's API key errors have this form:
// Zuplos API key errors have this form:
message = `${error.title}: ${error.detail}`;
} else if (error.message && error.error) {
// Rewiring America's API errors have this form:
// Rewiring Americas API errors have this form:
message = `${error.error}: ${error.message}`;
}
} catch (e) {
Expand Down
6 changes: 3 additions & 3 deletions src/calculator-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ export const formTemplate = (
const projectField = showProjectField
? html`<div>
<label for="project">
Project you're most interested in
Project youre most interested in
<sl-tooltip
content="Select the project you're most interested in."
content="Select the project youre most interested in."
hoist
>${questionIcon(tooltipSize, tooltipSize)}</sl-tooltip
>
Expand Down Expand Up @@ -167,7 +167,7 @@ export const formTemplate = (
<label for="household_income">
Household income
<sl-tooltip
content="Enter your gross income (income before taxes). Include wages and salary plus other forms of income, including pensions, interest, dividends, and rental income. If you are married and file jointly, include your spouse's income"
content="Enter your gross income (income before taxes). Include wages and salary plus other forms of income, including pensions, interest, dividends, and rental income. If you are married and file jointly, include your spouses income."
hoist
>${questionIcon(tooltipSize, tooltipSize)}</sl-tooltip
>
Expand Down
2 changes: 1 addition & 1 deletion src/calculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class RewiringAmericaCalculator extends LitElement {

private _task = new Task(this, {
// this array of parameters is generated by the `args` function below
// it's formatted with snake_case to make it really easy to throw into URLSearchParams
// its formatted with snake_case to make it really easy to throw into URLSearchParams
task: async ([
zip,
owner_status,
Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ <h1>Rewiring America Embeddable IRA Calculator</h1>
This page is a demonstration of our embeddable calculator, intended for
website owners to add to their own page to help their visitors
understand the electrification incentives offered as part of the
Inflation Reduction Act (IRA). If you're looking to evaluate the impact
Inflation Reduction Act (IRA). If youre looking to evaluate the impact
of IRA electrification incentives for your own home, please use
<a href="https://www.rewiringamerica.org/app/ira-calculator"
>our official IRA Calculator</a
Expand Down
10 changes: 5 additions & 5 deletions src/state-calculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class RewiringAmericaStateCalculator extends LitElement {
*
* Currently the only customization is to display the name of the state.
* TODO: Have a nice error message if you enter a zip/address outside this
* state, if it's defined.
* state, if its defined.
*/
@property({ type: String, attribute: 'state' })
state: string = '';
Expand Down Expand Up @@ -125,7 +125,7 @@ export class RewiringAmericaStateCalculator extends LitElement {
this.zip !== prevZip ||
this._utilitiesTask.status !== TaskStatus.COMPLETE
) {
// This will run _task when it's done.
// This will run _task when its done.
this._utilitiesTask.run();
} else {
this._task.run();
Expand Down Expand Up @@ -162,7 +162,7 @@ export class RewiringAmericaStateCalculator extends LitElement {
}));
},
onComplete: options => {
// Preserve the previous utility selection if it's still available.
// Preserve the previous utility selection if its still available.
if (!options.map(o => o.value).includes(this.utility)) {
this.utility = options[0].value;
}
Expand Down Expand Up @@ -258,8 +258,8 @@ export class RewiringAmericaStateCalculator extends LitElement {
}

/**
* Tell TypeScript that the HTML tag's type signature corresponds to the
* class's type signature.
* Tell TypeScript that the HTML tags type signature corresponds to the
* classs type signature.
*/
declare global {
interface HTMLElementTagNameMap {
Expand Down
4 changes: 2 additions & 2 deletions src/state-incentive-details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ const atAGlanceTemplate = (response: APIResponse) => {
${summaryBoxTemplate(
'Upfront discounts',
`$${response.savings.pos_rebate.toLocaleString()}`,
"Money saved on a project's upfront costs.",
"Money saved on a projects upfront costs.",
)}
${summaryBoxTemplate(
'Rebates',
Expand Down Expand Up @@ -442,7 +442,7 @@ export const stateIncentivesTemplate = (

return html` ${atAGlanceTemplate(response)}
${gridTemplate(
"Incentives you're interested in",
"Incentives youre interested in",
incentivesByProject[selectedProject] ?? [],
[selectedProject],
selectedProject,
Expand Down
4 changes: 2 additions & 2 deletions src/utility-selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ const utilityFormTemplate = (
};

/**
* The state map + utility selector section. They're displayed side-by-side on
* The state map + utility selector section. Theyre displayed side-by-side on
* large and medium layouts, and map above selector on small.
*
* Because the utility selector is outside the main calculator form, changing
* the selection should immediately reload incentives (as opposed to waiting for
* a button press), so there's a callback for it here.
* a button press), so theres a callback for it here.
*/
export const utilitySelectorTemplate = (
stateInfo: StateInfo,
Expand Down
2 changes: 1 addition & 1 deletion src/working-copy.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ <h1>Rewiring America Embeddable IRA Calculator</h1>
This page is a demonstration of our embeddable calculator, intended for
website owners to add to their own page to help their visitors
understand the electrification incentives offered as part of the
Inflation Reduction Act (IRA). If you're looking to evaluate the impact
Inflation Reduction Act (IRA). If youre looking to evaluate the impact
of IRA electrification incentives for your own home, please use
<a href="https://www.rewiringamerica.org/app/ira-calculator"
>our official IRA Calculator</a
Expand Down

0 comments on commit f9864cd

Please sign in to comment.