mirror of
https://github.com/spbleadersofdigtal/frontend.git
synced 2024-11-21 18:06:33 +03:00
доделал
This commit is contained in:
parent
4e4a66108c
commit
38a38eeb40
|
@ -26,6 +26,10 @@
|
|||
color: $color-text-secondary;
|
||||
cursor: pointer;
|
||||
|
||||
@include scrollbar;
|
||||
overflow-y: auto;
|
||||
max-height: 500px;
|
||||
|
||||
&:not(.Hint_hovered) {
|
||||
white-space: nowrap;
|
||||
max-width: 500px;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
display: flex;
|
||||
align-items: center;
|
||||
min-height: 50px;
|
||||
max-height: 300px;
|
||||
padding: 15px $spacing-small-x;
|
||||
color: $color-text-primary;
|
||||
overflow: hidden;
|
||||
|
@ -20,6 +21,8 @@
|
|||
overflow-y: auto;
|
||||
word-wrap: break-word;
|
||||
|
||||
@include scrollbar;
|
||||
|
||||
&:hover {
|
||||
box-shadow: $shadow-hover;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import s from './ChatFormMultipleRange.module.scss';
|
|||
import {Range} from '../../../../../../components/Range';
|
||||
import {Hint} from '../../../../../../api/deck';
|
||||
import {Hint as HintCmp, HintsContainer} from '../../../../../../components/Hint';
|
||||
import {currencyFormatter} from '../../../../../../utils/fomat';
|
||||
|
||||
export interface RangeType {
|
||||
name: string;
|
||||
|
@ -24,7 +25,7 @@ export interface ChatFormSelectProps {
|
|||
hint?: Hint | false;
|
||||
}
|
||||
|
||||
export const slugsForFormat = ['sam', 'som', 'tam', 'sum'];
|
||||
export const slugsForFormat = ['sam', 'som', 'tam', 'sum', 'cac', 'ltv'];
|
||||
|
||||
export const ChatFormMultipleRange: ReactFCC<ChatFormSelectProps> = (props) => {
|
||||
const {className, registration, control, scrollbars, onSubmit, hint, setValue} = props;
|
||||
|
@ -37,7 +38,7 @@ export const ChatFormMultipleRange: ReactFCC<ChatFormSelectProps> = (props) => {
|
|||
{hint && hint.value && Object.entries(hint.value).map(([key, val], index) => {
|
||||
const range = scrollbars.find((j) => j.slug === key);
|
||||
return range ? (
|
||||
<HintCmp onClick={() => setValue({ ...value, [key]: val })} key={index}>{`${range.name}: ${val}`}</HintCmp>
|
||||
<HintCmp onClick={() => setValue({ ...value, [key]: val })} key={index}>{`${range.name}: ${slugsForFormat.includes(range.slug) ? currencyFormatter.format(val as any) : val}`}</HintCmp>
|
||||
) : null
|
||||
})}
|
||||
</HintsContainer>
|
||||
|
|
|
@ -26,8 +26,12 @@ export const ChatFormText: ReactFCC<ChatFormTextProps> = (props) => {
|
|||
return (
|
||||
<div className={s.ChatFormText}>
|
||||
<HintsContainer isLoading={hint && !hint.value}>
|
||||
{hint && hint.type !== EntityType.cards && hint.value && (
|
||||
<>{Array.isArray(hint.value) ? hint.value.map((item: string, index: number) => (
|
||||
{hint && hint.value && (
|
||||
<>{Array.isArray(hint.value) ? hint.type === EntityType.cards ? (
|
||||
<HintCmp onClick={() => setValue(hint.value.map((i: any) => i.description).join('\n\n'))}>
|
||||
{hint.value.map((i) => i.description).join('\n')}
|
||||
</HintCmp>
|
||||
) : hint.value.map((item: string, index: number) => (
|
||||
<HintCmp onClick={() => setValue(item)} key={index}>{item}</HintCmp>
|
||||
)) : (
|
||||
<HintCmp onClick={() => setValue(hint.value)}>{hint.value}</HintCmp>
|
||||
|
|
Loading…
Reference in New Issue
Block a user