-
-
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.
First steps toward WoW Upload Timers
- Loading branch information
Showing
4 changed files
with
104 additions
and
0 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
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,25 @@ | ||
import { address, UserAgent } from '~/requests/client/config' | ||
|
||
export type UploadTimersResponse = Array<UploadTimersItem> | ||
|
||
export interface UploadTimersItem { | ||
dataSetID: number | ||
dataSetName: Array<string> | ||
lastUploadMinute: number | ||
lastUploadTimeRaw: string | ||
lastUploadUnix: number | ||
region: string | ||
tableName: string | ||
} | ||
|
||
const UploadTimersRequest = async () => | ||
await fetch(`${address}/api/wow/upload-timers`, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'User-Agent': UserAgent | ||
}, | ||
body: JSON.stringify({}) | ||
}) | ||
|
||
export default UploadTimersRequest |
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,67 @@ | ||
import type { LoaderFunction } from '@remix-run/cloudflare' | ||
import { json } from '@remix-run/cloudflare' | ||
import { PageWrapper } from '~/components/Common' | ||
import type { | ||
UploadTimersResponse, | ||
UploadTimersItem | ||
} from '~/requests/WoW/UploadTimers' | ||
import UploadTimersRequest from '~/requests/WoW/UploadTimers' | ||
import { useLoaderData } from '@remix-run/react' | ||
import NoResults from '~/components/Common/NoResults' | ||
import SmallTable from '~/components/WoWResults/FullScan/SmallTable' | ||
import type { ColumnList } from '~/components/types' | ||
|
||
export const loader: LoaderFunction = async ({ request }) => { | ||
return await json(UploadTimersRequest()) | ||
} | ||
|
||
type UploadTimersActionResponse = | ||
| UploadTimersResponse | ||
| { exception: string } | ||
| {} | ||
| undefined | ||
|
||
const UploadTimers = () => { | ||
const results = useLoaderData<UploadTimersActionResponse>() | ||
|
||
if (results) { | ||
if (!Object.keys(results).length) { | ||
return <NoResults href="/wow/upload-timers" /> | ||
} | ||
} | ||
|
||
return ( | ||
<PageWrapper> | ||
<SmallTable | ||
title="Upload Timers" | ||
description="Shows when the WoW auction house data was last uploaded." | ||
columnList={columnList} | ||
data={[]} | ||
columnSelectOptions={selectOptions} | ||
sortingOrder={sortingOrder} | ||
mobileColumnList={mobileColumnList} | ||
/> | ||
</PageWrapper> | ||
) | ||
} | ||
|
||
export default UploadTimers | ||
|
||
const columnList: Array<ColumnList<UploadTimersItem>> = [ | ||
{ columnId: 'dataSetID', header: 'Data Set ID' }, | ||
{ columnId: 'dataSetName', header: 'Data Set Name' }, | ||
{ columnId: 'lastUploadMinute', header: 'Last Upload Minute' }, | ||
{ columnId: 'lastUploadTimeRaw', header: 'Last Upload Time Raw' }, | ||
{ columnId: 'lastUploadUnix', header: 'Last Upload Unix' }, | ||
{ columnId: 'region', header: 'Region' }, | ||
{ columnId: 'tableName', header: 'Table Name' } | ||
] | ||
|
||
const selectOptions = ['user_price', 'lowest_price', 'realmName'] | ||
|
||
const sortingOrder = [{ id: 'user_price', desc: true }] | ||
|
||
const mobileColumnList: Array<ColumnList<UploadTimersItem>> = [ | ||
{ columnId: 'dataSetName', header: 'Data Set Name' }, | ||
{ columnId: 'lastUploadMinute', header: 'Last Upload Minute' } | ||
] |