前端标注临时用户
This commit is contained in:
36
src/Flows.js
36
src/Flows.js
@@ -1,17 +1,9 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
import copy from 'copy-to-clipboard';
|
import copy from 'copy-to-clipboard';
|
||||||
import { ColorPicker } from './color_picker';
|
import { ColorPicker } from './color_picker';
|
||||||
import {
|
import { split_text, PID_RE } from './text_splitter';
|
||||||
split_text,
|
|
||||||
NICKNAME_RE,
|
|
||||||
PID_RE,
|
|
||||||
URL_RE,
|
|
||||||
URL_PID_RE,
|
|
||||||
TAG_RE,
|
|
||||||
} from './text_splitter';
|
|
||||||
import {
|
import {
|
||||||
format_time,
|
format_time,
|
||||||
build_highlight_re,
|
|
||||||
Time,
|
Time,
|
||||||
TitleLine,
|
TitleLine,
|
||||||
ClickHandler,
|
ClickHandler,
|
||||||
@@ -136,6 +128,9 @@ class Reply extends PureComponent {
|
|||||||
{info.author_title && (
|
{info.author_title && (
|
||||||
<span className="box-header-name author-title">{`"${info.author_title}"`}</span>
|
<span className="box-header-name author-title">{`"${info.author_title}"`}</span>
|
||||||
)}
|
)}
|
||||||
|
{info.is_tmp && (
|
||||||
|
<span className="box-header-name tmp-title">临时账号</span>
|
||||||
|
)}
|
||||||
{!!do_delete && !!info.can_del && (
|
{!!do_delete && !!info.can_del && (
|
||||||
<span
|
<span
|
||||||
className="clickable"
|
className="clickable"
|
||||||
@@ -240,6 +235,7 @@ class FlowItem extends PureComponent {
|
|||||||
search_param,
|
search_param,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const { cw } = this.state;
|
const { cw } = this.state;
|
||||||
|
const _display_color = color_picker.get(DZ_NAME, info.is_tmp);
|
||||||
return (
|
return (
|
||||||
<div className={'flow-item' + (is_quote ? ' flow-item-quote' : '')}>
|
<div className={'flow-item' + (is_quote ? ' flow-item-quote' : '')}>
|
||||||
{!!is_quote && (
|
{!!is_quote && (
|
||||||
@@ -252,7 +248,13 @@ class FlowItem extends PureComponent {
|
|||||||
{/*</div>*/}
|
{/*</div>*/}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="box">
|
<div
|
||||||
|
className="box"
|
||||||
|
style={{
|
||||||
|
'--box-bgcolor-light': _display_color[0],
|
||||||
|
'--box-bgcolor-dark': _display_color[1],
|
||||||
|
}}
|
||||||
|
>
|
||||||
{!!window.LATEST_POST_ID &&
|
{!!window.LATEST_POST_ID &&
|
||||||
parseInt(info.pid, 10) > window.LATEST_POST_ID && (
|
parseInt(info.pid, 10) > window.LATEST_POST_ID && (
|
||||||
<div className="flow-item-dot" />
|
<div className="flow-item-dot" />
|
||||||
@@ -292,8 +294,11 @@ class FlowItem extends PureComponent {
|
|||||||
{info.author_title && (
|
{info.author_title && (
|
||||||
<span className="box-header-name author-title">{`"${info.author_title}"`}</span>
|
<span className="box-header-name author-title">{`"${info.author_title}"`}</span>
|
||||||
)}
|
)}
|
||||||
|
{info.is_tmp && (
|
||||||
|
<span className="box-header-name tmp-title">临时账号</span>
|
||||||
|
)}
|
||||||
{info.is_reported && <span className="danger-info"> R </span>}
|
{info.is_reported && <span className="danger-info"> R </span>}
|
||||||
{!!do_delete && !!info.can_del && (
|
{!!do_delete && !!can_del && (
|
||||||
<span
|
<span
|
||||||
className="clickable"
|
className="clickable"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -316,10 +321,10 @@ class FlowItem extends PureComponent {
|
|||||||
{info.blocked_count && (
|
{info.blocked_count && (
|
||||||
<span className="danger-info"> {info.blocked_count} </span>
|
<span className="danger-info"> {info.blocked_count} </span>
|
||||||
)}
|
)}
|
||||||
{info.cw !== null && (!do_edit_cw || !info.can_del) && (
|
{info.cw !== null && (!do_edit_cw || !can_del) && (
|
||||||
<span className="box-header-cw">{info.cw}</span>
|
<span className="box-header-cw">{info.cw}</span>
|
||||||
)}
|
)}
|
||||||
{!!do_edit_cw && !!info.can_del && (
|
{!!do_edit_cw && !!can_del && (
|
||||||
<div className="box-header-cw-edit clickable">
|
<div className="box-header-cw-edit clickable">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
@@ -334,7 +339,7 @@ class FlowItem extends PureComponent {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{info.allow_search && <span> 📢 </span>}
|
{info.allow_search && <span> 📢 </span>}
|
||||||
<Time stamp={info.timestamp} short={!img_clickable} />
|
<Time stamp={timestamp} short={!img_clickable} />
|
||||||
</div>
|
</div>
|
||||||
{!!info.hot_score && (
|
{!!info.hot_score && (
|
||||||
<span className="box-header">hot score: {info.hot_score}</span>
|
<span className="box-header">hot score: {info.hot_score}</span>
|
||||||
@@ -1081,6 +1086,9 @@ class FlowItemRow extends PureComponent {
|
|||||||
{this.props.info.author_title && (
|
{this.props.info.author_title && (
|
||||||
<span className="box-header-name author-title">{`"${this.props.info.author_title}"`}</span>
|
<span className="box-header-name author-title">{`"${this.props.info.author_title}"`}</span>
|
||||||
)}
|
)}
|
||||||
|
{this.props.info.is_tmp && (
|
||||||
|
<span className="box-header-name tmp-title">临时账号</span>
|
||||||
|
)}
|
||||||
{this.props.info.cw !== null && (
|
{this.props.info.cw !== null && (
|
||||||
<span className="box-header-cw">{this.props.info.cw}</span>
|
<span className="box-header-cw">{this.props.info.cw}</span>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -8,8 +8,9 @@ export class ColorPicker {
|
|||||||
this.current_h = Math.random();
|
this.current_h = Math.random();
|
||||||
}
|
}
|
||||||
|
|
||||||
get(name) {
|
get(name, is_tmp = false) {
|
||||||
name = name.toLowerCase();
|
name = name.toLowerCase();
|
||||||
|
if (is_tmp) return ['hsl(0, 0%, 80%)', 'hsl(0, 0%, 30%)'];
|
||||||
if (name === '洞主') return ['hsl(0, 0%, 97%)', 'hsl(0, 0%, 16%)'];
|
if (name === '洞主') return ['hsl(0, 0%, 97%)', 'hsl(0, 0%, 16%)'];
|
||||||
|
|
||||||
if (!this.names[name]) {
|
if (!this.names[name]) {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export const parse_replies = (replies, color_picker) =>
|
|||||||
.sort((a, b) => parseInt(a.cid, 10) - parseInt(b.cid, 10))
|
.sort((a, b) => parseInt(a.cid, 10) - parseInt(b.cid, 10))
|
||||||
.map((info) => {
|
.map((info) => {
|
||||||
info.name = gen_name(info.name_id);
|
info.name = gen_name(info.name_id);
|
||||||
info._display_color = color_picker.get(info.name);
|
info._display_color = color_picker.get(info.name, info.is_tmp);
|
||||||
info.variant = {};
|
info.variant = {};
|
||||||
return info;
|
return info;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user