Merge branch 'master' of https://github.com/OdyseeTeam/odysee-frontend
This commit is contained in:
commit
dc31c0f8fe
6 changed files with 35 additions and 10 deletions
|
@ -83,8 +83,12 @@ export default function LivestreamChatLayout(props: Props) {
|
||||||
const [superchatsAmount, setSuperchatsAmount] = React.useState(false);
|
const [superchatsAmount, setSuperchatsAmount] = React.useState(false);
|
||||||
const [chatElement, setChatElement] = React.useState();
|
const [chatElement, setChatElement] = React.useState();
|
||||||
|
|
||||||
const superChatsByChronologicalOrder =
|
let superChatsByChronologicalOrder = [];
|
||||||
superChatsByAmount && superChatsByAmount.sort((a, b) => b.timestamp - a.timestamp);
|
if (superChatsByAmount) superChatsByAmount.forEach((chat) => superChatsByChronologicalOrder.push(chat));
|
||||||
|
if (superChatsByChronologicalOrder.length > 0) {
|
||||||
|
superChatsByChronologicalOrder.sort((a, b) => b.timestamp - a.timestamp);
|
||||||
|
}
|
||||||
|
|
||||||
const commentsToDisplay =
|
const commentsToDisplay =
|
||||||
viewMode === VIEW_MODES.CHAT ? commentsByChronologicalOrder : superChatsByChronologicalOrder;
|
viewMode === VIEW_MODES.CHAT ? commentsByChronologicalOrder : superChatsByChronologicalOrder;
|
||||||
const commentsLength = commentsToDisplay && commentsToDisplay.length;
|
const commentsLength = commentsToDisplay && commentsToDisplay.length;
|
||||||
|
@ -291,13 +295,13 @@ export default function LivestreamChatLayout(props: Props) {
|
||||||
'livestream-comments__top-actions--mobile': isMobile,
|
'livestream-comments__top-actions--mobile': isMobile,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
{isMobile && ((pinnedComment && showPinned) || (superChatsByChronologicalOrder && !superchatsHidden)) && (
|
{isMobile && ((pinnedComment && showPinned) || (superChatsByAmount && !superchatsHidden)) && (
|
||||||
<MobileDrawerTopGradient theme={theme} />
|
<MobileDrawerTopGradient theme={theme} />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{viewMode === VIEW_MODES.CHAT && superChatsByChronologicalOrder && (
|
{viewMode === VIEW_MODES.CHAT && superChatsByAmount && (
|
||||||
<LivestreamSuperchats
|
<LivestreamSuperchats
|
||||||
superChats={superChatsByChronologicalOrder}
|
superChats={superChatsByAmount}
|
||||||
toggleSuperChat={toggleSuperChat}
|
toggleSuperChat={toggleSuperChat}
|
||||||
superchatsHidden={superchatsHidden}
|
superchatsHidden={superchatsHidden}
|
||||||
isMobile={isMobile}
|
isMobile={isMobile}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||||
import { selectHasNavigated, selectScrollStartingPosition, selectWelcomeVersion } from 'redux/selectors/app';
|
import { selectHasNavigated, selectScrollStartingPosition, selectWelcomeVersion } from 'redux/selectors/app';
|
||||||
import { selectHomepageData } from 'redux/selectors/settings';
|
import { selectHomepageData, selectWildWestDisabled } from 'redux/selectors/settings';
|
||||||
import Router from './view';
|
import Router from './view';
|
||||||
import { normalizeURI } from 'util/lbryURI';
|
import { normalizeURI } from 'util/lbryURI';
|
||||||
import { selectTitleForUri } from 'redux/selectors/claims';
|
import { selectTitleForUri } from 'redux/selectors/claims';
|
||||||
|
@ -35,6 +35,7 @@ const select = (state) => {
|
||||||
hasNavigated: selectHasNavigated(state),
|
hasNavigated: selectHasNavigated(state),
|
||||||
hasUnclaimedRefereeReward: selectHasUnclaimedRefereeReward(state),
|
hasUnclaimedRefereeReward: selectHasUnclaimedRefereeReward(state),
|
||||||
homepageData: selectHomepageData(state),
|
homepageData: selectHomepageData(state),
|
||||||
|
wildWestDisabled: selectWildWestDisabled(state),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { useIsLargeScreen } from 'effects/use-screensize';
|
||||||
import { lazyImport } from 'util/lazyImport';
|
import { lazyImport } from 'util/lazyImport';
|
||||||
import { LINKED_COMMENT_QUERY_PARAM } from 'constants/comment';
|
import { LINKED_COMMENT_QUERY_PARAM } from 'constants/comment';
|
||||||
import { parseURI, isURIValid } from 'util/lbryURI';
|
import { parseURI, isURIValid } from 'util/lbryURI';
|
||||||
import { SITE_TITLE, WELCOME_VERSION, SIMPLE_SITE } from 'config';
|
import { SITE_TITLE, WELCOME_VERSION } from 'config';
|
||||||
import LoadingBarOneOff from 'component/loadingBarOneOff';
|
import LoadingBarOneOff from 'component/loadingBarOneOff';
|
||||||
import { GetLinksData } from 'util/buildHomepage';
|
import { GetLinksData } from 'util/buildHomepage';
|
||||||
|
|
||||||
|
@ -129,6 +129,7 @@ type Props = {
|
||||||
setReferrer: (?string) => void,
|
setReferrer: (?string) => void,
|
||||||
hasUnclaimedRefereeReward: boolean,
|
hasUnclaimedRefereeReward: boolean,
|
||||||
homepageData: any,
|
homepageData: any,
|
||||||
|
wildWestDisabled: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
type PrivateRouteProps = Props & {
|
type PrivateRouteProps = Props & {
|
||||||
|
@ -168,7 +169,9 @@ function AppRouter(props: Props) {
|
||||||
hasUnclaimedRefereeReward,
|
hasUnclaimedRefereeReward,
|
||||||
setReferrer,
|
setReferrer,
|
||||||
homepageData,
|
homepageData,
|
||||||
|
wildWestDisabled,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const { entries, listen, action: historyAction } = history;
|
const { entries, listen, action: historyAction } = history;
|
||||||
const entryIndex = history.index;
|
const entryIndex = history.index;
|
||||||
const urlParams = new URLSearchParams(search);
|
const urlParams = new URLSearchParams(search);
|
||||||
|
@ -277,7 +280,7 @@ function AppRouter(props: Props) {
|
||||||
|
|
||||||
<Route path={`/`} exact component={HomePage} />
|
<Route path={`/`} exact component={HomePage} />
|
||||||
<Route path={`/$/${PAGES.DISCOVER}`} exact component={DiscoverPage} />
|
<Route path={`/$/${PAGES.DISCOVER}`} exact component={DiscoverPage} />
|
||||||
{SIMPLE_SITE && <Route path={`/$/${PAGES.WILD_WEST}`} exact component={DiscoverPage} />}
|
{!wildWestDisabled && <Route path={`/$/${PAGES.WILD_WEST}`} exact component={DiscoverPage} />}
|
||||||
{homeCategoryPages}
|
{homeCategoryPages}
|
||||||
|
|
||||||
<Route path={`/$/${PAGES.AUTH_SIGNIN}`} exact component={SignInPage} />
|
<Route path={`/$/${PAGES.AUTH_SIGNIN}`} exact component={SignInPage} />
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { selectSubscriptions } from 'redux/selectors/subscriptions';
|
||||||
import { doClearPurchasedUriSuccess } from 'redux/actions/file';
|
import { doClearPurchasedUriSuccess } from 'redux/actions/file';
|
||||||
import { selectFollowedTags } from 'redux/selectors/tags';
|
import { selectFollowedTags } from 'redux/selectors/tags';
|
||||||
import { selectUserVerifiedEmail, selectUser } from 'redux/selectors/user';
|
import { selectUserVerifiedEmail, selectUser } from 'redux/selectors/user';
|
||||||
import { selectHomepageData, selectLanguage } from 'redux/selectors/settings';
|
import { selectHomepageData, selectLanguage, selectWildWestDisabled } from 'redux/selectors/settings';
|
||||||
import { doSignOut } from 'redux/actions/app';
|
import { doSignOut } from 'redux/actions/app';
|
||||||
import { selectUnseenNotificationCount } from 'redux/selectors/notifications';
|
import { selectUnseenNotificationCount } from 'redux/selectors/notifications';
|
||||||
import { selectPurchaseUriSuccess } from 'redux/selectors/claims';
|
import { selectPurchaseUriSuccess } from 'redux/selectors/claims';
|
||||||
|
@ -21,6 +21,7 @@ const select = (state) => ({
|
||||||
user: selectUser(state),
|
user: selectUser(state),
|
||||||
homepageData: selectHomepageData(state),
|
homepageData: selectHomepageData(state),
|
||||||
activeChannelStakedLevel: selectActiveChannelStakedLevel(state),
|
activeChannelStakedLevel: selectActiveChannelStakedLevel(state),
|
||||||
|
wildWestDisabled: selectWildWestDisabled(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(select, {
|
export default connect(select, {
|
||||||
|
|
|
@ -112,6 +112,7 @@ type Props = {
|
||||||
user: ?User,
|
user: ?User,
|
||||||
homepageData: any,
|
homepageData: any,
|
||||||
activeChannelStakedLevel: number,
|
activeChannelStakedLevel: number,
|
||||||
|
wildWestDisabled: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
function SideNavigation(props: Props) {
|
function SideNavigation(props: Props) {
|
||||||
|
@ -130,6 +131,7 @@ function SideNavigation(props: Props) {
|
||||||
user,
|
user,
|
||||||
followedTags,
|
followedTags,
|
||||||
activeChannelStakedLevel,
|
activeChannelStakedLevel,
|
||||||
|
wildWestDisabled,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const isLargeScreen = useIsLargeScreen();
|
const isLargeScreen = useIsLargeScreen();
|
||||||
|
@ -480,7 +482,7 @@ function SideNavigation(props: Props) {
|
||||||
<>
|
<>
|
||||||
{/* $FlowFixMe -- GetLinksData should fix it's data type */}
|
{/* $FlowFixMe -- GetLinksData should fix it's data type */}
|
||||||
{EXTRA_SIDEBAR_LINKS.map((linkProps) => getLink(linkProps))}
|
{EXTRA_SIDEBAR_LINKS.map((linkProps) => getLink(linkProps))}
|
||||||
{getLink(WILD_WEST)}
|
{!wildWestDisabled && getLink(WILD_WEST)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import * as SETTINGS from 'constants/settings';
|
import * as SETTINGS from 'constants/settings';
|
||||||
import * as DAEMON_SETTINGS from 'constants/daemon_settings';
|
import * as DAEMON_SETTINGS from 'constants/daemon_settings';
|
||||||
|
import SUPPORTED_BROWSER_LANGUAGES from 'constants/supported_browser_languages';
|
||||||
|
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
import { ENABLE_MATURE } from 'config';
|
import { ENABLE_MATURE } from 'config';
|
||||||
|
@ -72,4 +73,17 @@ export const selectHomepageData = createSelector(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const selectInRegionByCode = (state, code) => {
|
||||||
|
const hp = selectClientSetting(state, SETTINGS.HOMEPAGE);
|
||||||
|
const lang = selectLanguage(state);
|
||||||
|
|
||||||
|
return hp === code || lang === code;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const selectWildWestDisabled = (state) => {
|
||||||
|
const deRegion = selectInRegionByCode(state, SUPPORTED_BROWSER_LANGUAGES.de);
|
||||||
|
|
||||||
|
return deRegion;
|
||||||
|
};
|
||||||
|
|
||||||
export const selectosNotificationsEnabled = (state) => selectClientSetting(state, SETTINGS.OS_NOTIFICATIONS_ENABLED);
|
export const selectosNotificationsEnabled = (state) => selectClientSetting(state, SETTINGS.OS_NOTIFICATIONS_ENABLED);
|
||||||
|
|
Loading…
Add table
Reference in a new issue