|
1 | 1 | import React from 'react'; |
| 2 | +import { AppAction } from '@/app/types'; |
2 | 3 | import { ControlGroup } from '@/shared/ui/ControlGroup'; |
| 4 | +import { FormulaFunctionGroup } from './formulas/FormulaFunctionGroup'; |
3 | 5 |
|
4 | | -export function FormulaRibbon() { |
| 6 | +interface FormulaRibbonProps { |
| 7 | + onAction: (action: AppAction) => void; |
| 8 | +} |
| 9 | + |
| 10 | +const statistics = [ |
| 11 | + {icon: 'fa fa-plus', label: 'SUM', template: '=SUM('}, |
| 12 | + {icon: 'fa fa-arrow-down', label: 'MIN', template: '=MIN('}, |
| 13 | + {icon: 'fa fa-arrow-up', label: 'MAX', template: '=MAX('}, |
| 14 | +]; |
| 15 | + |
| 16 | +const mathematical = [ |
| 17 | + {icon: 'fa fa-square-root-alt', label: 'SQRT', template: '=SQRT('}, |
| 18 | + {icon: 'fa fa-plus-circle', label: 'ABS', template: '=ABS('}, |
| 19 | + {icon: 'fa fa-chart-line', label: 'LOG', template: '=LOG('}, |
| 20 | + {icon: 'fa fa-superscript', label: 'EXP', template: '=EXP('}, |
| 21 | +]; |
| 22 | + |
| 23 | +const trigonometry = [ |
| 24 | + {icon: 'fa fa-wave-square', label: 'SIN', template: '=SIN('}, |
| 25 | + {icon: 'fa fa-wave-square', label: 'COS', template: '=COS('}, |
| 26 | + {icon: 'fa fa-wave-square', label: 'TAN', template: '=TAN('}, |
| 27 | +]; |
| 28 | + |
| 29 | +const constants = [ |
| 30 | + {icon: 'fa fa-circle-notch', label: 'PI', template: '=PI'}, |
| 31 | + {icon: 'fa fa-italic', label: 'E', template: '=E'}, |
| 32 | +]; |
| 33 | + |
| 34 | +export function FormulaRibbon(props: FormulaRibbonProps) { |
5 | 35 | return React.createElement( |
6 | 36 | 'div', |
7 | 37 | {className: 'ows-ribbon-panel'}, |
8 | | - React.createElement(ControlGroup, {label: 'Mathematical', wide: true}, |
9 | | - React.createElement('span', {className: 'ows-muted'}, 'Function tools'), |
10 | | - ), |
11 | | - React.createElement(ControlGroup, {label: 'Statistics', wide: true}, |
12 | | - React.createElement('span', {className: 'ows-muted'}, 'Analysis helpers'), |
13 | | - ), |
| 38 | + React.createElement(FormulaFunctionGroup, {functions: statistics, label: 'Statistics', onAction: props.onAction}), |
| 39 | + React.createElement(FormulaFunctionGroup, {functions: mathematical, label: 'Mathematical', onAction: props.onAction}), |
| 40 | + React.createElement(FormulaFunctionGroup, {functions: trigonometry, label: 'Trigonometry', onAction: props.onAction}), |
| 41 | + React.createElement(FormulaFunctionGroup, {functions: constants, label: 'Constants', onAction: props.onAction}), |
14 | 42 | React.createElement(ControlGroup, {label: 'User Defined Functions', wide: true}, |
15 | | - React.createElement('span', {className: 'ows-muted'}, 'Custom formulas'), |
| 43 | + React.createElement('span', {className: 'ows-muted'}, 'Custom functions are planned'), |
16 | 44 | ), |
17 | 45 | ); |
18 | 46 | } |
0 commit comments