extension icon indicating copy to clipboard operation
extension copied to clipboard

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

Open IzaakPrats opened this issue 11 months ago • 10 comments

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

https://github.com/user-attachments/assets/10c545d5-630d-4ec3-a4f6-7088acc5e2a2

Auction Happy Path

https://github.com/user-attachments/assets/de527c64-7c3c-4759-b5ab-772462bc1dec

Not Logged In

https://github.com/user-attachments/assets/4666843d-bcf1-40cd-be85-3ed59b3e19ff

Price Fetch Failed

https://github.com/user-attachments/assets/e12cab39-52fc-47a5-9909-8576253bee4c

IzaakPrats avatar Feb 02 '25 00:02 IzaakPrats

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

IzaakPrats avatar Feb 04 '25 06:02 IzaakPrats

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

IzaakPrats avatar Feb 12 '25 23:02 IzaakPrats

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.

GODrums avatar Feb 13 '25 03:02 GODrums

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 avatar Feb 13 '25 05:02 IzaakPrats

Requested review again and updated PR comment with new e2e tests

IzaakPrats avatar Feb 14 '25 21:02 IzaakPrats

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.

GODrums avatar Feb 17 '25 14:02 GODrums

@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

IzaakPrats avatar Feb 17 '25 18:02 IzaakPrats

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 avatar Feb 17 '25 20:02 GODrums

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.

GODrums avatar Feb 17 '25 20:02 GODrums

@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

IzaakPrats avatar Feb 19 '25 01:02 IzaakPrats

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.

Step7750 avatar Feb 22 '25 05:02 Step7750

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 avatar Mar 01 '25 22:03 IzaakPrats

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

IzaakPrats avatar Mar 04 '25 06:03 IzaakPrats

Again, thank you for your work on this @IzaakPrats!

Let me know if you get stuck on the last few feedback items – I'm happy to assist and help getting it merged.

GODrums avatar Apr 01 '25 12:04 GODrums

Hey @GODrums / @Step7750 -- I just got home from a vacation. Will likely get this merged in either this afternoon or this weekend. Thanks for the support!

IzaakPrats avatar Apr 03 '25 17:04 IzaakPrats

Got the final comments resolved and rebased on current master branch.

Looks like I'll need approval from @Step7750 in order to merge -- is there a process for merging I should follow?

cc @GODrums

IzaakPrats avatar Apr 13 '25 14:04 IzaakPrats

@IzaakPrats Don't worry, @Step7750 will take a look at it as soon as he can find some time. With his approval, you are free to merge it anytime. Thanks again for this great PR!

GODrums avatar Apr 13 '25 19:04 GODrums

rebased on master

IzaakPrats avatar Apr 19 '25 17:04 IzaakPrats