diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index c3f27cf..27d383c 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -2,11 +2,13 @@ import * as React from 'react'; import { connect } from 'react-redux'; import { Dispatch } from 'redux'; -import { NonIdealState, Spinner } from '@blueprintjs/core'; +import { Button, Classes, Dialog, NonIdealState, Spinner } from '@blueprintjs/core'; +import { IconNames } from '@blueprintjs/icons'; import { Graph } from './components/Graph'; import { Nav } from './components/Nav'; import { Sidebar } from './components/Sidebar'; +import { DESKTOP_WIDTH_THRESHOLD } from './constants'; import { fetchGraph, fetchInstances } from './redux/actions'; import { IAppState, IGraph, IInstance } from './redux/types'; @@ -18,7 +20,16 @@ interface IAppProps { fetchInstances: () => void; fetchGraph: () => void; } -class AppImpl extends React.Component { +interface IAppLocalState { + mobileDialogOpen: boolean; +} +class AppImpl extends React.Component { + + constructor(props: IAppProps) { + super(props); + this.state = { mobileDialogOpen: false }; + } + public render() { let body =
; if (this.props.isLoadingInstances || this.props.isLoadingGraph) { @@ -30,11 +41,15 @@ class AppImpl extends React.Component {
); } public componentDidMount() { + if (window.innerWidth < DESKTOP_WIDTH_THRESHOLD) { + this.handleMobileDialogOpen(); + } this.load(); } @@ -68,6 +83,42 @@ class AppImpl extends React.Component { /> ) } + + private renderMobileDialog = () => { + return ( + +
+

+ fediverse.space is optimized for desktop computers. Feel free to check it out on your phone + (ideally in landscape mode) but for best results, open it on a computer. +

+
+
+
+
+
+
+ ); + } + + private handleMobileDialogOpen = () => { + this.setState({ mobileDialogOpen: true }); + } + + private handleMobileDialogClose = () => { + this.setState({ mobileDialogOpen: false }); + } } const mapStateToProps = (state: IAppState) => ({ diff --git a/frontend/src/constants.tsx b/frontend/src/constants.tsx new file mode 100644 index 0000000..8a373fa --- /dev/null +++ b/frontend/src/constants.tsx @@ -0,0 +1,2 @@ +/* Screen widths less than this will be treated as mobile */ +export const DESKTOP_WIDTH_THRESHOLD = 800;