v1.0; mobile debug

This commit is contained in:
2020-10-30 22:46:02 +03:00
parent 05c8f36bda
commit ebb2e1f65d
9 changed files with 2046 additions and 2639 deletions
+1 -1
View File
@@ -30,7 +30,7 @@
"node-sass": "4.14.1", "node-sass": "4.14.1",
"redux-devtools-extension": "2.13.8", "redux-devtools-extension": "2.13.8",
"typescript": "4.0.5", "typescript": "4.0.5",
"react-scripts": "4.0.0" "react-scripts": "3.4.4"
}, },
"scripts": { "scripts": {
"start": "react-scripts start", "start": "react-scripts start",
-4
View File
@@ -6,16 +6,12 @@ import store from "./store/store";
import * as Sentry from '@sentry/react'; import * as Sentry from '@sentry/react';
import App from './pages/App/App'; import App from './pages/App/App';
import * as serviceWorker from './serviceWorker'; import * as serviceWorker from './serviceWorker';
// @ts-ignore
import eruda from 'eruda';
if(process.env.NODE_ENV === 'production') if(process.env.NODE_ENV === 'production')
Sentry.init({ Sentry.init({
dsn: "https://27a5473611834ece9aca26216d79ad86@sentry.io/1810028" dsn: "https://27a5473611834ece9aca26216d79ad86@sentry.io/1810028"
}); });
eruda.init();
ReactDOM.render( ReactDOM.render(
<BrowserRouter> <BrowserRouter>
<Provider store={store}> <Provider store={store}>
+5
View File
@@ -28,6 +28,9 @@ import Settings from "../User/Settings/Settings";
import { setUser } from "../../store/ducks/currentUser"; import { setUser } from "../../store/ducks/currentUser";
import { setSettings } from "../../store/ducks/userSettings"; import { setSettings } from "../../store/ducks/userSettings";
import { withProfiler } from "@sentry/react"; import { withProfiler } from "@sentry/react";
// @ts-ignore
import eruda from 'eruda';
import { hasPermission } from "../../utils";
type Props = { type Props = {
notifications: React.ReactNode[] notifications: React.ReactNode[]
@@ -64,6 +67,8 @@ class App extends React.Component<Props, State> {
document.body.setAttribute('theme', settings.theme); document.body.setAttribute('theme', settings.theme);
} }
}); });
if(hasPermission(user, 'mobile_debug'))
eruda.init();
}).catch((err: ApiError) => { }).catch((err: ApiError) => {
if(err.code !== 3 && err.text) if(err.code !== 3 && err.text)
console.error(err.text); console.error(err.text);
+2
View File
@@ -19,6 +19,8 @@
height: 250px height: 250px
margin-right: .5rem margin-right: .5rem
border-radius: $borderRadius border-radius: $borderRadius
background-size: cover
background-position: center
.Character__Info .Character__Info
display: flex display: flex
+1 -1
View File
@@ -30,7 +30,7 @@ class News extends React.Component<{}, State> {
<div>Новости</div> <div>Новости</div>
<Link to={'/news'}>Все новости</Link> <Link to={'/news'}>Все новости</Link>
</div> </div>
{news.slice(0, 3).map(post => ( {news.slice(0, 3).sort((a, b) => b.id-a.id).map(post => (
<Link key={post.id} to={`/news/${post.id}`}> <Link key={post.id} to={`/news/${post.id}`}>
<NewsPost {...post} /> <NewsPost {...post} />
</Link> </Link>
+2 -3
View File
@@ -115,7 +115,6 @@
.Novel__Character .Novel__Character
box-sizing: border-box box-sizing: border-box
width: 150px width: 150px
height: 250px
border-radius: $borderRadius border-radius: $borderRadius
background-color: var(--block-color) background-color: var(--block-color)
margin: 0 .5rem margin: 0 .5rem
@@ -126,8 +125,8 @@
.Character_Image .Character_Image
border-radius: $borderRadius $borderRadius 0 0 border-radius: $borderRadius $borderRadius 0 0
width: 100% width: 150px
height: calc(100% - 1.5rem) height: 250px
background-size: cover background-size: cover
background-position: center background-position: center
margin-bottom: .2rem margin-bottom: .2rem
+4 -2
View File
@@ -9,8 +9,10 @@ const getRandomInt: (min: number, max: number) => number = (min: number, max: nu
}; };
const hasPermission = (user: UserType, permission: string) => { const hasPermission = (user: UserType, permission: string) => {
const permissions = user?.group?.permissions.split(','); if(!user.group) return false;
return permissions?.filter(perm => perm === permission).length > 0; if(user.is_superuser || user.group.is_superuser) return true;
const permissions = user.group.permissions.split(',');
return permissions.filter(perm => perm === permission).length > 0;
}; };
const hasAccessToAdminPanel = (user: UserType) => user.is_superuser || user.group.is_superuser || hasPermission(user, 'admin_panel') const hasAccessToAdminPanel = (user: UserType) => user.is_superuser || user.group.is_superuser || hasPermission(user, 'admin_panel')
+2029 -2626
View File
File diff suppressed because it is too large Load Diff