mirror of
https://github.com/bakhirev/assayo.git
synced 2024-11-16 08:11:40 +00:00
update
This commit is contained in:
parent
7f4dc72c79
commit
aa92bb3356
|
@ -14,7 +14,7 @@ import zh from 'ts/translations/zh';
|
|||
|
||||
import initializationI18n from './ts/helpers/i18n';
|
||||
|
||||
import Authorization from 'ts/pages/Authorization';
|
||||
import Main from 'ts/pages/index';
|
||||
import userSettings from 'ts/store/UserSettings';
|
||||
import themeSettings from 'ts/store/ThemeSettings';
|
||||
import Notifications from 'ts/components/Notifications';
|
||||
|
@ -48,7 +48,7 @@ function renderReactApplication() {
|
|||
render(
|
||||
<React.StrictMode>
|
||||
<HashRouter>
|
||||
<Authorization/>
|
||||
<Main />
|
||||
<Notifications/>
|
||||
</HashRouter>
|
||||
</React.StrictMode>,
|
||||
|
|
|
@ -4,14 +4,17 @@
|
|||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 3;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
z-index: 3;
|
||||
background-color: var(--color-white);
|
||||
|
||||
border: 8px dashed var(--color-black);
|
||||
background-color: rgba(255, 255, 255, 0.7);
|
||||
|
||||
&_icon {
|
||||
display: block;
|
||||
|
@ -22,13 +25,16 @@
|
|||
}
|
||||
|
||||
&_title {
|
||||
font-weight: 100;
|
||||
font-size: 24px;
|
||||
text-align: center;
|
||||
font-size: 32px;
|
||||
font-weight: bold;
|
||||
|
||||
display: block;
|
||||
width: 100%;
|
||||
color: black;
|
||||
|
||||
text-align: center;
|
||||
vertical-align: top;
|
||||
|
||||
color: var(--color-black);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ function DropZone({
|
|||
<div className={style.dropzone}>
|
||||
{/*<Dropzone className={style.dropzone_icon}/>*/}
|
||||
<p className={style.dropzone_title}>
|
||||
Ловлю!
|
||||
Drop file here
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
|
||||
import style from '../styles/index.module.scss';
|
||||
|
||||
const SOURCE_CODE = `JIRA-1227 fix(profile): change validation
|
||||
Counting objects: 100% (22/22), done.
|
||||
Delta compression using up to 8 threads
|
||||
JIRA-323 fix: change validation
|
||||
Writing objects: 100% (12/12), 1.88 KiB | 1.88 MiB/s, done.
|
||||
Total 12 (delta 9), reused 0 (delta 0), pack-reused 0
|
||||
`.split('\n');
|
||||
|
||||
function getRandomText(index: number, messages?: string[]) {
|
||||
const source = messages || SOURCE_CODE;
|
||||
const splitIndex = index % source.length;
|
||||
const start = source.slice(0, splitIndex);
|
||||
const end = source.slice(splitIndex);
|
||||
return [...end, ...start]
|
||||
.slice(0, 13)
|
||||
.map((text: string) => (<p key={text}>{text}</p>));
|
||||
}
|
||||
|
||||
interface IMarqueeProps {
|
||||
commitsInDay: number;
|
||||
messages?: string[];
|
||||
}
|
||||
|
||||
function Marquee({
|
||||
commitsInDay,
|
||||
messages,
|
||||
}: IMarqueeProps) {
|
||||
const [index, setIndex] = useState<number>(0);
|
||||
const text = getRandomText(index, messages);
|
||||
|
||||
useEffect(() => {
|
||||
const delay = 3000 * 6;
|
||||
const speed = Math.ceil(delay / (commitsInDay || 1));
|
||||
const timer = setInterval(() => {
|
||||
setIndex((value: number) => value + 1);
|
||||
}, speed);
|
||||
return () => {
|
||||
clearInterval(timer);
|
||||
};
|
||||
}, [commitsInDay]);
|
||||
|
||||
return (
|
||||
<div className={style.game_console_monitor}>
|
||||
<p id={`game-console-text-${index}`}>{text}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Marquee;
|
|
@ -1,57 +0,0 @@
|
|||
import React, { useState } from 'react';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
|
||||
import dataGripStore from 'ts/store/DataGrip';
|
||||
import SelectWithButtons from 'ts/components/UiKit/components/SelectWithButtons';
|
||||
|
||||
import Marquee from './components/marquee';
|
||||
|
||||
import style from './styles/index.module.scss';
|
||||
|
||||
|
||||
function getSpeedAndMessages(user: string) {
|
||||
const byTimestamp = dataGripStore.dataGrip.timestamp.statisticByAuthor[user];
|
||||
const commitsInDay = byTimestamp.commitsByTimestampCounter.max;
|
||||
|
||||
const startIndex = byTimestamp.allCommitsByTimestamp.length - 20;
|
||||
const messages = byTimestamp.allCommitsByTimestamp.slice(startIndex)
|
||||
.reduce((acc: string[], commit: any) => acc.concat(commit.messages), []);
|
||||
|
||||
return {
|
||||
speed: commitsInDay,
|
||||
messages: Array.from(new Set(messages)) as string[],
|
||||
};
|
||||
}
|
||||
|
||||
const GameConsole = observer((): React.ReactElement => {
|
||||
const employment = dataGripStore.dataGrip.author.employment;
|
||||
const authors = [
|
||||
...employment.active,
|
||||
...employment.dismissed,
|
||||
].map((title: string) => ({ id: title, title }));
|
||||
|
||||
const [user, setUser] = useState<any>(authors[0].id);
|
||||
|
||||
const { speed, messages } = getSpeedAndMessages(user);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={style.game_console}
|
||||
>
|
||||
<Marquee
|
||||
commitsInDay={speed}
|
||||
messages={messages}
|
||||
/>
|
||||
<SelectWithButtons
|
||||
value={user}
|
||||
options={authors}
|
||||
className={style.game_console_select}
|
||||
onChange={(newUser: any) => {
|
||||
setUser(newUser?.id || newUser);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
export default GameConsole;
|
|
@ -1,39 +0,0 @@
|
|||
.game_console {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
margin: 0 auto var(--space-xxl);
|
||||
|
||||
text-align: left;
|
||||
background-repeat: no-repeat;
|
||||
background-size: auto 100%;
|
||||
background-position: top left;
|
||||
|
||||
&_select {
|
||||
display: block;
|
||||
width: 500px;
|
||||
}
|
||||
|
||||
&_monitor {
|
||||
font-size: var(--font-s);
|
||||
font-weight: 100;
|
||||
|
||||
display: block;
|
||||
width: 500px;
|
||||
height: 250px;
|
||||
padding: 8px;
|
||||
margin: 0 0 var(--space-xxl);
|
||||
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
line-height: 1.3;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
border-radius: var(--border-radius-s);
|
||||
|
||||
border: 4px solid var(--color-32);
|
||||
box-shadow: 0 0 10px var(--color-black);
|
||||
color: #00B200;
|
||||
background-color: var(--color-black);
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ import ICommit from 'ts/interfaces/Commit';
|
|||
import IHashMap from 'ts/interfaces/HashMap';
|
||||
|
||||
import { ONE_DAY } from 'ts/helpers/formatter';
|
||||
import { increment } from 'ts/helpers/Math';
|
||||
|
||||
import settingsStore from 'ts/store/Settings';
|
||||
import userSettings from 'ts/store/UserSettings';
|
||||
|
@ -40,8 +41,8 @@ export default class DataGripByAuthor {
|
|||
statistic.days[commit.timestamp] = true;
|
||||
statistic.tasks[commit.task] = commit.added + commit.changes + commit.removed
|
||||
+ (statistic.tasks[commit.task] ? statistic.tasks[commit.task] : 0);
|
||||
statistic.types[commit.type] = statistic.types[commit.type] ? (statistic.types[commit.type] + 1) : 1;
|
||||
statistic.scopes[commit.scope] = statistic.scopes[commit.scope] ? (statistic.scopes[commit.scope] + 1) : 1;
|
||||
increment(statistic.types, commit.type);
|
||||
increment(statistic.scopes, commit.scope);
|
||||
statistic.hours.push(commit.hours);
|
||||
statistic.messageLength.push(commit.text.length);
|
||||
statistic.totalMessageLength += commit.text.length || 0;
|
||||
|
@ -130,9 +131,7 @@ export default class DataGripByAuthor {
|
|||
|
||||
commit.text.toLowerCase().split(' ').forEach(word => {
|
||||
if (word.length <= LIMIT_WORD_LENGTH || disabledWords[word]) return;
|
||||
total[word] = total[word]
|
||||
? (total[word] + 1)
|
||||
: 1;
|
||||
increment(total, word);
|
||||
});
|
||||
|
||||
return total;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { COMMIT_TYPE, ISystemCommit } from 'ts/interfaces/Commit';
|
||||
import IHashMap from 'ts/interfaces/HashMap';
|
||||
import { WeightedAverage } from 'ts/helpers/Math';
|
||||
import { increment, WeightedAverage } from 'ts/helpers/Math';
|
||||
|
||||
export default class DataGripByPR {
|
||||
pr: IHashMap<any> = {};
|
||||
|
@ -49,9 +49,7 @@ export default class DataGripByPR {
|
|||
const statistic = this.lastCommitByTaskNumber[commit.task];
|
||||
statistic.endTaskTime = commit.milliseconds;
|
||||
statistic.commits += 1;
|
||||
statistic.commitsByAuthors[commit.author] = statistic.commitsByAuthors[commit.author]
|
||||
? (statistic.commitsByAuthors[commit.author] + 1)
|
||||
: 1;
|
||||
increment(statistic.commitsByAuthors, commit.author);
|
||||
}
|
||||
|
||||
#addCommitByPR(commit: ISystemCommit) {
|
||||
|
|
|
@ -1,13 +1,29 @@
|
|||
import ICommit from 'ts/interfaces/Commit';
|
||||
import IHashMap from 'ts/interfaces/HashMap';
|
||||
import settingsStore from 'ts/store/Settings';
|
||||
import { increment } from 'ts/helpers/Math';
|
||||
|
||||
interface IStatByAuthor {
|
||||
commits: number; // number of commits by author in this scope
|
||||
days: IHashMap<boolean>; // commit timestamp
|
||||
types: IHashMap<number>; // commit type by author in this scope (fix, feat)
|
||||
}
|
||||
|
||||
interface IStatByScope {
|
||||
scope: string; // scope name
|
||||
commits: number; // number of commits in this scope
|
||||
days: IHashMap<boolean>; // commit timestamp
|
||||
tasks: IHashMap<boolean>; // task name in this scope (JIRA-123)
|
||||
types: IHashMap<number>; // commit type in this scope (fix, feat)
|
||||
authors: IHashMap<IStatByAuthor>; // stat by author for this scope
|
||||
}
|
||||
|
||||
export default class DataGripByScope {
|
||||
list: string[] = [];
|
||||
list: string[] = []; // scope names
|
||||
|
||||
commits: IHashMap<any> = {};
|
||||
commits: IHashMap<IStatByScope> = {};
|
||||
|
||||
statistic: any = [];
|
||||
statistic: IStatByScope[] = [];
|
||||
|
||||
clear() {
|
||||
this.list = [];
|
||||
|
@ -24,16 +40,17 @@ export default class DataGripByScope {
|
|||
}
|
||||
|
||||
#updateCommitByScope(commit: ICommit) {
|
||||
const statistic = this.commits[commit.scope];
|
||||
const statistic = this.commits[commit.scope] as IStatByScope;
|
||||
statistic.commits += 1;
|
||||
statistic.days[commit.timestamp] = true;
|
||||
statistic.tasks[commit.task] = true;
|
||||
statistic.types[commit.type] = statistic.types[commit.type] ? (statistic.types[commit.type] + 1) : 1;
|
||||
increment(statistic.types, commit.type);
|
||||
|
||||
const author = statistic.authors[commit.author];
|
||||
if (author) {
|
||||
author.commits += 1;
|
||||
author.days[commit.timestamp] = true;
|
||||
author.types[commit.type] = author.types[commit.type] ? (author.types[commit.type] + 1) : 1;
|
||||
increment(author.types, commit.type);
|
||||
} else {
|
||||
statistic.authors[commit.author] = this.#getDefaultAuthorForScope(commit);
|
||||
}
|
||||
|
@ -50,7 +67,7 @@ export default class DataGripByScope {
|
|||
};
|
||||
}
|
||||
|
||||
#getDefaultAuthorForScope(commit: ICommit) {
|
||||
#getDefaultAuthorForScope(commit: ICommit): IStatByAuthor {
|
||||
return {
|
||||
commits: 1,
|
||||
days: { [commit.timestamp]: true },
|
||||
|
|
|
@ -33,6 +33,7 @@ export default class DataGripByTasks {
|
|||
this.commits[commit.task] = [commit];
|
||||
}
|
||||
|
||||
// TODO: тут двойной пробег получился. А должен был частями собрать инфу
|
||||
updateTotalInfo(PRs: any) {
|
||||
this.statistic = Object.entries(this.commits)
|
||||
.map(([task, commits]: [string, ICommit[]]) => {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import ICommit from 'ts/interfaces/Commit';
|
||||
import IHashMap from 'ts/interfaces/HashMap';
|
||||
import settingsStore from 'ts/store/Settings';
|
||||
import { increment } from 'ts/helpers/Math';
|
||||
|
||||
import MinMaxCounter from './counter';
|
||||
|
||||
|
@ -43,9 +44,7 @@ export default class DataGripByTimestamp {
|
|||
#updateCommitByTimestamp(commit: ICommit, statistic: any) {
|
||||
statistic.commits += 1;
|
||||
statistic.addedAndChanges += commit.added + commit.changes;
|
||||
statistic.tasks[commit.task] = statistic.tasks[commit.task]
|
||||
? (statistic.tasks[commit.task] + 1)
|
||||
: 1;
|
||||
increment(statistic.tasks, commit.task);
|
||||
if (!statistic.tasksByAuthor[commit.author]) {
|
||||
statistic.tasksByAuthor[commit.author] = {};
|
||||
}
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
import ICommit from 'ts/interfaces/Commit';
|
||||
import IHashMap from 'ts/interfaces/HashMap';
|
||||
import { increment } from 'ts/helpers/Math';
|
||||
|
||||
export default class DataGripByType {
|
||||
list: string[] = [];
|
||||
|
||||
|
||||
commits: IHashMap<any> = {};
|
||||
|
||||
|
||||
statistic: any = [];
|
||||
|
||||
clear() {
|
||||
|
@ -28,14 +29,9 @@ export default class DataGripByType {
|
|||
statistic.days[commit.timestamp] = true;
|
||||
statistic.tasks[commit.task] = true;
|
||||
|
||||
const getIncrement = (v?: number) => v ? (v + 1) : 1;
|
||||
const setDefault = (s: any, v: string) => {
|
||||
if (!s[v]) s[v] = {};
|
||||
return s[v];
|
||||
};
|
||||
|
||||
statistic.commitsByAuthors[commit.author] = getIncrement(statistic.commitsByAuthors[commit.author]);
|
||||
setDefault(statistic.daysByAuthors, commit.author)[commit.timestamp] = getIncrement(statistic.daysByAuthors[commit.author][commit.timestamp]);
|
||||
increment(statistic.commitsByAuthors, commit.author);
|
||||
if (!statistic.daysByAuthors[commit.author]) statistic.daysByAuthors[commit.author] = {};
|
||||
increment(statistic.daysByAuthors[commit.author], commit.timestamp);
|
||||
}
|
||||
|
||||
#addCommitByType(commit: ICommit) {
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
import ICommit from 'ts/interfaces/Commit';
|
||||
import IHashMap from 'ts/interfaces/HashMap';
|
||||
import settingsStore from 'ts/store/Settings';
|
||||
import { increment } from 'ts/helpers/Math';
|
||||
|
||||
export default class DataGripByWeek {
|
||||
commits: IHashMap<any> = {};
|
||||
|
||||
|
||||
statistic: any = [];
|
||||
|
||||
|
||||
constructor() {
|
||||
this.clear();
|
||||
}
|
||||
|
@ -30,7 +31,6 @@ export default class DataGripByWeek {
|
|||
statistic.tasks[commit.task] = true;
|
||||
statistic.timestamp.to = commit.timestamp;
|
||||
|
||||
const getIncrement = (v?: number) => v ? (v + 1) : 1;
|
||||
const setDefault = (s: any, v: string) => {
|
||||
if (!s[v]) s[v] = {};
|
||||
return s[v];
|
||||
|
@ -40,9 +40,10 @@ export default class DataGripByWeek {
|
|||
|
||||
setDefault(statistic.authors, commit.author)[commit.task] = true;
|
||||
setDefault(statistic.workDays, commit.author)[commit.day] = true;
|
||||
setDefault(statistic.typeByAuthor, commit.author)[commit.type] = getIncrement(statistic.typeByAuthor[commit.author][commit.type]);
|
||||
|
||||
statistic.types[commit.type] = getIncrement(statistic.types[commit.type]);
|
||||
if (!statistic.typeByAuthor[commit.author]) statistic.typeByAuthor[commit.author] = {};
|
||||
increment(statistic.typeByAuthor[commit.author], commit.type);
|
||||
increment(statistic.types, commit.type);
|
||||
}
|
||||
|
||||
#addCommitByWeek(commit: ICommit) {
|
||||
|
@ -108,4 +109,4 @@ export default class DataGripByWeek {
|
|||
};
|
||||
}).reverse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
import IHashMap from 'ts/interfaces/HashMap';
|
||||
import { IDirtyFile } from 'ts/interfaces/FileInfo';
|
||||
|
||||
interface IStatByAuthor {
|
||||
addedFiles: number;
|
||||
removedFiles: number;
|
||||
addedWithoutRemoveFiles: number;
|
||||
}
|
||||
|
||||
export default class FileGripByAuthor {
|
||||
statisticByName: IHashMap<any> = {};
|
||||
statisticByName: IHashMap<IStatByAuthor> = {};
|
||||
|
||||
totalAddedFiles: number = 0;
|
||||
|
||||
|
|
|
@ -1,6 +1,16 @@
|
|||
import IHashMap from 'ts/interfaces/HashMap';
|
||||
import { IDirtyFile } from 'ts/interfaces/FileInfo';
|
||||
|
||||
interface IStatByExtension {
|
||||
extension: string; // extension name
|
||||
task?: string; // first file with this type was created in task
|
||||
path: string; // first file with this type has path,
|
||||
files: IDirtyFile[], // all files with this type
|
||||
count: number, // TODO: remove?
|
||||
removedFiles: IDirtyFile[], // all removed files with this type
|
||||
removedCount: number, // TODO: remove?
|
||||
}
|
||||
|
||||
const IGNORE_LIST = [
|
||||
'.eslintrc',
|
||||
'.gitignore',
|
||||
|
@ -10,9 +20,9 @@ const IGNORE_LIST = [
|
|||
];
|
||||
|
||||
export default class FileGripByExtension {
|
||||
statistic: any = [];
|
||||
statistic: IStatByExtension[] = [];
|
||||
|
||||
statisticByName: IHashMap<any> = {};
|
||||
statisticByName: IHashMap<IStatByExtension> = {};
|
||||
|
||||
property: string = '';
|
||||
|
||||
|
@ -44,7 +54,7 @@ export default class FileGripByExtension {
|
|||
}
|
||||
}
|
||||
|
||||
#getNewExtension(file: IDirtyFile) {
|
||||
#getNewExtension(file: IDirtyFile): IStatByExtension {
|
||||
return {
|
||||
extension: file?.extension,
|
||||
task: file?.firstCommit?.task,
|
||||
|
|
|
@ -1,10 +1,21 @@
|
|||
import IHashMap from 'ts/interfaces/HashMap';
|
||||
import { IDirtyFile } from 'ts/interfaces/FileInfo';
|
||||
|
||||
export default class FileGripByType {
|
||||
statistic: any = [];
|
||||
interface IStatByType {
|
||||
type: string; // type name
|
||||
task?: string; // first file with this type was created in task
|
||||
path: string; // first file with this type has path,
|
||||
extension: IHashMap<number>; // the number of extensions with this type
|
||||
files: IDirtyFile[], // all files with this type
|
||||
count: number, // TODO: remove?
|
||||
removedFiles: IDirtyFile[], // all removed files with this type
|
||||
removedCount: number, // TODO: remove?
|
||||
}
|
||||
|
||||
statisticByName: IHashMap<any> = {};
|
||||
export default class FileGripByType {
|
||||
statistic: IStatByType[] = [];
|
||||
|
||||
statisticByName: IHashMap<IStatByType> = {};
|
||||
|
||||
clear() {
|
||||
this.statistic = [];
|
||||
|
@ -34,7 +45,7 @@ export default class FileGripByType {
|
|||
}
|
||||
}
|
||||
|
||||
#getNewType(file: IDirtyFile) {
|
||||
#getNewType(file: IDirtyFile): IStatByType {
|
||||
return {
|
||||
type: file?.type,
|
||||
task: file?.firstCommit?.task,
|
||||
|
|
|
@ -35,3 +35,7 @@ export class WeightedAverage {
|
|||
return value / count;
|
||||
}
|
||||
}
|
||||
|
||||
export function increment(object: Object, path: string) {
|
||||
object[path] = (object[path] || 0) + 1;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,9 @@ export default function Parser(report: string[]) {
|
|||
if (!message) continue;
|
||||
|
||||
const index = message.indexOf('\t');
|
||||
if (index > 0 && index < 10) { // парсинг файлов формата --num-stat
|
||||
if (index > 0 && index < 10) {
|
||||
// парсинг файлов формата --num-stat
|
||||
// "1 0 .browserlistrc"
|
||||
const line = getNumStatInfo(message);
|
||||
if (!files[line.path]) {
|
||||
files[line.path] = getInfoFromPath(line.path);
|
||||
|
@ -37,7 +39,9 @@ export default function Parser(report: string[]) {
|
|||
fileChanges.changedLines = line.changedLines;
|
||||
updateLineTotal(commit, line);
|
||||
|
||||
} else if (message[0] === ':') { // парсинг файлов формата --raw
|
||||
} else if (message[0] === ':') {
|
||||
// парсинг файлов формата --raw
|
||||
// ":000000 100644 0000000 496d1ef A .browserlistrc"
|
||||
const line = getRawInfo(message);
|
||||
if (!files[line.path]) {
|
||||
files[line.path] = getInfoFromPath(line.path);
|
||||
|
@ -45,7 +49,9 @@ export default function Parser(report: string[]) {
|
|||
fileChanges = files[line.path];
|
||||
fileChanges.action = line.action;
|
||||
|
||||
} else { // парсинг коммита
|
||||
} else {
|
||||
// парсинг коммита
|
||||
// "2021-02-09T16:08:15+03:00>Albert>instein@mail.de>feat(init): added the speed of light"
|
||||
if (commit) commit.fileChanges = Object.values(files);
|
||||
files = {};
|
||||
commit = getCommitInfo(message);
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
import React from 'react';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
|
||||
const Loading = observer(() => {
|
||||
return (
|
||||
<p className="authorization-sidebar-processing">
|
||||
получение токенов...
|
||||
</p>
|
||||
);
|
||||
});
|
||||
|
||||
export default Loading;
|
|
@ -1,12 +0,0 @@
|
|||
import React from 'react';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
|
||||
const Login = observer(() => {
|
||||
return (
|
||||
<>
|
||||
Login
|
||||
</>
|
||||
);
|
||||
});
|
||||
|
||||
export default Login;
|
|
@ -1,128 +0,0 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import { Route, Routes } from 'react-router-dom';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
|
||||
import dataGripStore, { DataParseStatusEnum } from 'ts/store/DataGrip';
|
||||
import DropZone from 'ts/components/DropZone';
|
||||
import Sponsor from 'ts/components/Sponsor';
|
||||
import SplashScreen from 'ts/components/SplashScreen';
|
||||
import Confirm from 'ts/components/ModalWindow/Confirm';
|
||||
|
||||
import PageWrapper from '../../PageWrapper';
|
||||
import Team from '../../Team/index';
|
||||
import Person from '../../Person/index';
|
||||
import PrintAll from '../../PrintAll/index';
|
||||
import Welcome from '../../Welcome/index';
|
||||
import Settings from '../../Settings/index';
|
||||
import DebugPage from '../../Debug/index';
|
||||
|
||||
interface IViewWithChartsProps {
|
||||
showSplashScreen: boolean;
|
||||
}
|
||||
|
||||
function ViewWithCharts({ showSplashScreen }: IViewWithChartsProps) {
|
||||
return (
|
||||
<>
|
||||
<Sponsor />
|
||||
<Confirm />
|
||||
<Routes>
|
||||
<Route
|
||||
path="/settings"
|
||||
element={(
|
||||
<PageWrapper>
|
||||
<Settings />
|
||||
</PageWrapper>
|
||||
)}
|
||||
/>
|
||||
<Route
|
||||
path="/debug"
|
||||
element={(
|
||||
<PageWrapper>
|
||||
<DebugPage />
|
||||
</PageWrapper>
|
||||
)}
|
||||
/>
|
||||
<Route
|
||||
path="/print"
|
||||
element={(
|
||||
<PageWrapper>
|
||||
<PrintAll />
|
||||
</PageWrapper>
|
||||
)}
|
||||
/>
|
||||
<Route
|
||||
path="/:type/:page"
|
||||
element={(
|
||||
<PageWrapper>
|
||||
<Team />
|
||||
</PageWrapper>
|
||||
)}
|
||||
/>
|
||||
<Route
|
||||
path="/:type/:page/:userId"
|
||||
element={(
|
||||
<PageWrapper>
|
||||
<Person />
|
||||
</PageWrapper>
|
||||
)}
|
||||
/>
|
||||
<Route
|
||||
path="*"
|
||||
element={(
|
||||
<PageWrapper>
|
||||
<Team />
|
||||
</PageWrapper>
|
||||
)}
|
||||
/>
|
||||
</Routes>
|
||||
{showSplashScreen && <SplashScreen />}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function ViewWithWelcome() {
|
||||
return (
|
||||
<Routes>
|
||||
<Route
|
||||
path="*"
|
||||
element={(
|
||||
<Welcome />
|
||||
)}
|
||||
/>
|
||||
</Routes>
|
||||
);
|
||||
}
|
||||
|
||||
const Success = observer(() => {
|
||||
const [showSplashScreen, setShowSplashScreen] = useState<boolean>(true);
|
||||
const status = dataGripStore.status;
|
||||
|
||||
useEffect(() => {
|
||||
// @ts-ignore
|
||||
dataGripStore.setCommits(window?.report || []);
|
||||
}, []);
|
||||
|
||||
if (status === DataParseStatusEnum.PROCESSING) return null;
|
||||
|
||||
return (
|
||||
<>
|
||||
{status === DataParseStatusEnum.DONE && (
|
||||
<ViewWithCharts showSplashScreen={showSplashScreen} />
|
||||
)}
|
||||
{status === DataParseStatusEnum.WAITING && (
|
||||
<ViewWithWelcome />
|
||||
)}
|
||||
<DropZone
|
||||
onChange={(type: string, data: any[]) => {
|
||||
setShowSplashScreen(false);
|
||||
if (type === 'dump') dataGripStore.setCommits(data);
|
||||
setTimeout(() => {
|
||||
setShowSplashScreen(true);
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
});
|
||||
|
||||
export default Success;
|
|
@ -1,19 +0,0 @@
|
|||
import React, { ReactNode } from 'react';
|
||||
|
||||
interface IWrapperProps {
|
||||
children: ReactNode
|
||||
}
|
||||
|
||||
function Wrapper({ children }: IWrapperProps) {
|
||||
const className = 'authorization-sidebar';
|
||||
return (
|
||||
<div className="authorization">
|
||||
<div className={className}>
|
||||
<div className="authorization-header" />
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Wrapper;
|
|
@ -1,24 +0,0 @@
|
|||
import React from 'react';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
|
||||
import authorizationStore from './store/AuthorizationStore';
|
||||
import Success from './components/Success';
|
||||
|
||||
const Authorization = observer(() => {
|
||||
const { state, isInitialization } = authorizationStore;
|
||||
|
||||
if (true || state === 'SUCCESS') return (<Success />);
|
||||
if (isInitialization) return null;
|
||||
|
||||
const content = state === 'LOGIN'
|
||||
? (<h1>login</h1>)
|
||||
: (<h1>loading</h1>);
|
||||
|
||||
return (
|
||||
<div>
|
||||
{content}
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
export default Authorization;
|
|
@ -1,21 +0,0 @@
|
|||
import {
|
||||
makeAutoObservable,
|
||||
observable,
|
||||
} from 'mobx';
|
||||
|
||||
class AuthorizationStore {
|
||||
state: string = 'WAITING';
|
||||
|
||||
isInitialization: boolean = true;
|
||||
|
||||
constructor() {
|
||||
makeAutoObservable(this, {
|
||||
state: observable,
|
||||
isInitialization: observable,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const authorizationStore = new AuthorizationStore();
|
||||
|
||||
export default authorizationStore;
|
|
@ -7,7 +7,6 @@ import Title from 'ts/components/Title';
|
|||
import Races from 'ts/components/Races';
|
||||
import CityBuilder from 'ts/components/CityBuilder';
|
||||
|
||||
import GameConsole from 'ts/components/GameConsole';
|
||||
import SwimmingPool from 'ts/components/SwimmingPool';
|
||||
import Quize from 'ts/components/Quize';
|
||||
|
||||
|
@ -45,7 +44,6 @@ const TeamBuilding = observer((): React.ReactElement => {
|
|||
<Title title="Количество созданных файлов, если бы это был город"/>
|
||||
<CityBuilder valuesByTitle={addedFilesByAuthor} />
|
||||
<Title title="Скорость коммитов в день"/>
|
||||
<GameConsole />
|
||||
{'Небоскребы вверх ввиде графика'}
|
||||
</>
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue