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