Frontent dev env (#247)

* Added frontend development files/environment

* More items-categories related removals

* Improvements in pages templates (inc. static pages)

* Improvements in video player

* Added empty home page message + cta

* Updates in media, playlist and management pages

* Improvements in material icons font loading

* Replaced media & playlists links in frontend dev-env

* frontend package version update

* chnaged frontend dev url port

* static files update

* Changed default position of theme switcher

* enabled frontend docker container
This commit is contained in:
Yiannis Stergiou
2021-07-11 18:01:34 +03:00
committed by GitHub
parent 060bb45725
commit aa6520daac
555 changed files with 201927 additions and 66002 deletions

View File

@@ -0,0 +1,62 @@
import React, { useState } from 'react';
import { ApiUrlConsumer } from '../utils/contexts/';
import { PageStore } from '../utils/stores/';
import { useUser } from '../utils/hooks/';
import { addClassname } from '../utils/helpers/';
import { MediaListWrapper } from '../components/MediaListWrapper';
import { LazyLoadItemListAsync } from '../components/item-list/LazyLoadItemListAsync.jsx';
import { ProfileHistoryPage } from './ProfileHistoryPage';
import { Page } from './Page';
declare global {
interface Window {
MediaCMS: any;
}
}
interface AnonymousHistoryPageProps {
id?: string;
title?: string;
}
export const AnonymousHistoryPage: React.FC<AnonymousHistoryPageProps> = ({
id = 'history-media',
title = PageStore.get('config-enabled').pages.history.title,
}) => {
const [resultsCount, setResultsCount] = useState<number | null>(null);
return (
<Page id={id}>
<ApiUrlConsumer>
{(apiUrl) => (
<MediaListWrapper
title={title + (null !== resultsCount ? ' (' + resultsCount + ')' : '')}
className="search-results-wrap items-list-hor"
>
<LazyLoadItemListAsync
singleLinkContent={false}
horizontalItemsOrientation={true}
itemsCountCallback={setResultsCount}
requestUrl={apiUrl.user.history}
hideViews={!PageStore.get('config-media-item').displayViews}
hideAuthor={!PageStore.get('config-media-item').displayAuthor}
hideDate={!PageStore.get('config-media-item').displayPublishDate}
/>
</MediaListWrapper>
)}
</ApiUrlConsumer>
</Page>
);
};
export const HistoryPage: React.FC = () => {
const { username, isAnonymous } = useUser();
const anonymousPage = isAnonymous || !PageStore.get('config-options').pages.profile.includeHistory;
if (!anonymousPage) {
addClassname(document.getElementById('page-history'), 'profile-page-history');
window.MediaCMS.profileId = username;
}
return anonymousPage ? <AnonymousHistoryPage /> : <ProfileHistoryPage />;
};