| 835 | } |
| 836 | |
| 837 | const getVariables = () => { |
| 838 | if ( |
| 839 | isUpvoted || |
| 840 | feedWithDateRange.includes(tab) || |
| 841 | feedWithDateRange.includes(urlToTab[router.pathname]) |
| 842 | ) { |
| 843 | return { ...config.variables, period: periods[selectedPeriod].value }; |
| 844 | } |
| 845 | |
| 846 | if (isAnyExplore) { |
| 847 | const laptopValue = |
| 848 | tab === ExploreTabs.ByDate || isExploreLatest ? 1 : 0; |
| 849 | const mobileValue = |
| 850 | urlToTab[router.pathname] === ExploreTabs.ByDate ? 1 : 0; |
| 851 | const finalAlgo = isLaptop ? laptopValue : mobileValue; |
| 852 | |
| 853 | return { |
| 854 | ...config.variables, |
| 855 | ranking: algorithms[finalAlgo].value, |
| 856 | }; |
| 857 | } |
| 858 | |
| 859 | if (isSortableFeed) { |
| 860 | return { |
| 861 | ...config.variables, |
| 862 | ranking: algorithms[selectedAlgo].value, |
| 863 | }; |
| 864 | } |
| 865 | |
| 866 | return config.variables; |
| 867 | }; |
| 868 | |
| 869 | // The draft goes last, so the feed's own key is this one without it. |
| 870 | const feedVariables = getVariables(); |