mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
refactored boris
This commit is contained in:
parent
35ce593ed8
commit
4c74674ac1
10 changed files with 105 additions and 129 deletions
27
src/components/boris/BorisContacts/index.tsx
Normal file
27
src/components/boris/BorisContacts/index.tsx
Normal file
|
@ -0,0 +1,27 @@
|
|||
import React, { FC } from 'react';
|
||||
import { BorisContactItem } from '~/components/boris/BorisContactItem';
|
||||
import styles from './styles.module.scss';
|
||||
|
||||
interface Props {}
|
||||
|
||||
const BorisContacts: FC<Props> = () => (
|
||||
<div className={styles.contacts}>
|
||||
<div className={styles.contacts__title}>Где мы ещё:</div>
|
||||
|
||||
<BorisContactItem
|
||||
icon="vk"
|
||||
title="Суицидальные роботы"
|
||||
link="https://vk.com/vault48"
|
||||
subtitle="паблик вконтакте"
|
||||
/>
|
||||
|
||||
<BorisContactItem
|
||||
icon="telegram"
|
||||
title="Boris[48]bot"
|
||||
link="https://t.me/boris48bot"
|
||||
subtitle="телеграм-бот"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
export { BorisContacts };
|
19
src/components/boris/BorisContacts/styles.module.scss
Normal file
19
src/components/boris/BorisContacts/styles.module.scss
Normal file
|
@ -0,0 +1,19 @@
|
|||
@import "~/styles/variables";
|
||||
|
||||
.contacts {
|
||||
display: grid;
|
||||
grid-auto-flow: row;
|
||||
grid-row-gap: $gap;
|
||||
padding: 2px 2px $gap * 3 2px;
|
||||
|
||||
& > *:not(:last-child) {
|
||||
border-bottom: 1px solid #333333;
|
||||
padding-bottom: $gap * 2;
|
||||
}
|
||||
}
|
||||
|
||||
.contacts__title {
|
||||
font: $font_12_semibold;
|
||||
text-transform: uppercase;
|
||||
opacity: 0.3;
|
||||
}
|
31
src/components/boris/BorisSidebar/index.tsx
Normal file
31
src/components/boris/BorisSidebar/index.tsx
Normal file
|
@ -0,0 +1,31 @@
|
|||
import React, { FC } from 'react';
|
||||
import styles from '~/layouts/BorisLayout/styles.module.scss';
|
||||
import { BorisSuperpowers } from '~/components/boris/BorisSuperpowers';
|
||||
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';
|
||||
|
||||
interface Props {
|
||||
user: IUser;
|
||||
isTester: boolean;
|
||||
stats: BorisUsageStats;
|
||||
setBetaTester: (val: boolean) => void;
|
||||
}
|
||||
|
||||
const BorisSidebar: FC<Props> = ({ user, stats, isTester, setBetaTester }) => (
|
||||
<Group className={styles.stats__container}>
|
||||
<div className={styles.super_powers}>
|
||||
{user.is_user && <BorisSuperpowers active={isTester} onChange={setBetaTester} />}
|
||||
</div>
|
||||
|
||||
<BorisContacts />
|
||||
|
||||
<div className={styles.stats__wrap}>
|
||||
<BorisStats stats={stats} />
|
||||
</div>
|
||||
</Group>
|
||||
);
|
||||
|
||||
export { BorisSidebar };
|
|
@ -1,10 +1,10 @@
|
|||
import React, { FC } from 'react';
|
||||
import { IBorisState } from '~/redux/boris/reducer';
|
||||
import { BorisUsageStats, IBorisState } from '~/redux/boris/reducer';
|
||||
import { BorisStatsGit } from '../BorisStatsGit';
|
||||
import { BorisStatsBackend } from '../BorisStatsBackend';
|
||||
|
||||
interface IProps {
|
||||
stats: IBorisState['stats'];
|
||||
stats: BorisUsageStats;
|
||||
}
|
||||
|
||||
const BorisStats: FC<IProps> = ({ stats }) => {
|
||||
|
|
|
@ -33,41 +33,10 @@ const Cell: FC<IProps> = ({
|
|||
const [is_loaded, setIsLoaded] = useState(false);
|
||||
const [is_visible, setIsVisible] = useState(true);
|
||||
|
||||
// const checkIfVisible = useCallback(() => {
|
||||
// if (!ref.current) return;
|
||||
//
|
||||
// const { top, height } = ref.current.getBoundingClientRect();
|
||||
//
|
||||
// // const visibility = top + height > -window.innerHeight && top < window.innerHeight * 2;
|
||||
// const visibility = top + height > -600 && top < window.innerHeight + 600;
|
||||
// if (visibility !== is_visible) setIsVisible(visibility);
|
||||
// }, [ref, is_visible, setIsVisible]);
|
||||
//
|
||||
// const checkIfVisibleDebounced = useCallback(debounce(Math.random() * 100 + 100, checkIfVisible), [
|
||||
// checkIfVisible,
|
||||
// ]);
|
||||
|
||||
// useEffect(() => {
|
||||
// checkIfVisibleDebounced();
|
||||
// }, []);
|
||||
|
||||
// useEffect(() => {
|
||||
// recalc visibility of other elements
|
||||
// window.dispatchEvent(new CustomEvent('scroll'));
|
||||
// }, [flow]);
|
||||
|
||||
// useEffect(() => {
|
||||
// window.addEventListener('scroll', checkIfVisibleDebounced);
|
||||
//
|
||||
// return () => window.removeEventListener('scroll', checkIfVisibleDebounced);
|
||||
// }, [checkIfVisibleDebounced]);
|
||||
|
||||
const onImageLoad = useCallback(() => {
|
||||
setIsLoaded(true);
|
||||
}, [setIsLoaded]);
|
||||
|
||||
// Replaced it with <Link>, maybe, you can remove it completely with NodeSelect action
|
||||
// const onClick = useCallback(() => onSelect(id, type), [onSelect, id, type]);
|
||||
const has_description = description && description.length > 32;
|
||||
|
||||
const text =
|
||||
|
@ -82,12 +51,12 @@ const Cell: FC<IProps> = ({
|
|||
}, [id, flow, onChangeCellView]);
|
||||
|
||||
const setViewSingle = useCallback(() => {
|
||||
const show_description = (flow && !!flow.show_description) || false;
|
||||
const show_description = (flow && flow.show_description) || false;
|
||||
onChangeCellView(id, { show_description, display: 'single' });
|
||||
}, [id, flow, onChangeCellView]);
|
||||
|
||||
const setViewHorizontal = useCallback(() => {
|
||||
const show_description = (flow && !!flow.show_description) || false;
|
||||
const show_description = (flow && flow.show_description) || false;
|
||||
onChangeCellView(id, { show_description, display: 'horizontal' });
|
||||
}, [id, flow, onChangeCellView]);
|
||||
|
||||
|
|
|
@ -30,18 +30,13 @@
|
|||
.thumbnail {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
.title {
|
||||
//opacity: 0;
|
||||
//transform: translate(-3px, 3px);
|
||||
}
|
||||
}
|
||||
@include outer_shadow();
|
||||
}
|
||||
|
||||
.text {
|
||||
font: $font_18_regular;
|
||||
line-height: 22px;
|
||||
line-height: 23px;
|
||||
background: transparentize($color: $content_bg, $amount: 0.3) url('../../../sprites/stripes.svg');
|
||||
padding: $gap;
|
||||
box-sizing: border-box;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue