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