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

Feature: Modal to allow users to list directly from inventory to CSFloat #288

Open
wants to merge 42 commits into
base: master
Choose a base branch
from

Conversation

IzaakPrats
Copy link

@IzaakPrats IzaakPrats commented Feb 2, 2025

Issue #277 List from Inventory

This PR adds the ability to list items directly on CSFloat from the Steam inventory. Users can create both buy now and auction listings with a streamlined interface.

Features

  • Direct listing creation from Steam inventory
  • Support for both Buy Now and Auction listing types
  • Recommended price fetching from CSFloat*
  • Price adjustment via input or percentage slider
  • Configurable auction duration (1-14 days)
  • Trade hold detection to prevent bad ux
  • Success state with direct links to view listing/stall

Implementation Details

  • Added new FetchRecommendedPrice handler to get price suggestions from CSFloat
  • Added ListItem handler to create listings via CSFloat API
  • Created ListItemModal component with:
    • Buy Now and Auction modes
    • Item tradability validation

Testing

No build / run errors

Screenshot 2025-02-03 at 11 53 22 AM

Buy Now Happy Path

csfloat_buy_now_happy_path.mov

Auction Happy Path

csfloat_auction_happy_path.mov

Not Logged In

csfloat_not_logged_in.mov

Price Fetch Failed

csfloat_cant_fetch_price.mov

@Step7750 Step7750 requested review from Step7750 and GODrums February 3, 2025 23:59
Copy link
Member

@Step7750 Step7750 left a comment

Choose a reason for hiding this comment

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

Thanks for contributing to the CSFloat extension! We appreciate community contributions and definitely wasn't expecting a substantial PR.

I've added a couple comments, some in relation to code style and others for the UX -- it'd be great if we could try to match a similar UI style to either Steam or CSFloat for the model.

@IzaakPrats
Copy link
Author

IzaakPrats commented Feb 4, 2025

Got to most of it today -- will have time tomorrow to address UX/UI issues, CSS organization, and CSFloat auth state checking.

@IzaakPrats
Copy link
Author

IzaakPrats commented Feb 12, 2025

Got caught up with work -- still getting this done. Had issues logging in last night. btw I noticed that the API lists valid auction durations as 1, 3, 5, 7, and 14 but (iirc) the csfloat site only allows for 1, 3, 7, or 14.

Screenshot 2025-02-12 at 5 38 31 PM

Screenshot 2025-02-12 at 5 37 42 PM

Also, ran into an issue with listing prices -- what do you think about including subtotal & sale fees? Is there an easy way to fetch a user's sale fee %?

cc @Step7750

@GODrums
Copy link
Collaborator

GODrums commented Feb 13, 2025

Hey @IzaakPrats,

thank you for the great contribution!

You should be correct regarding the auction options, I believe the API docs are just outdated here.
I personally also really like the idea of explicitly displaying the subtotal & sale fee. The fee is always 2% of the sale price, so you should be able to calculate it locally.

@IzaakPrats IzaakPrats force-pushed the izaak/feature/issue-277 branch from 7ecff97 to dfb9291 Compare February 13, 2025 04:59
@IzaakPrats
Copy link
Author

Got quite a bit done on this. Still need to add auth validation, debug a ux issue where sometimes items won't open the modal, and add a confirmation dialogue. Should be good after that! :)

Also, lmk if there is a better icon i should use instead of the karambit.

Screenshot 2025-02-13 at 12 01 08 AM

@IzaakPrats IzaakPrats requested a review from Step7750 February 14, 2025 21:10
@IzaakPrats
Copy link
Author

Requested review again and updated PR comment with new e2e tests

@IzaakPrats IzaakPrats force-pushed the izaak/feature/issue-277 branch 2 times, most recently from 60657fb to d7c1c4e Compare February 14, 2025 21:59
@GODrums
Copy link
Collaborator

GODrums commented Feb 17, 2025

Really like the current version already!

I do think we should explicitly handle Dopplers though. Instead of using the standard /price-list, which only features the price for the cheapest overall Doppler, we can use the /price-list/doppler-endpoint to get phase-specific prices with the phase_name-attribute.

