Skip to content

Commit

Permalink
fix(fe): admin dashboard now shows without error
Browse files Browse the repository at this point in the history
  • Loading branch information
ADRFranklin committed Mar 31, 2024
1 parent 1e381f4 commit 5a596d5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 24 deletions.
43 changes: 22 additions & 21 deletions pkg/frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,30 +34,31 @@ const popupCenter = (url, title, w, h) => {
var width = window.innerWidth
? window.innerWidth
: document.documentElement.clientWidth
? document.documentElement.clientWidth
: screen.width;
? document.documentElement.clientWidth
: window.screen.width;
var height = window.innerHeight
? window.innerHeight
: document.documentElement.clientHeight
? document.documentElement.clientHeight
: screen.height;
? document.documentElement.clientHeight
: window.screen.height;

var left = width / 2 - w / 2 + dualScreenLeft;
var top = height / 2 - h / 2 + dualScreenTop;
var newWindow = window.open(
url,
title,
'scrollbars=yes, width=' +
w +
', height=' +
h +
', top=' +
top +
', left=' +
left,
w +
', height=' +
h +
', top=' +
top +
', left=' +
left,
);

if (window.focus) newWindow.focus();
if (newWindow) {
newWindow.focus();
}
return newWindow;
};

Expand Down Expand Up @@ -98,7 +99,7 @@ class App extends React.Component {

msg(
data = {
message: String,
message: '',
type: 'info',
},
) {
Expand Down Expand Up @@ -136,6 +137,7 @@ class App extends React.Component {
if (/^\s/.test(username)) {
this.msg({
type: 'error',
// @ts-ignore
message:
'The username you entered contains a space before! Please remove it',
});
Expand All @@ -144,6 +146,7 @@ class App extends React.Component {
if (/^\s/.test(password)) {
this.msg({
type: 'error',
// @ts-ignore
message:
'The password you entered contains a space before! Please remove it',
});
Expand Down Expand Up @@ -336,9 +339,8 @@ class App extends React.Component {
return (
<div
key={`${msg.timestamp}__${i}`}
className={`push-msg--item ${
msg.type !== 'info' ? msg.type : ''
}`}
className={`push-msg--item ${msg.type !== 'info' ? msg.type : ''
}`}
>
{msg.message}
</div>
Expand All @@ -363,7 +365,7 @@ class App extends React.Component {
onChange={this.inputChange}
autoComplete="username"
/>
{this.state.login_type === 1 ? (
{this.state.login_type === true ? (
<>
<p style={{ marginBottom: '5px' }}>Password</p>
<input
Expand Down Expand Up @@ -435,9 +437,8 @@ class App extends React.Component {
return (
<div
key={`msg__${msg.timestamp}__${i}`}
className={`push-msg--item ${
msg.type !== 'info' ? msg.type : ''
}`}
className={`push-msg--item ${msg.type !== 'info' ? msg.type : ''
}`}
>
{msg.message}
</div>
Expand Down
4 changes: 2 additions & 2 deletions pkg/frontend/src/pages/admin/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect } from 'react';
import { connect } from 'react-redux';
import { Route, Switch } from 'react-router';
import { Link } from 'react-router-dom';
import { Link, Route, Switch } from 'react-router-dom';


import NotFound from '../404';
import { Login } from '../../components/login';
Expand Down
3 changes: 2 additions & 1 deletion pkg/frontend/src/pages/admin/settings.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Route, Switch, useHistory } from 'react-router';
import { useHistory } from 'react-router';
import { Route, Switch } from 'react-router-dom';

import AdminSettingsSidebar from '../../components/adminSettingsSidebar';
import Meta from '../../components/meta';
Expand Down

0 comments on commit 5a596d5

Please sign in to comment.