-
Notifications
You must be signed in to change notification settings - Fork 37
Feature: Modal to allow users to list directly from inventory to CSFloat #288
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
Merged
Merged
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
827bc6c
Create basic list modal
IzaakPrats e7caeea
setup list item modal to have buy now and auction. implement list ite…
IzaakPrats f56b550
Add state for already listed. Add success state to modal
IzaakPrats 53dbed5
Add untradable state in modal
IzaakPrats c96f133
Make list an item modal done button not rounded
IzaakPrats ec3d939
Optimize price fetching and list item modal. Add ui validation for in…
IzaakPrats cfe5cf6
Fetch prices from price-list and cache results.
IzaakPrats f933d0d
Hide list on csfloat button if asset is not tradable
IzaakPrats d433d2f
Remove unused vars in list_item_modal
IzaakPrats c0c62b6
Can never be too punctual
IzaakPrats 965b9e9
Centralize price update logic and add validation for < 100000
IzaakPrats 0a8c7c0
minor: Remove unused import
IzaakPrats 246bab2
Update auction duration options to 1, 3, 7, 14
IzaakPrats c7f15da
Update rec price range to 80-120%
IzaakPrats 37b53a7
Update font to roboto to match csfloat
IzaakPrats 7397d09
Update title styling to include icon -- matching csfloat modals
IzaakPrats 3add91a
Update styling to match csfloat modals closer.
IzaakPrats 7a0d633
Fix up percentage slider to match csfloat behavior. Add subtotal + sa…
IzaakPrats f96a478
Make sales fee label in subtotal section dynamic
IzaakPrats de94c4f
Improve price input styling
IzaakPrats 5236521
Fix issue listing non-skins. Add animations. Add confirmation step. C…
IzaakPrats 945779b
Fix styling on auction button
IzaakPrats 906ebc5
Clean up success modal
IzaakPrats 13f2af4
Display price fetch error instead of allowing input. Clean up title s…
IzaakPrats 2640286
Move styles into new file
IzaakPrats 8718c98
Fix roboto font loading. Implement loading skeleton. Add error ux for…
IzaakPrats c0a5d5c
Make success done button nicer
IzaakPrats 9518fda
Fix some code organization. Fix error cta issue with non-link ctas
IzaakPrats 707bca1
Undo changes to background_ff.html
IzaakPrats 3d7f986
Clean up the loading skeleton
IzaakPrats c99e15d
Use price-list/doppler for dopplers based on market_hash + paint_index
IzaakPrats c009c5e
Fix font for input and button
IzaakPrats 81eb3ba
Allow listing fetcher to throw unauth exceptions and catch while init…
IzaakPrats 48b17d4
Bubble up auth exceptions from list_item handler
IzaakPrats 79c426d
Fix backdrop blur
IzaakPrats e637e7b
Fix scrollbar shift on modal open. Fixed position while modal is open
IzaakPrats 768ce8d
Improve list_item.ts error handling
IzaakPrats c76b5dd
Fix error handling. Add cache clearing and instead of reload window, …
IzaakPrats 02023dc
Only set custom price if no price has been set
IzaakPrats 24a63dd
Add min price validation
IzaakPrats cd04a58
Price fetcher nits. Backdrop blur on modal content. Update price fetc…
IzaakPrats 27001fe
Add USD disclosure to recommended price label
IzaakPrats dbfd47d
Console log error in price_fetcher
IzaakPrats 10304fd
Fix casing in stall_fetcher.ts params
IzaakPrats 394bfe7
Create new CSFError structure to use throughout app for error handling.
IzaakPrats cb5f228
Merge branch 'master' into izaak/feature/issue-277
Step7750 f977a2f
Merge branch 'master' into izaak/feature/issue-277
IzaakPrats File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import {SimpleHandler} from './main'; | ||
| import {RequestType} from './types'; | ||
| import {gPriceFetcher} from '../../services/price_fetcher'; | ||
|
|
||
| export interface FetchRecommendedPriceRequest { | ||
| market_hash_name: string; | ||
| paint_index?: number; | ||
| } | ||
|
|
||
| export interface FetchRecommendedPriceResponse { | ||
| price: number; | ||
| } | ||
|
|
||
| export const FetchRecommendedPrice = new SimpleHandler<FetchRecommendedPriceRequest, FetchRecommendedPriceResponse>( | ||
| RequestType.FETCH_RECOMMENDED_PRICE, | ||
| async (req) => ({price: await gPriceFetcher.fetch(req.market_hash_name, req.paint_index)}) | ||
| ); |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| import {SimpleHandler} from './main'; | ||
| import {RequestType} from './types'; | ||
| import {environment} from '../../../environment'; | ||
| import {CSFError, CSFErrorCode} from '../../utils/errors'; | ||
|
|
||
| type ListingType = 'buy_now' | 'auction'; | ||
|
|
||
| interface BaseListItemRequest { | ||
| asset_id: string; | ||
| type: ListingType; | ||
| description?: string; | ||
| private?: boolean; | ||
| } | ||
|
|
||
| interface BuyNowListItemRequest extends BaseListItemRequest { | ||
| type: 'buy_now'; | ||
| price: number; | ||
| max_offer_discount?: number; | ||
| } | ||
|
|
||
| interface AuctionListItemRequest extends BaseListItemRequest { | ||
| type: 'auction'; | ||
| reserve_price: number; | ||
| duration_days: 1 | 3 | 5 | 7 | 14; | ||
| } | ||
|
|
||
| type ListItemRequest = BuyNowListItemRequest | AuctionListItemRequest; | ||
|
|
||
| interface ListItemResponse { | ||
| success: boolean; | ||
| error?: string; | ||
| id?: string; | ||
| } | ||
|
|
||
| export const ListItem = new SimpleHandler<ListItemRequest, ListItemResponse>(RequestType.LIST_ITEM, async (req) => { | ||
| const response = await fetch(`${environment.csfloat_base_api_url}/v1/listings`, { | ||
| method: 'POST', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| }, | ||
| body: JSON.stringify(req), | ||
| credentials: 'include', | ||
| }); | ||
|
|
||
| if (!response.ok) { | ||
| // Error comes with this body format: { message: string, code: number } | ||
| const error = await response.json(); | ||
| if (response.status === 401) { | ||
| // This is here for normalized auth errors across all handlers | ||
| throw new CSFError(CSFErrorCode.NOT_AUTHENTICATED); | ||
| } | ||
|
|
||
| throw new Error(`Failed to List Item: ${error.message} - ${error.code}`); | ||
| } | ||
|
|
||
| const data = await response.json(); | ||
| return { | ||
| success: true, | ||
| id: data.id, | ||
| }; | ||
| }); |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.