Skip to content

Commit

Permalink
Add option to add info banner at login screen (asreview#1697)
Browse files Browse the repository at this point in the history
  • Loading branch information
cskaandorp authored Mar 11, 2024
1 parent ce90898 commit 80430f6
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
4 changes: 2 additions & 2 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Install Python and [Node.js](https://nodejs.org/en) (we use Node v20).
Install ASReview in editable mode

```sh
pip install -e .[dev]
pip install -e ".[dev]"
```

Navigate into `asreview/webapp` and install NPM packages
Expand Down Expand Up @@ -133,7 +133,7 @@ pip install asreview[dev]
Run the following commands to lint and format:

```sh
ruff .
ruff check .
ruff format .
```

Expand Down
8 changes: 1 addition & 7 deletions asreview/webapp/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,13 @@ def api_boot():
"""Get the boot info."""

authenticated = not app.config.get("LOGIN_DISABLED", False)

response = {
"authentication": authenticated,
"version": asreview_version,
"login_info": app.config.get("LOGIN_INFO", None),
}

if authenticated:
# if recaptcha config is provided for account creation
if app.config.get("RE_CAPTCHA_V3", False):
response["recaptchav3_key"] = app.config["RE_CAPTCHA_V3"].get(
"KEY", False
)

response["allow_account_creation"] = app.config.get(
"ALLOW_ACCOUNT_CREATION", False
)
Expand Down
17 changes: 17 additions & 0 deletions asreview/webapp/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const App = (props) => {
);
const emailConfig = useSelector((state) => state.email_config);
const emailVerification = useSelector((state) => state.email_verification);
const loginInfo = useSelector((state) => state.login_info);

// Snackbar Notification (taking care of self closing
// notifications visible on the lower left side)
Expand Down Expand Up @@ -237,6 +238,21 @@ const App = (props) => {
<CssBaseline />

<div aria-label="nav and main content">
{loginInfo !== null && (
<Alert
severity="info"
variant="standard"
sx={{
padding: "2px",
paddingLeft: "6px",
margin: 0,
borderRadius: 0,
}}
>
{loginInfo}
</Alert>
)}

{appReady === false && (
<Box
display="flex"
Expand All @@ -247,6 +263,7 @@ const App = (props) => {
<CircularProgress />
</Box>
)}

{appReady === true && authentication === false && (
<Routes>{render_routes()}</Routes>
)}
Expand Down
1 change: 0 additions & 1 deletion asreview/webapp/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ render(
</AuthProvider>
</BrowserRouter>
</Provider>
,
</React.StrictMode>,
document.getElementById("root"),
);
1 change: 1 addition & 0 deletions asreview/webapp/src/redux/reducers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function rootReducer(state = initialState, action) {
return Object.assign({}, state, {
asreview_version: action.data.version,
authentication: action.data.authentication,
login_info: action.data.login_info,
status: action.data.status,
email_verification: Boolean(action.data.email_verification),
email_config: Boolean(action.data.email_config),
Expand Down

0 comments on commit 80430f6

Please sign in to comment.