-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add request for RegionUndercuts * Make form for the input * Add form action for new page * Add tables for not_found and undercut * Remove console.og * Add links * move index pages around --------- Co-authored-by: cohenaj194 <cohenaj194@gmail.com>
- Loading branch information
1 parent
126a465
commit f5b9b64
Showing
7 changed files
with
1,005 additions
and
797 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { ToolTip } from '~/components/Common/InfoToolTip' | ||
import { classNames } from '~/utils' | ||
|
||
export const TextArea = ({ | ||
label, | ||
toolTip, | ||
formName, | ||
placeholder = 'Paste your data here...' | ||
}: { | ||
label?: string | ||
formName?: string | ||
toolTip?: string | ||
placeholder?: string | ||
}) => { | ||
const inputClassnames = classNames( | ||
'flex flex-1 items-center gap-1', | ||
toolTip ? 'relative' : '' | ||
) | ||
return ( | ||
<div className="pt-2 flex-col"> | ||
{label && ( | ||
<div className={inputClassnames}> | ||
<label | ||
htmlFor={formName} | ||
className="block text-sm font-medium text-gray-700 dark:text-gray-100"> | ||
{label} | ||
</label> | ||
{toolTip && <ToolTip data={toolTip} />} | ||
</div> | ||
)} | ||
<div className="mt-1 flex rounded-md shadow-sm border border-gray-300 dark:border-gray-400"> | ||
<textarea | ||
id={formName} | ||
name={formName} | ||
className="p-2 w-full border-0 rounded-md focus:ring-blue-500 focus:border-2 focus:border-blue-500 dark:border-gray-400 dark:text-gray-100 dark:bg-gray-600" | ||
placeholder={placeholder} | ||
rows={5} | ||
/> | ||
</div> | ||
</div> | ||
) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import { address, UserAgent } from '~/requests/client/config' | ||
import type { WoWServerRegion } from '../WOWScan' | ||
|
||
interface PetAuction { | ||
petID: number | ||
price: number | ||
auctionID: number | ||
} | ||
interface ItemAuction { | ||
itemID: number | ||
price: number | ||
auctionID: number | ||
} | ||
|
||
interface AddOnData { | ||
homeRealmName: string | ||
region: string | ||
user_auctions: Array<PetAuction | ItemAuction> | ||
} | ||
|
||
interface RegionUndercutProps { | ||
region: WoWServerRegion | ||
homeRealmId: number | ||
addonData: Array<AddOnData> | ||
} | ||
|
||
interface ImportSearch { | ||
ROI: number | ||
avgPrice: number | ||
connectedRealmIDs: Record<string, string> | ||
homeRealmID: number | ||
maxPurchasePrice: number | ||
profitAmount: number | ||
region: WoWServerRegion | ||
salesPerDay: number | ||
sortBy: string | ||
} | ||
|
||
export interface UndercutItems { | ||
connectedRealmId: number | ||
item_id: number | ||
item_name: string | ||
link: string | ||
lowest_price: number | ||
realmName: string | ||
user_price: number | ||
} | ||
|
||
interface ResultByRealm { | ||
not_found: Array<{ | ||
connectedRealmId: number | ||
item_id: number | ||
item_name: string | ||
link: string | ||
lowest_auction_id: number | ||
lowest_price: number | ||
price_found: boolean | ||
realmName: string | ||
undercut: boolean | ||
user_auction_id: number | ||
user_price: number | ||
}> | ||
realm_info: { | ||
connectedRealmID: number | ||
realmName: string | ||
realmNames: Array<string> | ||
region: string | ||
} | ||
not_undercut: Array<any> | ||
undercuts: Array<any> | ||
} | ||
|
||
type RealmName = string | ||
|
||
export interface RegionUndercutResponse { | ||
import_search_json: ImportSearch | ||
not_found_list: Array<UndercutItems> | ||
undercut_list: Array<UndercutItems> | ||
results_by_realm: Record<RealmName, ResultByRealm> | ||
} | ||
|
||
const RegionUndercutRequest = async ({ | ||
homeRealmId, | ||
region, | ||
addonData | ||
}: RegionUndercutProps) => | ||
await fetch(`${address}/api/wow/regionundercut`, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'User-Agent': UserAgent | ||
}, | ||
body: JSON.stringify({ | ||
homeRealmID: homeRealmId, | ||
region, | ||
addonData | ||
}) | ||
}) | ||
|
||
export default RegionUndercutRequest |
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
Oops, something went wrong.