fix: claim list sorting

This commit is contained in:
Sean Yesmunt 2019-06-26 18:07:07 -04:00
parent a7a67f6561
commit 7f5aff8cd0
3 changed files with 5 additions and 6 deletions

View file

@ -26,8 +26,8 @@ type Props = {
export default function ClaimList(props: Props) {
const { uris, headerAltControls, injectedItem, loading, persistedStorageKey, empty, meta, type, header } = props;
const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW);
const sortedUris = uris && currentSort === SORT_NEW ? uris.slice().reverse() : uris;
const hasUris = uris && !!uris.length;
const sortedUris = (hasUris && (currentSort === SORT_NEW ? uris : uris.slice().reverse())) || [];
function handleSortChange() {
setCurrentSort(currentSort === SORT_NEW ? SORT_OLD : SORT_NEW);

View file

@ -34,7 +34,7 @@ export default function SubscribeButton(props: Props) {
} = props;
const subscriptionHandler = isSubscribed ? doChannelUnsubscribe : doChannelSubscribe;
const subscriptionLabel = isSubscribed ? __('Subscribed') : __('Subscribe');
const subscriptionLabel = isSubscribed ? __('Following') : __('Follow');
const { claimName } = parseURI(uri);
@ -57,7 +57,7 @@ export default function SubscribeButton(props: Props) {
});
if (showSnackBarOnSubscribe) {
doToast({ message: `${__('Successfully subscribed to')} ${claimName}!` });
doToast({ message: `${__('Now following ')} ${claimName}!` });
}
}}
/>

View file

@ -69,12 +69,11 @@ export default function SubscriptionsPage(props: Props) {
headerAltControls={
<Button
button="link"
label={viewingSuggestedSubs ? hasSubscriptions && __('View Your Subscriptions') : __('Find New Channels')}
label={viewingSuggestedSubs ? hasSubscriptions && __('Following') : __('Find New Channels')}
onClick={() => onClick()}
/>
}
// Fix the need to reverse this
uris={viewingSuggestedSubs ? suggestedSubscriptions.map(sub => sub.uri) : uris.reverse()}
uris={viewingSuggestedSubs ? suggestedSubscriptions.map(sub => sub.uri) : uris}
/>
</div>
</Page>