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

Allow scrolling outstanding orders #47

Conversation

JohnPhamous
Copy link
Contributor

@JohnPhamous JohnPhamous commented Jan 3, 2025

Context: https://sfcompute.slack.com/archives/C079B9UE2LE/p1735947098013759

This PR also adds a prettier config. A bunch of files were changed because formatting was applied. Should review these 2 commits that introduce functional changes

  1. 6d59715
  2. ccb97c3

No semantic changes made
Since we're adding interactivity (scrolling) to the orders, we want to exit the process based on user action instead of after command is finished running
@JohnPhamous JohnPhamous requested review from Flaque and Sladuca January 3, 2025 23:38
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR primarily adds scrolling functionality to the orders list view and implements consistent code formatting across the codebase.

  • Added ScrollArea component in src/lib/orders/OrderDisplay.tsx for keyboard-navigable order list viewing
  • Implemented tabbed filtering (all/buy/sell) for orders display with improved date/time formatting
  • Added sorting by start time in ascending order for orders list in src/lib/orders/index.tsx
  • Added .prettierrc configuration file to standardize code formatting rules project-wide
  • Added local development setup instructions in README.md for contributor onboarding

💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!

31 file(s) reviewed, 25 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines 8 to 10
const response = await fetch(
"https://raw.githubusercontent.com/sfcompute/cli/refs/heads/main/package.json",
"https://raw.githubusercontent.com/sfcompute/cli/refs/heads/main/package.json"
);
Copy link

Choose a reason for hiding this comment

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

style: consider using a constant for the GitHub URL to make it more maintainable and reusable across the codebase

Comment on lines +24 to +25
- Install dependencies `deno install`
- Use same mental model as `npm install`
Copy link

Choose a reason for hiding this comment

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

logic: the deno install command is incorrect - Deno uses deno cache to install dependencies. Also, the npm mental model comparison may be confusing since Deno handles dependencies differently

- Install [Deno](https://docs.deno.com/runtime/)
- Install dependencies `deno install`
- Use same mental model as `npm install`
- Auth your CLI with `deno run prod login`
Copy link

Choose a reason for hiding this comment

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

logic: missing prerequisite step to set up local environment variables or configuration before running login

Comment on lines +32 to +33
- `deno run devv` to test against local API
- `deno run prod` to test against production API
Copy link

Choose a reason for hiding this comment

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

syntax: typo in command - devv should be dev based on the codebase

- Test changes with
- `deno run devv` to test against local API
- `deno run prod` to test against production API
- The `deno run <env>` is an alias to the user facing `sf` command. So if you wanted to run `sf login` locally against the local API, run `deno run devv login`
Copy link

Choose a reason for hiding this comment

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

syntax: example is inconsistent - uses devv when it should be dev to match the command above

Comment on lines 113 to 118
const date = epochToDate(Number.parseInt(epochTimestamp));
console.log(
`${colorDiffedEpochs[i]} | ${
chalk.yellow(
dayjs(date).format("hh:mm A MM-DD-YYYY"),
)
} Local`,
`${colorDiffedEpochs[i]} | ${chalk.yellow(
dayjs(date).format("hh:mm A MM-DD-YYYY")
)} Local`
);
Copy link

Choose a reason for hiding this comment

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

logic: parsing epoch timestamps without validation could cause runtime errors if invalid strings are provided

@@ -32,9 +32,9 @@ export function registerSell(program: Command) {
.option(
"-f, --flags <flags>",
"Specify additional flags as JSON",
JSON.parse,
JSON.parse
Copy link

Choose a reason for hiding this comment

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

logic: JSON.parse used directly without try/catch could crash on invalid JSON input

@@ -84,15 +84,14 @@ async function placeSellOrder(options: {

if (contract?.status === "pending") {
Copy link

Choose a reason for hiding this comment

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

style: optional chaining on contract?.status is redundant since contract existence was already checked

const spinner = ora();

if (version) {
spinner.start(`Checking if version ${version} exists`);
const url =
`https://github.com/sfcompute/cli/archive/refs/tags/${version}.zip`;
const url = `https://github.com/sfcompute/cli/archive/refs/tags/${version}.zip`;
const response = await fetch(url, { method: "HEAD" });
Copy link

Choose a reason for hiding this comment

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

logic: no error handling for network failures when checking version - wrap in try/catch

Comment on lines 26 to 28
const scriptResponse = await fetch(
"https://www.sfcompute.com/cli/install",
"https://www.sfcompute.com/cli/install"
);
Copy link

Choose a reason for hiding this comment

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

style: no timeout set for fetch request - could hang indefinitely if server is unresponsive

@JohnPhamous JohnPhamous merged commit 04dbdb5 into main Jan 4, 2025
1 check passed
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.

1 participant