Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifications UI: add all filter to table #989

Merged
merged 5 commits into from Sep 10, 2019
Merged
Changes from 2 commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -10,7 +10,6 @@ import {
Tabs,
breakpoint,
springs,
useLayout,
useTheme,
useToast,
useViewport,
@@ -92,20 +92,25 @@ const SubscriptionsTable = React.memo(function SubscriptionsTable({
setDeleteModalOpened(false)
}, [])

const organizations = Array.from(
new Set(subscriptions.map(subscription => subscription.ensName))
)
const subscriptionApps = Array.from(
new Set(subscriptions.map(subscription => subscription.appName))
)
const events = Array.from(
new Set(subscriptions.map(subscription => subscription.eventName))
)
const organizations = [
'All',
...new Set(subscriptions.map(subscription => subscription.ensName)),
]
const subscriptionApps = [
'All',
...new Set(subscriptions.map(subscription => subscription.appName)),
]
const events = [
'All',
...new Set(subscriptions.map(subscription => subscription.eventName)),
]
const filteredSubscriptions = filterSubscriptions({
subscriptions,
event: events[selectedEvent],
appName: subscriptionApps[selectedApp],
organization: organizations[selectedOrganization],
event: selectedEvent > 0 ? events[selectedEvent] : null,

This comment has been minimized.

Copy link
@sohkai

sohkai Sep 9, 2019

Member

In addition to doing this, we should also default the selectedEvent, selectedApp and selectedOrganization state to be -1 (when we select 'All'), so that it deactivates the filter.

This comment has been minimized.

Copy link
@2color

2color Sep 9, 2019

Author Contributor

@sohkai
Not sure I understood but do you mean selecting -1, i.e. the dropdown label when All is selected?

If so, I've pushed a commit for that.

This comment has been minimized.

Copy link
@AquiGorka

AquiGorka Sep 9, 2019

Contributor

Yep, that's what he meant. We' ve been doing it this way: when the user selects All, we actually set the index to -1 (as if none was selected). When none, is selected then apply no filter and the filter does not show the blue outline for a (non -1) selected option.
Hope this helps clarify.

appName: selectedApp > 0 ? subscriptionApps[selectedApp] : null,
organization: selectedOrganization
This conversation was marked as resolved by 2color

This comment has been minimized.

Copy link
@sohkai

sohkai Sep 9, 2019

Member

Should this also have an > 0 check?

? organizations[selectedOrganization]
: null,
})

const handleUnsubscribe = useCallback(
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.