import React, { useContext, useEffect, useState } from 'react'; import { Button, Col, Collapse, Row, Slider, Space } from 'antd'; import Paragraph from 'antd/lib/typography/Paragraph'; import Title from 'antd/lib/typography/Title'; import { EditCustomStyles } from '../../../../components/config/EditCustomStyles'; import s from './appearance.module.scss'; import { postConfigUpdateToAPI, RESET_TIMEOUT } from '../../../../utils/config-constants'; import { createInputStatus, StatusState, STATUS_ERROR, STATUS_SUCCESS, } from '../../../../utils/input-statuses'; import { ServerStatusContext } from '../../../../utils/server-status-context'; import { FormStatusIndicator } from '../../../../components/config/FormStatusIndicator'; const { Panel } = Collapse; const ENDPOINT = '/appearance'; interface AppearanceVariable { value: string; description: string; } const chatColorVariables = [ { name: 'theme-color-users-0', description: '' }, { name: 'theme-color-users-1', description: '' }, { name: 'theme-color-users-2', description: '' }, { name: 'theme-color-users-3', description: '' }, { name: 'theme-color-users-4', description: '' }, { name: 'theme-color-users-5', description: '' }, { name: 'theme-color-users-6', description: '' }, { name: 'theme-color-users-7', description: '' }, ]; const paletteVariables = [ { name: 'theme-color-palette-0', description: '' }, { name: 'theme-color-palette-1', description: '' }, { name: 'theme-color-palette-2', description: '' }, { name: 'theme-color-palette-3', description: '' }, { name: 'theme-color-palette-4', description: '' }, { name: 'theme-color-palette-5', description: '' }, { name: 'theme-color-palette-6', description: '' }, { name: 'theme-color-palette-7', description: '' }, { name: 'theme-color-palette-8', description: '' }, { name: 'theme-color-palette-9', description: '' }, { name: 'theme-color-palette-10', description: '' }, { name: 'theme-color-palette-11', description: '' }, { name: 'theme-color-palette-12', description: '' }, ]; const componentColorVariables = [ { name: 'theme-color-background-main', description: 'Background' }, { name: 'theme-color-action', description: 'Action' }, { name: 'theme-color-action-hover', description: 'Action Hover' }, { name: 'theme-color-components-chat-background', description: 'Chat Background' }, { name: 'theme-color-components-chat-text', description: 'Text: Chat' }, { name: 'theme-color-components-text-on-dark', description: 'Text: Light' }, { name: 'theme-color-components-text-on-light', description: 'Text: Dark' }, { name: 'theme-color-background-header', description: 'Header/Footer' }, { name: 'theme-color-components-content-background', description: 'Page Content' }, { name: 'theme-color-components-scrollbar-background', description: 'Scrollbar Background' }, { name: 'theme-color-components-scrollbar-thumb', description: 'Scrollbar Thumb' }, ]; const others = [{ name: 'theme-rounded-corners', description: 'Corner radius' }]; // Create an object so these vars can be indexed by name. const allAvailableValues = [ ...paletteVariables, ...componentColorVariables, ...chatColorVariables, ...others, ].reduce((obj, val) => { // eslint-disable-next-line no-param-reassign obj[val.name] = { name: val.name, description: val.description }; return obj; }, {}); function ColorPicker({ value, name, description, onChange, }: { value: string; name: string; description: string; onChange: (name: string, value: string, description: string) => void; }) { return (
Certain sections of the interface can be customized by selecting new colors for them.