mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
move graphic cards to left sidebar
This commit is contained in:
parent
70332cb035
commit
a2a60aee8e
8 changed files with 74 additions and 49 deletions
|
@ -42,10 +42,6 @@ const BorisGraphicStats: VFC<BorisGraphicStatsProps> = ({
|
||||||
left={year - 1}
|
left={year - 1}
|
||||||
right={year}
|
right={year}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/*
|
|
||||||
<StatsCountdownCard since={parseISO(foundationDate)} className={styles.card} />
|
|
||||||
*/}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,10 +5,5 @@
|
||||||
grid-template-columns: 1fr 1fr;
|
grid-template-columns: 1fr 1fr;
|
||||||
grid-column-gap: $gap;
|
grid-column-gap: $gap;
|
||||||
grid-row-gap: $gap;
|
grid-row-gap: $gap;
|
||||||
grid-auto-rows: 140px;
|
grid-auto-rows: 100px;
|
||||||
|
|
||||||
@include tablet {
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
grid-auto-rows: 120px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import React, { FC } from 'react';
|
import { FC, useMemo } from 'react';
|
||||||
|
|
||||||
|
import { BorisGraphicStats } from '~/components/boris/BorisGraphicStats';
|
||||||
import { StatsRow } from '~/components/common/StatsRow';
|
import { StatsRow } from '~/components/common/StatsRow';
|
||||||
import { SubTitle } from '~/components/common/SubTitle';
|
import { SubTitle } from '~/components/common/SubTitle';
|
||||||
import { StatBackend } from '~/types/boris';
|
import { StatBackend } from '~/types/boris';
|
||||||
|
@ -13,6 +14,15 @@ interface IProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
const BorisStatsBackend: FC<IProps> = ({ isLoading, stats }) => {
|
const BorisStatsBackend: FC<IProps> = ({ isLoading, stats }) => {
|
||||||
|
const commentsByMonth = useMemo(
|
||||||
|
() => stats.comments.by_month?.slice(0, -1),
|
||||||
|
[stats.comments.by_month],
|
||||||
|
);
|
||||||
|
const nodesByMonth = useMemo(
|
||||||
|
() => stats.nodes.by_month?.slice(0, -1),
|
||||||
|
[stats.comments.by_month],
|
||||||
|
);
|
||||||
|
|
||||||
if (!stats && !isLoading) {
|
if (!stats && !isLoading) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -54,11 +64,22 @@ const BorisStatsBackend: FC<IProps> = ({ isLoading, stats }) => {
|
||||||
{stats.nodes.audios}
|
{stats.nodes.audios}
|
||||||
</StatsRow>
|
</StatsRow>
|
||||||
|
|
||||||
<StatsRow isLoading={isLoading} label="Комментарии">
|
{/*
|
||||||
{stats.comments.total}
|
<StatsRow isLoading={isLoading} label="Комментарии">
|
||||||
</StatsRow>
|
{stats.comments.total}
|
||||||
|
</StatsRow>
|
||||||
|
*/}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<div className={styles.graphs}>
|
||||||
|
<BorisGraphicStats
|
||||||
|
totalComments={stats.comments.total}
|
||||||
|
commentsByMonth={commentsByMonth}
|
||||||
|
totalNodes={stats.nodes.total}
|
||||||
|
nodesByMonth={nodesByMonth}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<SubTitle isLoading={isLoading} className={styles.title}>
|
<SubTitle isLoading={isLoading} className={styles.title}>
|
||||||
Сторедж
|
Сторедж
|
||||||
</SubTitle>
|
</SubTitle>
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
@import "src/styles/variables";
|
@import 'src/styles/variables';
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
margin: $gap * 2 0 $gap;
|
margin: $gap * 2 0 $gap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wrap {
|
|
||||||
}
|
|
||||||
|
|
||||||
.subtitle {
|
.subtitle {
|
||||||
margin-left: $gap;
|
margin-left: $gap;
|
||||||
font: $font_12_semibold;
|
font: $font_12_semibold;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.graphs {
|
||||||
|
padding-top: $gap;
|
||||||
|
}
|
||||||
|
|
|
@ -15,13 +15,26 @@ interface StatsCardProps extends CardProps {
|
||||||
background?: ReactNode;
|
background?: ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
const StatsCard: FC<StatsCardProps> = ({ children, title, background, total, ...props }) => (
|
const StatsCard: FC<StatsCardProps> = ({
|
||||||
<Card {...props} className={classNames(styles.card, props.className)}>
|
children,
|
||||||
|
title,
|
||||||
|
background,
|
||||||
|
total,
|
||||||
|
...props
|
||||||
|
}) => (
|
||||||
|
<Card
|
||||||
|
{...props}
|
||||||
|
className={classNames(styles.card, props.className)}
|
||||||
|
elevation={0}
|
||||||
|
>
|
||||||
<div className={styles.content}>
|
<div className={styles.content}>
|
||||||
{(!!title || !!total) && (
|
{(!!title || !!total) && (
|
||||||
<Group className={styles.title} horizontal>
|
<Group className={styles.title} horizontal>
|
||||||
{!!title && <SubTitle>{title}</SubTitle>}
|
{!!title && (
|
||||||
<Filler />
|
<Filler>
|
||||||
|
<SubTitle>{title}</SubTitle>
|
||||||
|
</Filler>
|
||||||
|
)}
|
||||||
{!!total && <SubTitle className={styles.total}>{total}</SubTitle>}
|
{!!total && <SubTitle className={styles.total}>{total}</SubTitle>}
|
||||||
</Group>
|
</Group>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -31,9 +31,9 @@ const StatsGraphCard: VFC<StatsGraphCardProps> = ({
|
||||||
className={styles.card}
|
className={styles.card}
|
||||||
>
|
>
|
||||||
<div className={styles.content}>
|
<div className={styles.content}>
|
||||||
<span>{left}</span>
|
<span className={styles.legend}>{left}</span>
|
||||||
<Filler />
|
<Filler />
|
||||||
<span>{right}</span>
|
<span className={styles.legend}>{right}</span>
|
||||||
</div>
|
</div>
|
||||||
</StatsCard>
|
</StatsCard>
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
@import "src/styles/variables";
|
@import 'src/styles/variables';
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
@ -6,9 +6,22 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
font: $font_12_medium;
|
font: $font_12_medium;
|
||||||
opacity: 0.2;
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 1;
|
||||||
|
margin: -2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.legend {
|
||||||
|
opacity: 0.5;
|
||||||
|
background: $content_bg_light;
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
padding: 2px;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import { FC, useMemo } from 'react';
|
import { FC } from 'react';
|
||||||
|
|
||||||
import { observer } from 'mobx-react-lite';
|
import { observer } from 'mobx-react-lite';
|
||||||
|
|
||||||
import { BorisGraphicStats } from '~/components/boris/BorisGraphicStats';
|
|
||||||
import { Superpower } from '~/components/boris/Superpower';
|
import { Superpower } from '~/components/boris/Superpower';
|
||||||
import { Card } from '~/components/containers/Card';
|
import { Card } from '~/components/containers/Card';
|
||||||
import { Group } from '~/components/containers/Group';
|
import { Group } from '~/components/containers/Group';
|
||||||
|
@ -24,15 +23,7 @@ type IProps = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const BorisLayout: FC<IProps> = observer(({ title, stats, isLoadingStats }) => {
|
const BorisLayout: FC<IProps> = observer(({ title, stats, isLoadingStats }) => {
|
||||||
const { isUser } = useAuthProvider();
|
const { isUser, isTester } = useAuthProvider();
|
||||||
const commentsByMonth = useMemo(
|
|
||||||
() => stats.backend.comments.by_month?.slice(0, -1),
|
|
||||||
[stats.backend.comments.by_month],
|
|
||||||
);
|
|
||||||
const nodesByMonth = useMemo(
|
|
||||||
() => stats.backend.nodes.by_month?.slice(0, -1),
|
|
||||||
[stats.backend.comments.by_month],
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
|
@ -50,18 +41,13 @@ const BorisLayout: FC<IProps> = observer(({ title, stats, isLoadingStats }) => {
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<Card className={styles.content}>
|
<Card className={styles.content}>
|
||||||
<Group>
|
<Group>
|
||||||
<div>
|
{isTester && (
|
||||||
<Superpower>
|
<div>
|
||||||
<BorisSuperPowersSSR />
|
<Superpower>
|
||||||
</Superpower>
|
<BorisSuperPowersSSR />
|
||||||
</div>
|
</Superpower>
|
||||||
|
</div>
|
||||||
<BorisGraphicStats
|
)}
|
||||||
totalComments={stats.backend.comments.total}
|
|
||||||
commentsByMonth={commentsByMonth}
|
|
||||||
totalNodes={stats.backend.nodes.total}
|
|
||||||
nodesByMonth={nodesByMonth}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<BorisComments />
|
<BorisComments />
|
||||||
</Group>
|
</Group>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue