Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Grayjay.ClientServer/Settings/GrayjaySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ public class HomeSettings
//[SettingsField("Preview Feed Items", SettingsField.TOGGLE, "When the preview feedstyle is used, if items should auto-preview when scrolling over them", 6)]
//public bool PreviewFeedItems { get; set; } = true;

[SettingsField("Recommendations on home", SettingsField.TOGGLE, "Show recommendations on home page", 1)]
public bool RecommendationsHomepage { get; set; } = true;

[SettingsField("Recommendations on videos", SettingsField.TOGGLE, "Show recommendations beside videos", 1)]
public bool ShowRecommendations { get; set; } = true;

[SettingsField("Progress Bar", SettingsField.TOGGLE, "If a historical progress bar should be shown", 7)]
public bool ProgressBar { get; set; } = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ const VideoDetailView: Component<VideoDetailsProps> = (props) => {
const [recomPager$] = createResource<Pager<IPlatformContent>>(() => videoLoaded$(), async (videoLoaded: any) => {
if(!videoLoaded)
return undefined;
showRecommendations=(await SettingsBackend.settings())?.object?.home?.showRecommendations;
const result = await DetailsBackend.recommendationsPager(videoLoaded.url);
console.log("Recommendation Results:", result);
return result;
Expand Down Expand Up @@ -535,7 +536,8 @@ const VideoDetailView: Component<VideoDetailsProps> = (props) => {
});

const videoLoadedIsValid$ = createMemo(() => videoLoaded$()?.url === currentVideo$()?.url);
const recommendationsVisible$ = createMemo(() => videoLoadedIsValid$() && recomPager$.state == "ready" && recomPager$()?.data && recomPager$()?.data.length);
let showRecommendations=false;
const recommendationsVisible$ = createMemo(() => videoLoadedIsValid$() && recomPager$.state == "ready" && recomPager$()?.data && recomPager$()?.data.length && showRecommendations);
const shouldHideSideBar = createMemo(() => {
//TODO: Expand these conditions
const sideBarVisible = shouldShowQueue() || liveChatWindow$() || recommendationsVisible$();
Expand Down
3 changes: 2 additions & 1 deletion Grayjay.Desktop.Web/src/components/menus/SideBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ const SideBar: Component<SideBarProps> = (props: SideBarProps) => {
action?: () => void,
onRightClick?: () => void
}> = [
{ icon: home, name: 'Home', path: '/web/home', selected: location.pathname === '/web/home' || location.pathname === '/web/index.html' },
{ icon: home, name: 'Home', path: '/web/home', selected: location.pathname === '/web/home' || location.pathname === '/web/index.html' },
{ icon: home, name: 'Recommended', path: '/web/recommended', selected: location.pathname === '/web/recommended'},
{ icon: subscriptions, name: 'Subscriptions', path: '/web/subscriptions', selected: location.pathname === '/web/subscriptions' },
{ icon: creators, name: 'Creators', path: '/web/creators', selected: location.pathname === '/web/creators' },
{ icon: playlists, name: 'Playlists', path: '/web/playlists', selected: location.pathname === '/web/playlists' },
Expand Down
10 changes: 7 additions & 3 deletions Grayjay.Desktop.Web/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import GlobalContextMenu from './components/GlobalContextMenu';
import BuyPage from './pages/BuyPage';
import UIOverlay from './state/UIOverlay';
import ExceptionModel from './backend/exceptions/ExceptionModel';
import { SettingsBackend } from './backend/SettingsBackend';

const HomePage = lazy(() => import('./pages/Home'));
const SubscriptionsPage = lazy(() => import('./pages/Subscriptions'));
Expand Down Expand Up @@ -147,11 +148,14 @@ const App: Component<RouteSectionProps> = (props) => {
</>
};

const DefaultPage=(await SettingsBackend.settings())?.object?.home?.recommendationsHomepage? HomePage: SubscriptionsPage;

render(() => (
<Router root={App}>
<Route path="/web/index.html" component={HomePage} />
<Route path="/web" component={HomePage} />
<Route path="/web/home" component={HomePage} />
<Route path="/web/index.html" component={DefaultPage} />
<Route path="/web" component={DefaultPage} />
<Route path="/web/home" component={DefaultPage} />
<Route path="/web/recommended" component={HomePage} />
<Route path="/web/search" component={SearchPage} />
<Route path="/web/subscriptions" component={SubscriptionsPage} />
<Route path="/web/creators" component={CreatorsPage} />
Expand Down