fix: claim list sorting
This commit is contained in:
parent
a7a67f6561
commit
7f5aff8cd0
3 changed files with 5 additions and 6 deletions
|
@ -26,8 +26,8 @@ type Props = {
|
||||||
export default function ClaimList(props: Props) {
|
export default function ClaimList(props: Props) {
|
||||||
const { uris, headerAltControls, injectedItem, loading, persistedStorageKey, empty, meta, type, header } = props;
|
const { uris, headerAltControls, injectedItem, loading, persistedStorageKey, empty, meta, type, header } = props;
|
||||||
const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW);
|
const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW);
|
||||||
const sortedUris = uris && currentSort === SORT_NEW ? uris.slice().reverse() : uris;
|
|
||||||
const hasUris = uris && !!uris.length;
|
const hasUris = uris && !!uris.length;
|
||||||
|
const sortedUris = (hasUris && (currentSort === SORT_NEW ? uris : uris.slice().reverse())) || [];
|
||||||
|
|
||||||
function handleSortChange() {
|
function handleSortChange() {
|
||||||
setCurrentSort(currentSort === SORT_NEW ? SORT_OLD : SORT_NEW);
|
setCurrentSort(currentSort === SORT_NEW ? SORT_OLD : SORT_NEW);
|
||||||
|
|
|
@ -34,7 +34,7 @@ export default function SubscribeButton(props: Props) {
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const subscriptionHandler = isSubscribed ? doChannelUnsubscribe : doChannelSubscribe;
|
const subscriptionHandler = isSubscribed ? doChannelUnsubscribe : doChannelSubscribe;
|
||||||
const subscriptionLabel = isSubscribed ? __('Subscribed') : __('Subscribe');
|
const subscriptionLabel = isSubscribed ? __('Following') : __('Follow');
|
||||||
|
|
||||||
const { claimName } = parseURI(uri);
|
const { claimName } = parseURI(uri);
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ export default function SubscribeButton(props: Props) {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (showSnackBarOnSubscribe) {
|
if (showSnackBarOnSubscribe) {
|
||||||
doToast({ message: `${__('Successfully subscribed to')} ${claimName}!` });
|
doToast({ message: `${__('Now following ')} ${claimName}!` });
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -69,12 +69,11 @@ export default function SubscriptionsPage(props: Props) {
|
||||||
headerAltControls={
|
headerAltControls={
|
||||||
<Button
|
<Button
|
||||||
button="link"
|
button="link"
|
||||||
label={viewingSuggestedSubs ? hasSubscriptions && __('View Your Subscriptions') : __('Find New Channels')}
|
label={viewingSuggestedSubs ? hasSubscriptions && __('Following') : __('Find New Channels')}
|
||||||
onClick={() => onClick()}
|
onClick={() => onClick()}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
// Fix the need to reverse this
|
uris={viewingSuggestedSubs ? suggestedSubscriptions.map(sub => sub.uri) : uris}
|
||||||
uris={viewingSuggestedSubs ? suggestedSubscriptions.map(sub => sub.uri) : uris.reverse()}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Page>
|
</Page>
|
||||||
|
|
Loading…
Reference in a new issue