Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add read-only dialog for mobile #428

Merged
merged 1 commit into from
Apr 14, 2023
Merged
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
4 changes: 4 additions & 0 deletions src/ui/QuadraticUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import { GetCellsDBSetSheet } from '../grid/sheet/Cells/GetCellsDB';
import { PixiApp } from '../gridGL/pixiApp/PixiApp';
import { SheetController } from '../grid/controller/sheetController';
import { LocalFilesContext } from './QuadraticUIContext';
import ReadOnlyDialog from './components/ReadOnlyDialog';
import { IS_READONLY_MODE } from '../constants/app';

export default function QuadraticUI({ app, sheetController }: { app: PixiApp; sheetController: SheetController }) {
const [showDebugMenu] = useLocalStorage('showDebugMenu', false);
Expand Down Expand Up @@ -83,6 +85,8 @@ export default function QuadraticUI({ app, sheetController }: { app: PixiApp; sh
{presentationMode && <PresentationModeHint />}
<SnackBar {...snackBar} />
{hasInitialPageLoadError && <InitialPageLoadError />}

{IS_READONLY_MODE && <ReadOnlyDialog />}
</div>
);
}
30 changes: 30 additions & 0 deletions src/ui/components/ReadOnlyDialog.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from '@mui/material';
import useLocalStorage from '../../hooks/useLocalStorage';

export default function ReadOnlyDialog() {
const [showReadOnlyMsg, setShowReadOnlyMsg] = useLocalStorage('showReadOnlyMsg', true);
const handleClose = () => {
setShowReadOnlyMsg(false);
};
return (
<Dialog
open={showReadOnlyMsg}
onClose={handleClose}
aria-labelledby="alert-dialog-title"
aria-describedby="alert-dialog-description"
>
<DialogTitle id="alert-dialog-title">Quadratic is built for desktop</DialogTitle>
<DialogContent>
<DialogContentText id="alert-dialog-description">
On mobile, sheets are read-only. To edit sheets, run code, and use the full power of the app, open it on your
desktop computer.
</DialogContentText>
</DialogContent>
<DialogActions>
<Button onClick={handleClose} autoFocus>
Ok, thanks
</Button>
</DialogActions>
</Dialog>
);
}