mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-15 09:58:18 -07:00
Refactor app structure
This commit is contained in:
parent
06b0fed11d
commit
d748372a28
33
README.md
33
README.md
@ -76,21 +76,24 @@ Jellyfin Web is the frontend used for most of the clients available for end user
|
|||||||
```
|
```
|
||||||
.
|
.
|
||||||
└── src
|
└── src
|
||||||
├── assets # Static assets
|
├── apps
|
||||||
├── components # Higher order visual components and React components
|
│ ├── experimental # New experimental app layout
|
||||||
├── controllers # Legacy page views and controllers 🧹
|
│ └── stable # Classic (stable) app layout
|
||||||
├── elements # Basic webcomponents and React wrappers 🧹
|
├── assets # Static assets
|
||||||
├── hooks # Custom React hooks
|
├── components # Higher order visual components and React components
|
||||||
├── legacy # Polyfills for legacy browsers
|
├── controllers # Legacy page views and controllers 🧹
|
||||||
├── libraries # Third party libraries 🧹
|
├── elements # Basic webcomponents and React wrappers 🧹
|
||||||
├── plugins # Client plugins
|
├── hooks # Custom React hooks
|
||||||
├── routes # React routes/pages
|
├── legacy # Polyfills for legacy browsers
|
||||||
├── scripts # Random assortment of visual components and utilities 🐉
|
├── libraries # Third party libraries 🧹
|
||||||
├── strings # Translation files
|
├── plugins # Client plugins
|
||||||
├── styles # Common app Sass stylesheets
|
├── routes # React routes/pages
|
||||||
├── themes # CSS themes
|
├── scripts # Random assortment of visual components and utilities 🐉
|
||||||
├── types # Common TypeScript interfaces/types
|
├── strings # Translation files
|
||||||
└── utils # Utility functions
|
├── styles # Common app Sass stylesheets
|
||||||
|
├── themes # CSS themes
|
||||||
|
├── types # Common TypeScript interfaces/types
|
||||||
|
└── utils # Utility functions
|
||||||
```
|
```
|
||||||
|
|
||||||
- 🧹 — Needs cleanup
|
- 🧹 — Needs cleanup
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
|
import loadable from '@loadable/component';
|
||||||
import { History } from '@remix-run/router';
|
import { History } from '@remix-run/router';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
|
import StableApp from './apps/stable/App';
|
||||||
import AppHeader from './components/AppHeader';
|
import AppHeader from './components/AppHeader';
|
||||||
import Backdrop from './components/Backdrop';
|
import Backdrop from './components/Backdrop';
|
||||||
import { HistoryRouter } from './components/HistoryRouter';
|
import { HistoryRouter } from './components/HistoryRouter';
|
||||||
import { ApiProvider } from './hooks/useApi';
|
import { ApiProvider } from './hooks/useApi';
|
||||||
import { AppRoutes, ExperimentalAppRoutes } from './routes';
|
|
||||||
|
|
||||||
const App = ({ history }: { history: History }) => {
|
const ExperimentalApp = loadable(() => import('./apps/experimental/App'));
|
||||||
|
|
||||||
|
const RootApp = ({ history }: { history: History }) => {
|
||||||
const layoutMode = localStorage.getItem('layout');
|
const layoutMode = localStorage.getItem('layout');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -18,11 +21,15 @@ const App = ({ history }: { history: History }) => {
|
|||||||
|
|
||||||
<div className='mainAnimatedPages skinBody' />
|
<div className='mainAnimatedPages skinBody' />
|
||||||
<div className='skinBody'>
|
<div className='skinBody'>
|
||||||
{layoutMode === 'experimental' ? <ExperimentalAppRoutes /> : <AppRoutes /> }
|
{
|
||||||
|
layoutMode === 'experimental' ?
|
||||||
|
<ExperimentalApp /> :
|
||||||
|
<StableApp />
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</HistoryRouter>
|
</HistoryRouter>
|
||||||
</ApiProvider>
|
</ApiProvider>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default App;
|
export default RootApp;
|
19
src/apps/experimental/App.tsx
Normal file
19
src/apps/experimental/App.tsx
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import AppHeader from '../../components/AppHeader';
|
||||||
|
import Backdrop from '../../components/Backdrop';
|
||||||
|
import { ExperimentalAppRoutes } from './routes/AppRoutes';
|
||||||
|
|
||||||
|
const ExperimentalApp = () => (
|
||||||
|
<>
|
||||||
|
<Backdrop />
|
||||||
|
<AppHeader />
|
||||||
|
|
||||||
|
<div className='mainAnimatedPages skinBody' />
|
||||||
|
<div className='skinBody'>
|
||||||
|
<ExperimentalAppRoutes />
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default ExperimentalApp;
|
@ -1,10 +1,10 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Navigate, Route, Routes } from 'react-router-dom';
|
import { Navigate, Route, Routes } from 'react-router-dom';
|
||||||
|
|
||||||
import ConnectionRequired from '../../components/ConnectionRequired';
|
import ConnectionRequired from '../../../components/ConnectionRequired';
|
||||||
import ServerContentPage from '../../components/ServerContentPage';
|
import ServerContentPage from '../../../components/ServerContentPage';
|
||||||
import { toAsyncPageRoute } from '../AsyncRoute';
|
import { toAsyncPageRoute } from '../../../components/router/AsyncRoute';
|
||||||
import { toViewManagerPageRoute } from '../LegacyRoute';
|
import { toViewManagerPageRoute } from '../../../components/router/LegacyRoute';
|
||||||
import { ASYNC_ADMIN_ROUTES, ASYNC_USER_ROUTES } from './asyncRoutes';
|
import { ASYNC_ADMIN_ROUTES, ASYNC_USER_ROUTES } from './asyncRoutes';
|
||||||
import { LEGACY_ADMIN_ROUTES, LEGACY_PUBLIC_ROUTES, LEGACY_USER_ROUTES } from './legacyRoutes';
|
import { LEGACY_ADMIN_ROUTES, LEGACY_PUBLIC_ROUTES, LEGACY_USER_ROUTES } from './legacyRoutes';
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
import { AsyncRoute } from '../../AsyncRoute';
|
import { AsyncRoute } from '../../../../components/router/AsyncRoute';
|
||||||
|
|
||||||
export const ASYNC_ADMIN_ROUTES: AsyncRoute[] = [
|
export const ASYNC_ADMIN_ROUTES: AsyncRoute[] = [
|
||||||
{ path: 'usernew.html', page: 'user/usernew' },
|
{ path: 'usernew.html', page: 'user/usernew' },
|
@ -1,4 +1,4 @@
|
|||||||
import { AsyncRoute } from '../../AsyncRoute';
|
import { AsyncRoute } from '../../../../components/router/AsyncRoute';
|
||||||
|
|
||||||
export const ASYNC_USER_ROUTES: AsyncRoute[] = [
|
export const ASYNC_USER_ROUTES: AsyncRoute[] = [
|
||||||
{ path: 'search.html', page: 'search' },
|
{ path: 'search.html', page: 'search' },
|
@ -1,4 +1,4 @@
|
|||||||
import { LegacyRoute } from '../../LegacyRoute';
|
import { LegacyRoute } from '../../../../components/router/LegacyRoute';
|
||||||
|
|
||||||
export const LEGACY_ADMIN_ROUTES: LegacyRoute[] = [
|
export const LEGACY_ADMIN_ROUTES: LegacyRoute[] = [
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
import { LegacyRoute } from '../../LegacyRoute';
|
import { LegacyRoute } from '../../../../components/router/LegacyRoute';
|
||||||
|
|
||||||
export const LEGACY_PUBLIC_ROUTES: LegacyRoute[] = [
|
export const LEGACY_PUBLIC_ROUTES: LegacyRoute[] = [
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
import { LegacyRoute } from '../../LegacyRoute';
|
import { LegacyRoute } from '../../../../components/router/LegacyRoute';
|
||||||
|
|
||||||
export const LEGACY_USER_ROUTES: LegacyRoute[] = [
|
export const LEGACY_USER_ROUTES: LegacyRoute[] = [
|
||||||
{
|
{
|
19
src/apps/stable/App.tsx
Normal file
19
src/apps/stable/App.tsx
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import AppHeader from '../../components/AppHeader';
|
||||||
|
import Backdrop from '../../components/Backdrop';
|
||||||
|
import { AppRoutes } from './routes/AppRoutes';
|
||||||
|
|
||||||
|
const StableApp = () => (
|
||||||
|
<>
|
||||||
|
<Backdrop />
|
||||||
|
<AppHeader />
|
||||||
|
|
||||||
|
<div className='mainAnimatedPages skinBody' />
|
||||||
|
<div className='skinBody'>
|
||||||
|
<AppRoutes />
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default StableApp;
|
@ -1,10 +1,10 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Navigate, Route, Routes } from 'react-router-dom';
|
import { Navigate, Route, Routes } from 'react-router-dom';
|
||||||
|
|
||||||
import ConnectionRequired from '../../components/ConnectionRequired';
|
import ConnectionRequired from '../../../components/ConnectionRequired';
|
||||||
import ServerContentPage from '../../components/ServerContentPage';
|
import ServerContentPage from '../../../components/ServerContentPage';
|
||||||
import { toAsyncPageRoute } from '../AsyncRoute';
|
import { toAsyncPageRoute } from '../../../components/router/AsyncRoute';
|
||||||
import { toViewManagerPageRoute } from '../LegacyRoute';
|
import { toViewManagerPageRoute } from '../../../components/router/LegacyRoute';
|
||||||
import { ASYNC_USER_ROUTES } from './asyncRoutes';
|
import { ASYNC_USER_ROUTES } from './asyncRoutes';
|
||||||
import { LEGACY_ADMIN_ROUTES, LEGACY_PUBLIC_ROUTES, LEGACY_USER_ROUTES } from './legacyRoutes';
|
import { LEGACY_ADMIN_ROUTES, LEGACY_PUBLIC_ROUTES, LEGACY_USER_ROUTES } from './legacyRoutes';
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
import { AsyncRoute } from '../../AsyncRoute';
|
import { AsyncRoute } from '../../../../components/router/AsyncRoute';
|
||||||
|
|
||||||
export const ASYNC_USER_ROUTES: AsyncRoute[] = [
|
export const ASYNC_USER_ROUTES: AsyncRoute[] = [
|
||||||
{ path: 'search.html', page: 'search' }
|
{ path: 'search.html', page: 'search' }
|
@ -1,4 +1,4 @@
|
|||||||
import { LegacyRoute } from '../../LegacyRoute';
|
import { LegacyRoute } from '../../../../components/router/LegacyRoute';
|
||||||
|
|
||||||
export const LEGACY_ADMIN_ROUTES: LegacyRoute[] = [
|
export const LEGACY_ADMIN_ROUTES: LegacyRoute[] = [
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
import { LegacyRoute } from '../../LegacyRoute';
|
import { LegacyRoute } from '../../../../components/router/LegacyRoute';
|
||||||
|
|
||||||
export const LEGACY_PUBLIC_ROUTES: LegacyRoute[] = [
|
export const LEGACY_PUBLIC_ROUTES: LegacyRoute[] = [
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
import { LegacyRoute } from '../../LegacyRoute';
|
import { LegacyRoute } from '../../../../components/router/LegacyRoute';
|
||||||
|
|
||||||
export const LEGACY_USER_ROUTES: LegacyRoute[] = [
|
export const LEGACY_USER_ROUTES: LegacyRoute[] = [
|
||||||
{
|
{
|
@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Route } from 'react-router-dom';
|
import { Route } from 'react-router-dom';
|
||||||
|
|
||||||
import AsyncPage from '../components/AsyncPage';
|
import AsyncPage from '../AsyncPage';
|
||||||
|
|
||||||
export interface AsyncRoute {
|
export interface AsyncRoute {
|
||||||
/** The URL path for this route. */
|
/** The URL path for this route. */
|
@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Route } from 'react-router-dom';
|
import { Route } from 'react-router-dom';
|
||||||
|
|
||||||
import ViewManagerPage, { ViewManagerPageProps } from '../components/viewManager/ViewManagerPage';
|
import ViewManagerPage, { ViewManagerPageProps } from '../viewManager/ViewManagerPage';
|
||||||
|
|
||||||
export interface LegacyRoute {
|
export interface LegacyRoute {
|
||||||
path: string,
|
path: string,
|
@ -34,7 +34,7 @@ import './legacy/htmlMediaElement';
|
|||||||
import './legacy/vendorStyles';
|
import './legacy/vendorStyles';
|
||||||
import { currentSettings } from './scripts/settings/userSettings';
|
import { currentSettings } from './scripts/settings/userSettings';
|
||||||
import taskButton from './scripts/taskbutton';
|
import taskButton from './scripts/taskbutton';
|
||||||
import App from './App.tsx';
|
import RootApp from './RootApp.tsx';
|
||||||
|
|
||||||
import './styles/livetv.scss';
|
import './styles/livetv.scss';
|
||||||
import './styles/dashboard.scss';
|
import './styles/dashboard.scss';
|
||||||
@ -151,7 +151,7 @@ async function onAppReady() {
|
|||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<StrictMode>
|
<StrictMode>
|
||||||
<App history={history} />
|
<RootApp history={history} />
|
||||||
</StrictMode>,
|
</StrictMode>,
|
||||||
root
|
root
|
||||||
);
|
);
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
export * from './appRoutes';
|
|
||||||
export * from './experimentalAppRoutes';
|
|
Loading…
Reference in New Issue
Block a user