@IzaakPrats
Copy link
Author

IzaakPrats commented Feb 17, 2025

@GODrums -- nice! didn't know that endpoint existed. got it in.

Before (karambit black pearl):
Screenshot 2025-02-17 at 1 51 46 PM

After (karambit black pearl):
Screenshot 2025-02-17 at 1 48 24 PM

@GODrums
Copy link
Collaborator

GODrums commented Feb 17, 2025

Thank you, looks great!

Just tested it myself and noticed that in some cases the font-family is not applied correctly due to Steam's default CSS, for example the input and button elements still use Steam's original font-family.

We likely have to create a manual rule to overwrite it for these elements.

@GODrums
Copy link
Collaborator

GODrums commented Feb 17, 2025

Another nit:

There seems to be an edge case whenever a user is not signed in to csfloat right now, where the /listings-request returns a 401. In that case the modal seems to be stuck at Loading... - optimally we would have an error case here displaying some sort of warning telling the user to sign in on Csfloat again.
Screenshot 2025-02-17 214351
Screenshot 2025-02-17 214332

We / I can also solve this as follow-up to this PR though.

@IzaakPrats
Copy link
Author

IzaakPrats commented Feb 19, 2025

@GODrums - good catches! got both of those issues handled. Added a css override at the modal content level and made a new way for unauth exceptions to bubble up to the modal.

Screenshot 2025-02-18 at 8 20 57 PM

Copy link
Collaborator

@GODrums GODrums left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for this huge PR!

Tested on Chrome and works.
Tested also on Firefox, but the /listings endpoint doesn't support moz-extension origins yet (@Step7750 should probably be fixed server-sided?)
image

@Step7750
Copy link
Member

Step7750 commented Feb 22, 2025

This is awesome! I'll try to get to re-reviewing this tomorrow -- feel free to ping me if I don't get to it.

@GODrums I can allow-list that endpoint for the Firefox extension, I'll set a reminder before this goes live.

@GODrums GODrums linked an issue Feb 22, 2025 that may be closed by this pull request
Copy link
Member

@Step7750 Step7750 left a comment

Choose a reason for hiding this comment

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

Thank you @IzaakPrats!

I've added a few comments, but we're very close to getting this merged. As mentioned briefly earlier, it's rare to see a quality PR like this from a community contribution -- so thank you again.

@@ -50,4 +52,6 @@ export const HANDLERS_MAP: {[key in RequestType]: RequestHandler<any, any>} = {
[RequestType.FETCH_OWN_INVENTORY]: FetchOwnInventory,
[RequestType.CANCEL_TRADE_OFFER]: CancelTradeOffer,
[RequestType.FETCH_STEAM_TRADES]: FetchSteamTrades,
[RequestType.LIST_ITEM]: ListItem,
Copy link
Member

Choose a reason for hiding this comment

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

IMO, we should make the LIST_ITEM and ListItem scoped with CSFloat since it could also mean listing the item on Steam.

Copy link
Author

Choose a reason for hiding this comment

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

Makes sense but it's kind of already scoped by being in this extension -- not sure this would ever wrap the actual steam listing functionality since listing via extension is only csfloat. Happy to make the change if you think it would help clarify tho

@IzaakPrats IzaakPrats force-pushed the izaak/feature/issue-277 branch from b005282 to 7d4ce04 Compare March 1, 2025 22:25
@IzaakPrats IzaakPrats requested a review from Step7750 March 1, 2025 22:26
@IzaakPrats
Copy link
Author

Got those nits in @Step7750

by the way, do you have logging on extension usage? I'd be curious to know how many people use the extension to list and in the future, how many people use the Search on CSFloat button that go on to purchase.

@IzaakPrats
Copy link
Author

Looks like I missed a few comments. Will address those this week

@IzaakPrats IzaakPrats force-pushed the izaak/feature/issue-277 branch from 7d4ce04 to f12284c Compare March 4, 2025 23:52
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.

List Inventory Item directly on CSFloat
3 participants