Skip to content

Commit 2e6da1a

Browse files
committed
rm quest table sort, get quests by start date newest first
1 parent 54d8a5a commit 2e6da1a

File tree

4 files changed

+12
-80
lines changed

4 files changed

+12
-80
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"@hyperplay/chains": "^0.5.0",
7373
"@hyperplay/check-disk-space": "^3.5.2",
7474
"@hyperplay/quests-ui": "^0.1.23",
75-
"@hyperplay/ui": "^1.9.5",
75+
"@hyperplay/ui": "1.9.8-alpha.0",
7676
"@hyperplay/utils": "^0.3.7",
7777
"@mantine/carousel": "^7.12.0",
7878
"@mantine/core": "^7.12.0",

pnpm-lock.yaml

+8-59
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/backend/ipcHandlers/quests.ts

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ async function fetchQuests({
1919
}): Promise<Quest[]> {
2020
const url = new URL(`${DEV_PORTAL_URL}api/v1/quests`)
2121
url.searchParams.append('questStatus', status)
22+
url.searchParams.append('sortBy', 'start_date')
23+
url.searchParams.append('order', 'asc')
2224
if (projectId) {
2325
url.searchParams.append('projectId', projectId)
2426
}

src/frontend/screens/Quests/index.tsx

+1-20
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ export function QuestsPage() {
4141
const searchParam = searchParams.get('search')
4242
const [searchText, setSearchText] = useState(searchParam ?? '')
4343
const [activeFilter, setActiveFilter] = useState<QuestFilter>('all')
44-
const [selectedSort, setSelectedSort] = useState<itemType>({
45-
text: 'Alphabetically (ASC)',
46-
id: 'ALPHA_ASC'
47-
})
4844

4945
useEffect(() => {
5046
window.api.trackScreen('Quests Page')
@@ -123,17 +119,12 @@ export function QuestsPage() {
123119
}
124120
})
125121

126-
const sortedQuests = [...(quests ?? [])].sort((a, b) => {
127-
const sortMultiplier = selectedSort.id === 'ALPHA_ASC' ? 1 : -1
128-
return a.name.localeCompare(b.name) * sortMultiplier
129-
})
130-
131122
const gameTitleMatches = (quest: Quest) => {
132123
const title = listings ? listings[quest.project_id]?.project_meta?.name : ''
133124
return title?.toLowerCase().startsWith(searchText.toLowerCase())
134125
}
135126

136-
const searchFilteredQuests = sortedQuests?.filter((quest) => {
127+
const searchFilteredQuests = quests?.filter((quest) => {
137128
const questTitleMatch = quest.name
138129
.toLowerCase()
139130
.startsWith(searchText.toLowerCase())
@@ -152,11 +143,6 @@ export function QuestsPage() {
152143
const initialQuestId = searchFilteredQuests?.[0]?.id ?? null
153144
const visibleQuestId = selectedQuestId ?? initialQuestId
154145

155-
const achievementsSortOptions = [
156-
{ text: 'Alphabetically (ASC)', id: 'ALPHA_ASC' },
157-
{ text: 'Alphabetically (DES)', id: 'ALPHA_DES' }
158-
]
159-
160146
const imagesToPreload: string[] = []
161147
const gameElements =
162148
searchFilteredQuests?.map(({ id, project_id, name, ...rest }) => {
@@ -206,11 +192,6 @@ export function QuestsPage() {
206192
<QuestsSummaryTable
207193
games={gameElements}
208194
imagesToPreload={imagesToPreload}
209-
sortProps={{
210-
options: achievementsSortOptions,
211-
selected: selectedSort,
212-
onItemChange: setSelectedSort
213-
}}
214195
filterProps={{ activeFilter, setActiveFilter }}
215196
isFetching={questsResults?.data.isFetching}
216197
isPageLoading={questsResults?.data.isLoading}

0 commit comments

Comments
 (0)