forked from humanprotocol/human-protocol
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(human-app/frontend/jobs): improve sorting states on mobile drawer
- Loading branch information
1 parent
cda0969
commit c699326
Showing
6 changed files
with
258 additions
and
190 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
50 changes: 50 additions & 0 deletions
50
...worker/jobs/components/available-jobs/mobile/available-jobs-reward-amount-sort-mobile.tsx
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,50 @@ | ||
/* eslint-disable camelcase */ | ||
import { t } from 'i18next'; | ||
import Typography from '@mui/material/Typography'; | ||
import { useColorMode } from '@/hooks/use-color-mode'; | ||
import { useJobsFilterStore } from '@/hooks/use-jobs-filter-store'; | ||
import { Sorting } from '@/pages/worker/jobs/components/sorting'; | ||
|
||
export function AvailableJobsRewardAmountSortMobile() { | ||
const { setFilterParams, filterParams } = useJobsFilterStore(); | ||
const { colorPalette } = useColorMode(); | ||
|
||
return ( | ||
<Sorting | ||
label={ | ||
<Typography color={colorPalette.text.secondary} variant="body2"> | ||
{t('worker.jobs.rewardAmount')} | ||
</Typography> | ||
} | ||
fromHighestSelected={ | ||
filterParams.sort_field === 'reward_amount' && | ||
filterParams.sort === 'desc' | ||
} | ||
sortFromHighest={() => { | ||
setFilterParams({ | ||
...filterParams, | ||
sort: 'desc', | ||
sort_field: 'reward_amount', | ||
}); | ||
}} | ||
fromLowestSelected={ | ||
filterParams.sort_field === 'reward_amount' && | ||
filterParams.sort === 'asc' | ||
} | ||
sortFromLowest={() => { | ||
setFilterParams({ | ||
...filterParams, | ||
sort: 'asc', | ||
sort_field: 'reward_amount', | ||
}); | ||
}} | ||
clear={() => { | ||
setFilterParams({ | ||
...filterParams, | ||
sort: undefined, | ||
sort_field: undefined, | ||
}); | ||
}} | ||
/> | ||
); | ||
} |
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
48 changes: 48 additions & 0 deletions
48
...ontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-expires-at-sort-mobile.tsx
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,48 @@ | ||
/* eslint-disable camelcase */ | ||
import Typography from '@mui/material/Typography'; | ||
import { t } from 'i18next'; | ||
import { useColorMode } from '@/hooks/use-color-mode'; | ||
import { useMyJobsFilterStore } from '@/hooks/use-my-jobs-filter-store'; | ||
import { Sorting } from '@/pages/worker/jobs/components/sorting'; | ||
|
||
export function MyJobsExpiresAtSortMobile() { | ||
const { setFilterParams, filterParams } = useMyJobsFilterStore(); | ||
const { colorPalette } = useColorMode(); | ||
|
||
return ( | ||
<Sorting | ||
label={ | ||
<Typography color={colorPalette.text.secondary} variant="body2"> | ||
{t('worker.jobs.expiresAt')} | ||
</Typography> | ||
} | ||
fromHighestSelected={ | ||
filterParams.sort_field === 'expires_at' && filterParams.sort === 'desc' | ||
} | ||
sortFromHighest={() => { | ||
setFilterParams({ | ||
...filterParams, | ||
sort: 'desc', | ||
sort_field: 'expires_at', | ||
}); | ||
}} | ||
fromLowestSelected={ | ||
filterParams.sort_field === 'expires_at' && filterParams.sort === 'asc' | ||
} | ||
sortFromLowest={() => { | ||
setFilterParams({ | ||
...filterParams, | ||
sort: 'asc', | ||
sort_field: 'expires_at', | ||
}); | ||
}} | ||
clear={() => { | ||
setFilterParams({ | ||
...filterParams, | ||
sort: undefined, | ||
sort_field: undefined, | ||
}); | ||
}} | ||
/> | ||
); | ||
} |
Oops, something went wrong.