-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat(xudt-tag): add xudt tag column in xudt page #378
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Is this PR ready for review? |
Not yet, just waiting for the API ready |
4027511
to
41e5f09
Compare
7834ec4
to
c33e859
Compare
const params = useSearchParams(filterName) | ||
const filter = params[filterName] | ||
let types = filteredList.map(f => f.value) | ||
if (filter !== undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be simplified as
const types = params[filterName]?.split(',').filter(t => !t)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filterName
should be filterNames
if it's designed to be multiple filters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, the filters
from the URL are more like filteredList
because they are effective/working filters
while filteredList
in the component params
is a list of filters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filterName
should befilterNames
if it's designed to be multiple filters.
I think there would be only one filter for each filter button, so I think "s" is not necessary here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are three values for the filterName
.
undefined
, which means to entry the page without any filter parameters, for "all selected".- Empty string
''
, liketags=
which means "not selected any value". - Partial selected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are three values for the
filterName
.
undefined
, which means to entry the page without any filter parameters, for "all selected".- Empty string
''
, liketags=
which means "not selected any value".- Partial selected.
const types = params[filterName]?.split(',').filter(t => !t)
works well for these 3 cases
when params[filterName]
is undefined, types
is undefined, means all selected
when params[filterName]
is an empty string, types
is an empty array, means not selected any value
when params[filterName]
is a string, types
is expected to be an array with items, means some selected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any update on this conversation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filterName
should befilterNames
if it's designed to be multiple filters.I think there would be only one filter for each filter button, so I think "s" is not necessary here.
The logic is as follows
const filter = params[filterName] const types = filter.split(',').filter(t => t !== '')equivalent to
const types = params[filterName].split(',').filter(t => t !== '')So
params[filterName]
is expected to be a string likeA,B,C
, which includes multiplevalues
. That's the reason I think it should befilterNames
The filterName
means the name of the filter, and A,B,C
should be the values of this filter, not the name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are three values for the
filterName
.
undefined
, which means to entry the page without any filter parameters, for "all selected".- Empty string
''
, liketags=
which means "not selected any value".- Partial selected.
const types = params[filterName]?.split(',').filter(t => !t)works well for these 3 cases
when
params[filterName]
is undefined,types
is undefined, meansall selected
whenparams[filterName]
is an empty string,types
is an empty array, meansnot selected any value
whenparams[filterName]
is a string,types
is expected to be an array with items, meanssome selected
The result of !t
is true
when it is an empty string, but the empty string should filtered to the result
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My typo, .filter(t => !t)
should be .filter(t => !!t)
to return truty values
@Sven-TBD please review the UX |
I'm ok with the UX part, however, while trying to uncheck all , it should be No data, but all items are displayed here. |
Should be supported by the API @zmcNotafraid How to filter none tag items? |
Magickbase/ckb-explorer-public-issues#650 (comment) 1、The corresponding backend message information does not have the
2、The problem still exists. 3、When there is no data on the page, paging needs to be performed here. At this time, if you switch pages again, the pages will be without data. 4、 There is 5、If the filter function is used, the icon needs to have a highlighted style, refer to the |
1、The corresponding backend message information does not have the Verified on platform/xudt.tag.category information. Is the unname tag added? Yes, We can still remain the tag, Verified on platform. But we need to remove the xudt.tag.category @Daryl-L @zmcNotafraid |
There is also no |
Removed. |
关于Filter组件: 并集API: 交集API: 其中默认为未启用状态,未启用状态下,选中一个选项将变更组件状态到 “启用”: 其中启用状态下,选项全不选将变更组件状态到 “未启用”: |
Magickbase/ckb-explorer-public-issues#650
https://ckb-explorer-frontend-in-magickbase-repo-git-7ac401-magickbase.vercel.app/xudts