diff --git a/ivette/src/dome/renderer/controls/labels.tsx b/ivette/src/dome/renderer/controls/labels.tsx index 57b820409dce90faa2c78f012237ed5445f6fd9d..630d9bfd0a075d4a76e9704a5262ce88c9fc5322 100644 --- a/ivette/src/dome/renderer/controls/labels.tsx +++ b/ivette/src/dome/renderer/controls/labels.tsx @@ -62,29 +62,30 @@ export interface LabelProps { onContextMenu?: (evt: React.MouseEvent) => void; } -const makeLabel = (className: string) => (props: LabelProps, ref: any) => { - const { display = true } = props; - const allClasses = classes( - className, - !display && 'dome-control-erased', - props.className, - ); - return ( - <label - ref={ref} - className={allClasses} - title={props.title} - style={props.style} - onClick={props.onClick} - onDoubleClick={props.onDoubleClick} - onContextMenu={props.onContextMenu} - > - {props.icon && <Icon title={props.title} id={props.icon} />} - {props.label} - {props.children} - </label> - ); -}; +const makeLabel = (className: string) => + function Label(props: LabelProps, ref: any) { + const { display = true } = props; + const allClasses = classes( + className, + !display && 'dome-control-erased', + props.className, + ); + return ( + <label + ref={ref} + className={allClasses} + title={props.title} + style={props.style} + onClick={props.onClick} + onDoubleClick={props.onDoubleClick} + onContextMenu={props.onContextMenu} + > + {props.icon && <Icon title={props.title} id={props.icon} />} + {props.label} + {props.children} + </label> + ); + }; // -------------------------------------------------------------------------- // --- CSS Classes diff --git a/ivette/src/dome/renderer/table/views.tsx b/ivette/src/dome/renderer/table/views.tsx index ca3e2111296dbe32e3b2b861fd9c9da2618eacb8..54cae79cb42374778e1ddfbae5cfb1a83545c42c 100644 --- a/ivette/src/dome/renderer/table/views.tsx +++ b/ivette/src/dome/renderer/table/views.tsx @@ -262,7 +262,7 @@ function makeDataRenderer( render: ((data: any) => ReactNode) = defaultRenderer, onContextMenu?: (row: any, index: number, dataKey: string) => void, ): TableCellRenderer { - return ((props : TableCellProps) => { + return function TableCell(props: TableCellProps) { const { cellData } = props; try { const contents = cellData ? render(cellData) : null; @@ -283,7 +283,7 @@ function makeDataRenderer( ); return null; } - }); + }; } // -------------------------------------------------------------------------- diff --git a/ivette/src/frama-c/kernel/Globals.tsx b/ivette/src/frama-c/kernel/Globals.tsx index 49799d3ef0f8e4f249f6e7c6a4f4b3bf85909a4a..6c9714d287b8ab459218a8f2dc7d50b39eb90087 100644 --- a/ivette/src/frama-c/kernel/Globals.tsx +++ b/ivette/src/frama-c/kernel/Globals.tsx @@ -95,7 +95,7 @@ function FctItem(props: FctItemProps) { // --- Globals Section(s) // -------------------------------------------------------------------------- -export default () => { +export default function Globals() { // Hooks const [selection, updateSelection] = States.useSelection(); @@ -198,6 +198,6 @@ export default () => { </Section> ); -}; +} // -------------------------------------------------------------------------- diff --git a/ivette/src/frama-c/plugins/eva/CoverageMeter.tsx b/ivette/src/frama-c/plugins/eva/CoverageMeter.tsx index fe709dea8cd16a3dac7fae2ba63998551318fddc..7248e4c0ea0f3b2f291e0b5793cb25d634ba5022 100644 --- a/ivette/src/frama-c/plugins/eva/CoverageMeter.tsx +++ b/ivette/src/frama-c/plugins/eva/CoverageMeter.tsx @@ -33,7 +33,7 @@ export function percent(coverage: CoverageProps): string { return `${(q * 100).toFixed(1)}%`; } -export default function(props: { coverage: CoverageProps }) { +export default function CoverageMeter(props: { coverage: CoverageProps }) { const { reachable, dead } = props.coverage; const total = reachable + dead; diff --git a/ivette/src/renderer/Application.tsx b/ivette/src/renderer/Application.tsx index e3ba66cbb858995e681635296071bb4af395ef07..ec11b9c6bda4143e33fc2f60deaf46e7a29e49a6 100644 --- a/ivette/src/renderer/Application.tsx +++ b/ivette/src/renderer/Application.tsx @@ -41,7 +41,7 @@ import './loader'; // --- Main View // -------------------------------------------------------------------------- -export default (() => { +export default function Application() { const [sidebar, flipSidebar] = Dome.useFlipSettings('frama-c.sidebar.unfold', true); const [viewbar, flipViewbar] = @@ -95,6 +95,6 @@ export default (() => { </Toolbar.ToolBar> </Vfill> ); -}); +} // -------------------------------------------------------------------------- diff --git a/ivette/src/renderer/Laboratory.tsx b/ivette/src/renderer/Laboratory.tsx index cf3ce8cd5cec0db6eaa8f41ec5351746a210673c..edeffafa31133bac158ad72491ff62cbfcdce585 100644 --- a/ivette/src/renderer/Laboratory.tsx +++ b/ivette/src/renderer/Laboratory.tsx @@ -141,70 +141,76 @@ const GRIDITEM_PLAIN = { fill: 'both' }; const GRIDITEM_HPANE = { fill: 'horizontal' }; const GRIDITEM_VPANE = { fill: 'vertical' }; -const makeGridItem = (customize: any, onClose: any) => (comp: any) => { - const { id: libId, label, title, layout = 'PLAIN', children } = comp; - const id = getItemId('components', libId); - let properties: any = { ...GRIDITEM }; - switch (layout) { - case 'PLAIN': - properties = { ...properties, ...GRIDITEM_PLAIN }; - break; - case 'HPANE': - properties = { ...properties, GRIDITEM_HPANE }; - break; - case 'VPANE': - properties = { ...properties, GRIDITEM_VPANE }; - break; - default: - console.warn(`[labviews] unexpected layout for ${id} component`, layout); - break; - } - Object.keys(properties).forEach((key) => { - const prop = comp[key]; - if (prop) properties[key] = prop; - }); - let CLOSING; - if (customize) { - CLOSING = ( - <IconButton - className="labview-close" - offset={-1} - icon="CROSS" - onClick={() => onClose(id)} - /> +const makeGridItem = (customize: any, onClose: any) => + function GridItem(comp: any) { + const { id: libId, label, title, layout = 'PLAIN', children } = comp; + const id = getItemId('components', libId); + let properties: any = { ...GRIDITEM }; + switch (layout) { + case 'PLAIN': + properties = { ...properties, ...GRIDITEM_PLAIN }; + break; + case 'HPANE': + properties = { ...properties, GRIDITEM_HPANE }; + break; + case 'VPANE': + properties = { ...properties, GRIDITEM_VPANE }; + break; + default: + console.warn( + `[labviews] unexpected layout for ${id} component`, + layout); + break; + } + Object.keys(properties).forEach((key) => { + const prop = comp[key]; + if (prop) properties[key] = prop; + }); + let CLOSING; + if (customize) { + CLOSING = ( + <IconButton + className="labview-close" + offset={-1} + icon="CROSS" + onClick={() => onClose(id)} + /> + ); + } + return ( + <Grids.GridItem + id={id} + className={properties.className} + handle={properties.handle} + resize={properties.resize} + fill={properties.fill} + shrink={properties.shrink} + minWidth={properties.minWidth} + minHeight={properties.minHeight} + width={properties.width} + height={properties.height} + > + <Vfill className="labview-content"> + <Hbox className="labview-titlebar"> + <Hfill> + <Catch label={id}> + <RenderElement id={`labview.title.${id}`}> + <Label + className="labview-handle" + label={label} + title={title} /> + </RenderElement> + </Catch> + </Hfill> + {CLOSING} + </Hbox> + <TITLE.Provider value={{ id, label, title }}> + <Catch label={id}>{children}</Catch> + </TITLE.Provider> + </Vfill> + </Grids.GridItem> ); } - return ( - <Grids.GridItem - id={id} - className={properties.className} - handle={properties.handle} - resize={properties.resize} - fill={properties.fill} - shrink={properties.shrink} - minWidth={properties.minWidth} - minHeight={properties.minHeight} - width={properties.width} - height={properties.height} - > - <Vfill className="labview-content"> - <Hbox className="labview-titlebar"> - <Hfill> - <Catch label={id}> - <RenderElement id={`labview.title.${id}`}> - <Label className="labview-handle" label={label} title={title} /> - </RenderElement> - </Catch> - </Hfill> - {CLOSING} - </Hbox> - <TITLE.Provider value={{ id, label, title }}> - <Catch label={id}>{children}</Catch> - </TITLE.Provider> - </Vfill> - </Grids.GridItem> - ); -}; // -------------------------------------------------------------------------- // --- Customization Views diff --git a/ivette/src/renderer/Preferences.tsx b/ivette/src/renderer/Preferences.tsx index 023d17b672a4b63984b193bdc70b501e6443c833..654b661afd20ab7a7043c04abf74d3aef1217481 100644 --- a/ivette/src/renderer/Preferences.tsx +++ b/ivette/src/renderer/Preferences.tsx @@ -101,28 +101,30 @@ function EditorCommandFields(props: P.EditorCommandProps) { // --- Export Components // -------------------------------------------------------------------------- -export default (() => ( - <Forms.Page> - <Forms.Section label="AST View" unfold> - <ThemeFields - target="Internal AST" - theme={P.AstTheme} - fontSize={P.AstFontSize} - wrapText={P.AstWrapText} - /> - </Forms.Section> - <Forms.Section label="Source View" unfold> - <ThemeFields - target="Source Code" - theme={P.SourceTheme} - fontSize={P.SourceFontSize} - wrapText={P.SourceWrapText} - /> - </Forms.Section> - <Forms.Section label="Editor Command" unfold> - <EditorCommandFields command={P.EditorCommand} /> - </Forms.Section> - </Forms.Page> -)); +export default function Preferences() { + return ( + <Forms.Page> + <Forms.Section label="AST View" unfold> + <ThemeFields + target="Internal AST" + theme={P.AstTheme} + fontSize={P.AstFontSize} + wrapText={P.AstWrapText} + /> + </Forms.Section> + <Forms.Section label="Source View" unfold> + <ThemeFields + target="Source Code" + theme={P.SourceTheme} + fontSize={P.SourceFontSize} + wrapText={P.SourceWrapText} + /> + </Forms.Section> + <Forms.Section label="Editor Command" unfold> + <EditorCommandFields command={P.EditorCommand} /> + </Forms.Section> + </Forms.Page> + ) +} // --------------------------------------------------------------------------