mirror of
https://github.com/harness/drone.git
synced 2025-05-31 11:43:15 +00:00
[UI] Store PR activity filter + sorting order in local browser storage (#329)
This commit is contained in:
parent
bfea74dbe5
commit
d6ee7820e2
@ -4,7 +4,6 @@ import { useStrings } from 'framework/strings'
|
||||
import { CopyButton } from 'components/CopyButton/CopyButton'
|
||||
import { CodeIcon } from 'utils/GitUtils'
|
||||
import CloneCredentialDialog from 'components/CloneCredentialDialog/CloneCredentialDialog'
|
||||
import { useAppContext } from 'AppContext'
|
||||
import css from './CloneButtonTooltip.module.scss'
|
||||
|
||||
interface CloneButtonTooltipProps {
|
||||
@ -14,7 +13,6 @@ interface CloneButtonTooltipProps {
|
||||
export function CloneButtonTooltip({ httpsURL }: CloneButtonTooltipProps) {
|
||||
const { getString } = useStrings()
|
||||
const [flag, setFlag] = useState(false)
|
||||
const { standalone } = useAppContext()
|
||||
|
||||
return (
|
||||
<Container className={css.container} padding="xlarge">
|
||||
|
@ -5,7 +5,9 @@ export enum UserPreference {
|
||||
DIFF_LINE_BREAKS = 'DIFF_LINE_BREAKS',
|
||||
PULL_REQUESTS_FILTER_SELECTED_OPTIONS = 'PULL_REQUESTS_FILTER_SELECTED_OPTIONS',
|
||||
PULL_REQUEST_MERGE_STRATEGY = 'PULL_REQUEST_MERGE_STRATEGY',
|
||||
PULL_REQUEST_CREATION_OPTION = 'PULL_REQUEST_CREATION_OPTION'
|
||||
PULL_REQUEST_CREATION_OPTION = 'PULL_REQUEST_CREATION_OPTION',
|
||||
PULL_REQUEST_ACTIVITY_FILTER = 'PULL_REQUEST_ACTIVITY_FILTER',
|
||||
PULL_REQUEST_ACTIVITY_ORDER = 'PULL_REQUEST_ACTIVITY_ORDER'
|
||||
}
|
||||
|
||||
export function useUserPreference<T = string>(
|
||||
|
@ -16,6 +16,7 @@ import { CodeCommentStatusSelect } from 'components/CodeCommentStatusSelect/Code
|
||||
import { CodeCommentStatusButton } from 'components/CodeCommentStatusButton/CodeCommentStatusButton'
|
||||
import { CodeCommentSecondarySaveButton } from 'components/CodeCommentSecondarySaveButton/CodeCommentSecondarySaveButton'
|
||||
import type { PRChecksDecisionResult } from 'hooks/usePRChecksDecision'
|
||||
import { UserPreference, useUserPreference } from 'hooks/useUserPreference'
|
||||
import { PullRequestTabContentWrapper } from '../PullRequestTabContentWrapper'
|
||||
import { DescriptionBox } from './DescriptionBox'
|
||||
import { PullRequestActionsBox } from './PullRequestActionsBox/PullRequestActionsBox'
|
||||
@ -59,9 +60,16 @@ export const Conversation: React.FC<ConversationProps> = ({
|
||||
debounce: 500
|
||||
})
|
||||
const { showError } = useToaster()
|
||||
const [dateOrderSort, setDateOrderSort] = useState<boolean | 'desc' | 'asc'>(orderSortDate.ASC)
|
||||
const [dateOrderSort, setDateOrderSort] = useUserPreference<orderSortDate.ASC | orderSortDate.DESC>(
|
||||
UserPreference.PULL_REQUEST_ACTIVITY_ORDER,
|
||||
orderSortDate.ASC
|
||||
)
|
||||
const activityFilters = useActivityFilters()
|
||||
const [activityFilter, setActivityFilter] = useState<SelectOption>(activityFilters[0] as SelectOption)
|
||||
const [activityFilter, setActivityFilter] = useUserPreference<SelectOption>(
|
||||
UserPreference.PULL_REQUEST_ACTIVITY_FILTER,
|
||||
activityFilters[0] as SelectOption
|
||||
)
|
||||
|
||||
const activityBlocks = useMemo(() => {
|
||||
// Each block may have one or more activities which are grouped into it. For example, one comment block
|
||||
// contains a parent comment and multiple replied comments
|
||||
|
Loading…
x
Reference in New Issue
Block a user