-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a36c2da
commit aaae079
Showing
17 changed files
with
65 additions
and
52 deletions.
There are no files selected for viewing
21 changes: 8 additions & 13 deletions
21
packages/frontend/src/scripts/forced-actions/perpetual/getFormElements.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,21 @@ | ||
import { FormId } from '../../../view/pages/forced-actions/components/form/ids' | ||
import { makeQuery } from '../../utils/query' | ||
|
||
export type FormElements = ReturnType<typeof getFormElements> | ||
|
||
export function getFormElements() { | ||
function $<T extends HTMLElement>(id: string) { | ||
const element = document.getElementById(id) | ||
if (!element) { | ||
throw new Error(`Cannot find #${id}`) | ||
} | ||
return element as T | ||
} | ||
const { $ } = makeQuery(document.body) | ||
|
||
return { | ||
form: $<HTMLFormElement>(FormId.Form), | ||
amountInput: $<HTMLInputElement>(FormId.AmountInput), | ||
priceInput: document.getElementById(FormId.PriceInput) as | ||
form: $<HTMLFormElement>(`#${FormId.Form}`), | ||
amountInput: $<HTMLInputElement>(`#${FormId.AmountInput}`), | ||
priceInput: document.getElementById(`#${FormId.PriceInput}`) as | ||
| HTMLInputElement | ||
| undefined, | ||
totalInput: document.getElementById(FormId.TotalInput) as | ||
totalInput: document.getElementById(`#${FormId.TotalInput}`) as | ||
| HTMLInputElement | ||
| undefined, | ||
submitButton: $<HTMLButtonElement>(FormId.SubmitButton), | ||
amountErrorView: $(FormId.AmountErrorView), | ||
submitButton: $<HTMLButtonElement>(`#${FormId.SubmitButton}`), | ||
amountErrorView: $(`#${FormId.AmountErrorView}`), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 5 additions & 4 deletions
9
packages/frontend/src/scripts/forced-actions/perpetual/offer/cancelForm.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters