From 8767a0bbb7015cf9b9f186d55d7e336f9d5d3f1c Mon Sep 17 00:00:00 2001 From: trotto-bot Date: Tue, 7 Jun 2022 04:32:54 +0300 Subject: [PATCH] Support read-only mode --- frontend/package.json | 1 + frontend/src/components/LinkCreation.jsx | 17 ++ frontend/src/components/LinkList.jsx | 8 +- frontend/src/getters.js | 8 + frontend/yarn.lock | 187 +++++++++++------- server/src/modules/links/helpers.py | 4 + server/src/modules/users/handlers.py | 12 +- .../src/modules/users/tests/handlers_tests.py | 8 +- server/src/shared_helpers/config.py | 4 +- server/src/static/_scripts/bundle.js | 33 ++-- 10 files changed, 188 insertions(+), 94 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index 263e79f4..732b5297 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -27,6 +27,7 @@ "dependencies": { "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", + "@material-ui/lab": "4.0.0-alpha.61", "axios": "^0.21.1", "detect-browser": "^2.0.0", "hex-rgb": "^4.2.0", diff --git a/frontend/src/components/LinkCreation.jsx b/frontend/src/components/LinkCreation.jsx index 097c5194..ff8b0479 100644 --- a/frontend/src/components/LinkCreation.jsx +++ b/frontend/src/components/LinkCreation.jsx @@ -1,5 +1,6 @@ import React from 'react'; import {connect} from 'react-redux'; +import Alert from '@material-ui/lab/Alert'; import {CopyToClipboard} from 'react-copy-to-clipboard'; import * as actions from '../actions'; import * as getters from '../getters'; @@ -24,6 +25,7 @@ function mapStateToProps(state) { goSupportedInCurrentSession: state.get('goSupportedInCurrentSession'), userLoggedIn: getters.userLoggedIn(state), userInfo: state.get('userInfo'), + readOnlyMode: getters.readOnlyMode(state), namespaces: state.get('namespaces') }; } @@ -173,8 +175,20 @@ export class LinkForm extends React.Component { messageComponent = {messageText}; } + const infoBar = this.props.userInfo && this.props.userInfo.get('info_bar'); + return (