mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 21:06:42 +07:00
added updates everywhere
This commit is contained in:
parent
a451e30499
commit
b1e68a8a6d
27 changed files with 246 additions and 79 deletions
|
@ -6,10 +6,8 @@ import classNames from 'classnames';
|
|||
import styles from './styles.module.scss';
|
||||
import markdown from '~/styles/common/markdown.module.scss';
|
||||
import { Icon } from '~/components/input/Icon';
|
||||
import { flowSetCellView } from '~/redux/flow/actions';
|
||||
import { PRESETS } from '~/constants/urls';
|
||||
import { NODE_TYPES } from '~/redux/node/constants';
|
||||
import { Group } from '~/components/containers/Group';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
const THUMBNAIL_SIZES = {
|
||||
|
@ -21,8 +19,8 @@ interface IProps {
|
|||
is_text?: boolean;
|
||||
can_edit?: boolean;
|
||||
|
||||
onSelect: (id: INode['id'], type: INode['type']) => void;
|
||||
onChangeCellView: typeof flowSetCellView;
|
||||
onSelect: (id: INode['id']) => void;
|
||||
onChangeCellView: (id: INode['id'], flow: INode['flow']) => void;
|
||||
}
|
||||
|
||||
const Cell: FC<IProps> = ({
|
||||
|
|
|
@ -1,19 +1,22 @@
|
|||
import React, { FC, Fragment } from 'react';
|
||||
import React, { FC, Fragment, useCallback } from 'react';
|
||||
import { Cell } from '~/components/flow/Cell';
|
||||
|
||||
import { IFlowState } from '~/redux/flow/reducer';
|
||||
import { INode } from '~/redux/types';
|
||||
import { canEditNode } from '~/utils/node';
|
||||
import { IUser } from '~/redux/auth/types';
|
||||
import { flowSetCellView } from '~/redux/flow/actions';
|
||||
import { useHistory } from 'react-router';
|
||||
import { URLS } from '~/constants/urls';
|
||||
|
||||
type IProps = Partial<IFlowState> & {
|
||||
user: Partial<IUser>;
|
||||
onSelect: (id: INode['id'], type: INode['type']) => void;
|
||||
onChangeCellView: typeof flowSetCellView;
|
||||
onChangeCellView: (id: INode['id'], flow: INode['flow']) => void;
|
||||
};
|
||||
|
||||
export const FlowGrid: FC<IProps> = ({ user, nodes, onSelect, onChangeCellView }) => {
|
||||
export const FlowGrid: FC<IProps> = ({ user, nodes, onChangeCellView }) => {
|
||||
const history = useHistory();
|
||||
const onSelect = useCallback((id: INode['id']) => history.push(URLS.NODE_URL(id)), [history]);
|
||||
|
||||
if (!nodes) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import { NodeRelatedItem } from '~/components/node/NodeRelatedItem';
|
|||
import { getPrettyDate } from '~/utils/dom';
|
||||
import { Link } from 'react-router-dom';
|
||||
import classNames from 'classnames';
|
||||
import { Icon } from '~/components/input/Icon';
|
||||
|
||||
interface IProps {
|
||||
node: Partial<INode>;
|
||||
|
@ -15,13 +16,22 @@ interface IProps {
|
|||
const FlowRecentItem: FC<IProps> = ({ node, has_new }) => {
|
||||
return (
|
||||
<Link key={node.id} className={styles.item} to={URLS.NODE_URL(node.id)}>
|
||||
<div className={classNames(styles.thumb, { [styles.new]: has_new })}>
|
||||
<div
|
||||
className={classNames(styles.thumb, {
|
||||
[styles.new]: has_new,
|
||||
[styles.lab]: !node.is_promoted,
|
||||
})}
|
||||
>
|
||||
<NodeRelatedItem item={node} />
|
||||
</div>
|
||||
|
||||
<div className={styles.info}>
|
||||
<div className={styles.title}>{node.title || '...'}</div>
|
||||
<div className={styles.comment}>{getPrettyDate(node.created_at)}</div>
|
||||
|
||||
<div className={styles.comment}>
|
||||
{!node.is_promoted && <Icon icon="lab" size={14} />}
|
||||
<span>{getPrettyDate(node.created_at)}</span>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
);
|
||||
|
|
|
@ -37,6 +37,12 @@
|
|||
bottom: -2px;
|
||||
}
|
||||
}
|
||||
|
||||
&.lab {
|
||||
&::after {
|
||||
background: $blue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.info {
|
||||
|
@ -55,8 +61,16 @@
|
|||
.comment {
|
||||
font: $font_12_regular;
|
||||
margin-top: 4px;
|
||||
opacity: 0.5;
|
||||
color: darken(white, 50%);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
svg {
|
||||
fill: currentColor;
|
||||
margin-right: $gap / 2;
|
||||
margin-top: 1px;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,20 +13,16 @@ interface IProps {
|
|||
recent: IFlowState['recent'];
|
||||
updated: IFlowState['updated'];
|
||||
search: IFlowState['search'];
|
||||
flowChangeSearch: typeof FLOW_ACTIONS.flowChangeSearch;
|
||||
onSearchChange: (text: string) => void;
|
||||
onLoadMore: () => void;
|
||||
}
|
||||
|
||||
const FlowStamp: FC<IProps> = ({ recent, updated, search, flowChangeSearch, onLoadMore }) => {
|
||||
const onSearchChange = useCallback((text: string) => flowChangeSearch({ text }), [
|
||||
flowChangeSearch,
|
||||
]);
|
||||
|
||||
const FlowStamp: FC<IProps> = ({ recent, updated, search, onSearchChange, onLoadMore }) => {
|
||||
const onSearchSubmit = useCallback((event: FormEvent) => {
|
||||
event.preventDefault();
|
||||
}, []);
|
||||
|
||||
const onClearSearch = useCallback(() => flowChangeSearch({ text: '' }), [flowChangeSearch]);
|
||||
const onClearSearch = useCallback(() => onSearchChange(''), [onSearchChange]);
|
||||
|
||||
const onKeyUp = useCallback(
|
||||
event => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue