mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
removed boris reducer
This commit is contained in:
parent
77af1ab05a
commit
120bf8954c
72 changed files with 225 additions and 298 deletions
|
@ -5,16 +5,17 @@ import { BorisContacts } from '~/components/boris/BorisContacts';
|
|||
import { BorisStats } from '~/components/boris/BorisStats';
|
||||
import { Group } from '~/components/containers/Group';
|
||||
import { IUser } from '~/redux/auth/types';
|
||||
import { BorisUsageStats } from '~/redux/boris/reducer';
|
||||
import { BorisUsageStats } from '~/types/boris';
|
||||
|
||||
interface Props {
|
||||
user: IUser;
|
||||
isTester: boolean;
|
||||
stats: BorisUsageStats;
|
||||
setBetaTester: (val: boolean) => void;
|
||||
isLoading: boolean;
|
||||
}
|
||||
|
||||
const BorisSidebar: FC<Props> = ({ user, stats, isTester, setBetaTester }) => (
|
||||
const BorisSidebar: FC<Props> = ({ user, stats, isLoading, isTester, setBetaTester }) => (
|
||||
<Group className={styles.stats__container}>
|
||||
<div className={styles.super_powers}>
|
||||
{user.is_user && <BorisSuperpowers active={isTester} onChange={setBetaTester} />}
|
||||
|
@ -23,7 +24,7 @@ const BorisSidebar: FC<Props> = ({ user, stats, isTester, setBetaTester }) => (
|
|||
<BorisContacts />
|
||||
|
||||
<div className={styles.stats__wrap}>
|
||||
<BorisStats stats={stats} />
|
||||
<BorisStats stats={stats} isLoading={isLoading} />
|
||||
</div>
|
||||
</Group>
|
||||
);
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
import React, { FC } from 'react';
|
||||
import { BorisUsageStats } from '~/redux/boris/reducer';
|
||||
import { BorisUsageStats } from '~/types/boris';
|
||||
import { BorisStatsGit } from '../BorisStatsGit';
|
||||
import { BorisStatsBackend } from '../BorisStatsBackend';
|
||||
|
||||
interface IProps {
|
||||
stats: BorisUsageStats;
|
||||
isLoading: boolean;
|
||||
}
|
||||
|
||||
const BorisStats: FC<IProps> = ({ stats }) => {
|
||||
const BorisStats: FC<IProps> = ({ stats, isLoading }) => {
|
||||
return (
|
||||
<>
|
||||
<BorisStatsBackend stats={stats} />
|
||||
<BorisStatsGit stats={stats} />
|
||||
<BorisStatsBackend stats={stats.backend} isLoading={isLoading} />
|
||||
<BorisStatsGit issues={stats.issues} isLoading={isLoading} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -1,72 +1,73 @@
|
|||
import React, { FC } from 'react';
|
||||
import { IBorisState } from '~/redux/boris/reducer';
|
||||
import { StatBackend } from '~/types/boris';
|
||||
import styles from './styles.module.scss';
|
||||
import { sizeOf } from '~/utils/dom';
|
||||
import { StatsRow } from '~/components/common/StatsRow';
|
||||
import { SubTitle } from '~/components/common/SubTitle';
|
||||
|
||||
interface IProps {
|
||||
stats: IBorisState['stats'];
|
||||
stats: StatBackend;
|
||||
isLoading: boolean;
|
||||
}
|
||||
|
||||
const BorisStatsBackend: FC<IProps> = ({ stats: { is_loading, backend } }) => {
|
||||
if (!backend && !is_loading) {
|
||||
const BorisStatsBackend: FC<IProps> = ({ isLoading, stats }) => {
|
||||
if (!stats && !isLoading) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={styles.wrap}>
|
||||
<SubTitle isLoading={is_loading} className={styles.title}>
|
||||
<SubTitle isLoading={isLoading} className={styles.title}>
|
||||
Юнитс
|
||||
</SubTitle>
|
||||
|
||||
<ul>
|
||||
<StatsRow isLoading={is_loading} label="В сознании">
|
||||
{backend.users.alive}
|
||||
<StatsRow isLoading={isLoading} label="В сознании">
|
||||
{stats.users.alive}
|
||||
</StatsRow>
|
||||
|
||||
<StatsRow isLoading={is_loading} label="Криокамера">
|
||||
{backend.users.total - backend.users.alive}
|
||||
<StatsRow isLoading={isLoading} label="Криокамера">
|
||||
{stats.users.total - stats.users.alive}
|
||||
</StatsRow>
|
||||
</ul>
|
||||
|
||||
<SubTitle isLoading={is_loading} className={styles.title}>
|
||||
<SubTitle isLoading={isLoading} className={styles.title}>
|
||||
Контент
|
||||
</SubTitle>
|
||||
|
||||
<ul>
|
||||
<StatsRow isLoading={is_loading} label="Фотографии">
|
||||
{backend.nodes.images}
|
||||
<StatsRow isLoading={isLoading} label="Фотографии">
|
||||
{stats.nodes.images}
|
||||
</StatsRow>
|
||||
|
||||
<StatsRow isLoading={is_loading} label="Письма">
|
||||
{backend.nodes.texts}
|
||||
<StatsRow isLoading={isLoading} label="Письма">
|
||||
{stats.nodes.texts}
|
||||
</StatsRow>
|
||||
|
||||
<StatsRow isLoading={is_loading} label="Видеозаписи">
|
||||
{backend.nodes.videos}
|
||||
<StatsRow isLoading={isLoading} label="Видеозаписи">
|
||||
{stats.nodes.videos}
|
||||
</StatsRow>
|
||||
|
||||
<StatsRow isLoading={is_loading} label="Аудиозаписи">
|
||||
{backend.nodes.audios}
|
||||
<StatsRow isLoading={isLoading} label="Аудиозаписи">
|
||||
{stats.nodes.audios}
|
||||
</StatsRow>
|
||||
|
||||
<StatsRow isLoading={is_loading} label="Комментарии">
|
||||
{backend.comments.total}
|
||||
<StatsRow isLoading={isLoading} label="Комментарии">
|
||||
{stats.comments.total}
|
||||
</StatsRow>
|
||||
</ul>
|
||||
|
||||
<SubTitle isLoading={is_loading} className={styles.title}>
|
||||
<SubTitle isLoading={isLoading} className={styles.title}>
|
||||
Сторедж
|
||||
</SubTitle>
|
||||
|
||||
<ul>
|
||||
<StatsRow isLoading={is_loading} label="Файлы">
|
||||
{backend.files.count}
|
||||
<StatsRow isLoading={isLoading} label="Файлы">
|
||||
{stats.files.count}
|
||||
</StatsRow>
|
||||
|
||||
<StatsRow isLoading={is_loading} label="На диске">
|
||||
{sizeOf(backend.files.size)}
|
||||
<StatsRow isLoading={isLoading} label="На диске">
|
||||
{sizeOf(stats.files.size)}
|
||||
</StatsRow>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -1,27 +1,28 @@
|
|||
import React, { FC, useMemo } from 'react';
|
||||
import { IBorisState } from '~/redux/boris/reducer';
|
||||
import { GithubIssue } from '~/types/boris';
|
||||
import styles from './styles.module.scss';
|
||||
import { Placeholder } from '~/components/placeholders/Placeholder';
|
||||
import { BorisStatsGitCard } from '../BorisStatsGitCard';
|
||||
|
||||
interface IProps {
|
||||
stats: IBorisState['stats'];
|
||||
issues: GithubIssue[];
|
||||
isLoading: boolean;
|
||||
}
|
||||
|
||||
const BorisStatsGit: FC<IProps> = ({ stats }) => {
|
||||
const BorisStatsGit: FC<IProps> = ({ issues, isLoading }) => {
|
||||
const open = useMemo(
|
||||
() => stats.issues.filter(el => !el.pull_request && el.state === 'open').slice(0, 5),
|
||||
[stats.issues]
|
||||
() => issues.filter(el => !el.pull_request && el.state === 'open').slice(0, 5),
|
||||
[issues]
|
||||
);
|
||||
|
||||
const closed = useMemo(
|
||||
() => stats.issues.filter(el => !el.pull_request && el.state === 'closed').slice(0, 5),
|
||||
[stats.issues]
|
||||
() => issues.filter(el => !el.pull_request && el.state === 'closed').slice(0, 5),
|
||||
[issues]
|
||||
);
|
||||
|
||||
if (!stats.issues.length) return null;
|
||||
if (!issues.length) return null;
|
||||
|
||||
if (stats.is_loading) {
|
||||
if (isLoading) {
|
||||
return (
|
||||
<>
|
||||
<div className={styles.stats__title}>
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import React, { FC, useMemo } from 'react';
|
||||
import styles from './styles.module.scss';
|
||||
import { getPrettyDate } from '~/utils/dom';
|
||||
import { IGithubIssue } from '~/redux/boris/types';
|
||||
import { GithubIssue } from '~/types/boris';
|
||||
import classNames from 'classnames';
|
||||
|
||||
interface IProps {
|
||||
data: IGithubIssue;
|
||||
data: GithubIssue;
|
||||
}
|
||||
|
||||
const stateLabels: Record<IGithubIssue['state'], string> = {
|
||||
const stateLabels: Record<GithubIssue['state'], string> = {
|
||||
open: 'Ожидает',
|
||||
closed: 'Сделано',
|
||||
};
|
||||
|
|
|
@ -10,7 +10,7 @@ import { CommentFormFormatButtons } from '~/components/comment/CommentFormFormat
|
|||
import { CommentFormAttaches } from '~/components/comment/CommentFormAttaches';
|
||||
import { LoaderCircle } from '~/components/input/LoaderCircle';
|
||||
import { IComment, INode } from '~/redux/types';
|
||||
import { EMPTY_COMMENT } from '~/redux/node/constants';
|
||||
import { EMPTY_COMMENT } from '~/constants/node';
|
||||
import { UploadDropzone } from '~/components/upload/UploadDropzone';
|
||||
import styles from './styles.module.scss';
|
||||
import { ERROR_LITERAL } from '~/constants/errors';
|
||||
|
|
|
@ -3,7 +3,7 @@ import { UPLOAD_TYPES } from '~/redux/uploads/constants';
|
|||
import { ImageGrid } from '../ImageGrid';
|
||||
import { AudioGrid } from '../AudioGrid';
|
||||
import styles from './styles.module.scss';
|
||||
import { NodeEditorProps } from '~/redux/node/types';
|
||||
import { NodeEditorProps } from '~/types/node';
|
||||
import { useNodeImages } from '~/hooks/node/useNodeImages';
|
||||
import { useNodeAudios } from '~/hooks/node/useNodeAudios';
|
||||
import { useNodeFormContext } from '~/hooks/node/useNodeFormFormik';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React, { createElement, FC } from 'react';
|
||||
import styles from './styles.module.scss';
|
||||
import { NODE_PANEL_COMPONENTS } from '~/redux/node/constants';
|
||||
import { NODE_PANEL_COMPONENTS } from '~/constants/node';
|
||||
import { has } from 'ramda';
|
||||
import { useNodeFormContext } from '~/hooks/node/useNodeFormFormik';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React, { FC } from 'react';
|
||||
import { EditorUploadButton } from '~/components/editors/EditorUploadButton';
|
||||
import { UPLOAD_TYPES } from '~/redux/uploads/constants';
|
||||
import { IEditorComponentProps } from '~/redux/node/types';
|
||||
import { IEditorComponentProps } from '~/types/node';
|
||||
|
||||
type IProps = IEditorComponentProps & {};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React, { FC } from 'react';
|
||||
import { Filler } from '~/components/containers/Filler';
|
||||
import { IEditorComponentProps } from '~/redux/node/types';
|
||||
import { IEditorComponentProps } from '~/types/node';
|
||||
import styles from './styles.module.scss';
|
||||
|
||||
type IProps = IEditorComponentProps & {};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React, { FC } from 'react';
|
||||
import { EditorUploadButton } from '~/components/editors/EditorUploadButton';
|
||||
import { UPLOAD_TYPES } from '~/redux/uploads/constants';
|
||||
import { IEditorComponentProps } from '~/redux/node/types';
|
||||
import { IEditorComponentProps } from '~/types/node';
|
||||
|
||||
type IProps = IEditorComponentProps & {};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React, { FC, useCallback } from 'react';
|
||||
import { IEditorComponentProps } from '~/redux/node/types';
|
||||
import { IEditorComponentProps } from '~/types/node';
|
||||
import { Button } from '~/components/input/Button';
|
||||
import { Icon } from '~/components/input/Icon';
|
||||
import styles from './styles.module.scss';
|
||||
|
|
|
@ -2,7 +2,7 @@ import React, { ChangeEvent, FC, useCallback } from 'react';
|
|||
import styles from './styles.module.scss';
|
||||
import { Icon } from '~/components/input/Icon';
|
||||
import { UPLOAD_TYPES } from '~/redux/uploads/constants';
|
||||
import { IEditorComponentProps } from '~/redux/node/types';
|
||||
import { IEditorComponentProps } from '~/types/node';
|
||||
import { useFileUploaderContext } from '~/hooks/data/useFileUploader';
|
||||
import { getFileType } from '~/utils/uploader';
|
||||
import { useNodeFormContext } from '~/hooks/node/useNodeFormFormik';
|
||||
|
|
|
@ -5,7 +5,7 @@ import { path } from 'ramda';
|
|||
import { getURL } from '~/utils/dom';
|
||||
import { Icon } from '~/components/input/Icon';
|
||||
import { PRESETS } from '~/constants/urls';
|
||||
import { IEditorComponentProps } from '~/redux/node/types';
|
||||
import { IEditorComponentProps } from '~/types/node';
|
||||
import { useFileUploader } from '~/hooks/data/useFileUploader';
|
||||
import { useNodeFormContext } from '~/hooks/node/useNodeFormFormik';
|
||||
import { getFileType } from '~/utils/uploader';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React, { FC } from 'react';
|
||||
import { ImageGrid } from '~/components/editors/ImageGrid';
|
||||
import styles from './styles.module.scss';
|
||||
import { NodeEditorProps } from '~/redux/node/types';
|
||||
import { NodeEditorProps } from '~/types/node';
|
||||
import { useFileUploaderContext } from '~/hooks/data/useFileUploader';
|
||||
import { UploadDropzone } from '~/components/upload/UploadDropzone';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import React, { FC, useCallback } from 'react';
|
|||
import styles from './styles.module.scss';
|
||||
import { Textarea } from '~/components/input/Textarea';
|
||||
import { path } from 'ramda';
|
||||
import { NodeEditorProps } from '~/redux/node/types';
|
||||
import { NodeEditorProps } from '~/types/node';
|
||||
import { useNodeFormContext } from '~/hooks/node/useNodeFormFormik';
|
||||
|
||||
type IProps = NodeEditorProps & {};
|
||||
|
|
|
@ -4,7 +4,7 @@ import { path } from 'ramda';
|
|||
import { InputText } from '~/components/input/InputText';
|
||||
import classnames from 'classnames';
|
||||
import { getYoutubeThumb } from '~/utils/dom';
|
||||
import { NodeEditorProps } from '~/redux/node/types';
|
||||
import { NodeEditorProps } from '~/types/node';
|
||||
import { useNodeFormContext } from '~/hooks/node/useNodeFormFormik';
|
||||
|
||||
type IProps = NodeEditorProps & {};
|
||||
|
|
|
@ -7,7 +7,7 @@ import styles from './styles.module.scss';
|
|||
import markdown from '~/styles/common/markdown.module.scss';
|
||||
import { Icon } from '~/components/input/Icon';
|
||||
import { PRESETS } from '~/constants/urls';
|
||||
import { NODE_TYPES } from '~/redux/node/constants';
|
||||
import { NODE_TYPES } from '~/constants/node';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { CellShade } from '~/components/flow/CellShade';
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React, { FC } from 'react';
|
||||
import { INodeComponentProps } from '~/redux/node/constants';
|
||||
import { INodeComponentProps } from '~/constants/node';
|
||||
import { Placeholder } from '~/components/placeholders/Placeholder';
|
||||
import { NodeAudioBlock } from '~/components/node/NodeAudioBlock';
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React, { FC } from 'react';
|
||||
import { INodeComponentProps } from '~/redux/node/constants';
|
||||
import { INodeComponentProps } from '~/constants/node';
|
||||
import styles from './styles.module.scss';
|
||||
import { Markdown } from '~/components/containers/Markdown';
|
||||
import { formatText } from '~/utils/dom';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React, { FC } from 'react';
|
||||
import { INodeComponentProps } from '~/redux/node/constants';
|
||||
import { INodeComponentProps } from '~/constants/node';
|
||||
import SwiperCore, { A11y, Navigation, Pagination, SwiperOptions } from 'swiper';
|
||||
|
||||
import 'swiper/swiper.scss';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React, { FC } from 'react';
|
||||
import styles from './styles.module.scss';
|
||||
import { INodeComponentProps } from '~/redux/node/constants';
|
||||
import { INodeComponentProps } from '~/constants/node';
|
||||
import { useColorGradientFromString } from '~/hooks/color/useColorGradientFromString';
|
||||
|
||||
interface Props extends INodeComponentProps {}
|
||||
|
|
|
@ -4,7 +4,7 @@ import { Group } from '~/components/containers/Group';
|
|||
import { Icon } from '~/components/input/Icon';
|
||||
import Tippy from '@tippy.js/react';
|
||||
import { useGotoNode } from '~/hooks/node/useGotoNode';
|
||||
import { INodeComponentProps } from '~/redux/node/constants';
|
||||
import { INodeComponentProps } from '~/constants/node';
|
||||
import { Placeholder } from '~/components/placeholders/Placeholder';
|
||||
|
||||
const LabNodeTitle: FC<INodeComponentProps> = ({ node, isLoading }) => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React, { FC } from 'react';
|
||||
import styles from './styles.module.scss';
|
||||
import { INodeComponentProps } from '~/redux/node/constants';
|
||||
import { INodeComponentProps } from '~/constants/node';
|
||||
import { useGotoNode } from '~/hooks/node/useGotoNode';
|
||||
|
||||
const LabPad: FC<INodeComponentProps> = ({ node }) => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React, { FC, useMemo } from 'react';
|
||||
import { Markdown } from '~/components/containers/Markdown';
|
||||
import { INodeComponentProps } from '~/redux/node/constants';
|
||||
import { INodeComponentProps } from '~/constants/node';
|
||||
import { formatTextParagraphs } from '~/utils/dom';
|
||||
import { path } from 'ramda';
|
||||
import styles from './styles.module.scss';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React, { FC } from 'react';
|
||||
import { INodeComponentProps } from '~/redux/node/constants';
|
||||
import { INodeComponentProps } from '~/constants/node';
|
||||
import { NodeVideoBlock } from '~/components/node/NodeVideoBlock';
|
||||
import { Placeholder } from '~/components/placeholders/Placeholder';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React, { FC } from 'react';
|
||||
import { AudioPlayer } from '~/components/media/AudioPlayer';
|
||||
import styles from './styles.module.scss';
|
||||
import { INodeComponentProps } from '~/redux/node/constants';
|
||||
import { INodeComponentProps } from '~/constants/node';
|
||||
import { useNodeAudios } from '~/hooks/node/useNodeAudios';
|
||||
|
||||
interface IProps extends INodeComponentProps {}
|
||||
|
|
|
@ -3,7 +3,7 @@ import styles from './styles.module.scss';
|
|||
import { path } from 'ramda';
|
||||
import { getURL } from '~/utils/dom';
|
||||
import { PRESETS } from '~/constants/urls';
|
||||
import { INodeComponentProps } from '~/redux/node/constants';
|
||||
import { INodeComponentProps } from '~/constants/node';
|
||||
import { useNodeImages } from '~/hooks/node/useNodeImages';
|
||||
|
||||
interface IProps extends INodeComponentProps {}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React, { FC, useCallback, useState } from 'react';
|
||||
import { INodeComponentProps } from '~/redux/node/constants';
|
||||
import { INodeComponentProps } from '~/constants/node';
|
||||
import { Swiper, SwiperSlide } from 'swiper/react';
|
||||
|
||||
import 'swiper/swiper.scss';
|
||||
|
|
|
@ -3,7 +3,7 @@ import { NodeRelatedPlaceholder } from '~/components/node/NodeRelated/placeholde
|
|||
import { NodeRelated } from '~/components/node/NodeRelated';
|
||||
import { URLS } from '~/constants/urls';
|
||||
import { INode } from '~/redux/types';
|
||||
import { INodeRelated } from '~/redux/node/types';
|
||||
import { INodeRelated } from '~/types/node';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
interface IProps {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React, { FC, useMemo } from 'react';
|
||||
import { path } from 'ramda';
|
||||
import { formatTextParagraphs } from '~/utils/dom';
|
||||
import { INodeComponentProps } from '~/redux/node/constants';
|
||||
import { INodeComponentProps } from '~/constants/node';
|
||||
import classNames from 'classnames';
|
||||
import styles from './styles.module.scss';
|
||||
import markdown from '~/styles/common/markdown.module.scss';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React, { FC, useMemo } from 'react';
|
||||
import styles from './styles.module.scss';
|
||||
import { path } from 'ramda';
|
||||
import { INodeComponentProps } from '~/redux/node/constants';
|
||||
import { INodeComponentProps } from '~/constants/node';
|
||||
|
||||
interface IProps extends INodeComponentProps {}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue